{"id":17991724,"url":"https://github.com/hakavlad/mg-lru-helper","last_synced_at":"2025-03-25T23:32:25.793Z","repository":{"id":44028837,"uuid":"388184666","full_name":"hakavlad/mg-lru-helper","owner":"hakavlad","description":"Control the state of MGLRU","archived":false,"fork":false,"pushed_at":"2023-06-11T04:01:50.000Z","size":23,"stargazers_count":54,"open_issues_count":0,"forks_count":9,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-03-20T23:01:49.943Z","etag":null,"topics":["linux","lru","memory","memory-management","mglru"],"latest_commit_sha":null,"homepage":"","language":"Makefile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"cc0-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hakavlad.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-07-21T16:46:30.000Z","updated_at":"2025-02-17T11:59:16.000Z","dependencies_parsed_at":"2024-10-29T20:12:07.828Z","dependency_job_id":null,"html_url":"https://github.com/hakavlad/mg-lru-helper","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hakavlad%2Fmg-lru-helper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hakavlad%2Fmg-lru-helper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hakavlad%2Fmg-lru-helper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hakavlad%2Fmg-lru-helper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hakavlad","download_url":"https://codeload.github.com/hakavlad/mg-lru-helper/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245562285,"owners_count":20635896,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["linux","lru","memory","memory-management","mglru"],"created_at":"2024-10-29T19:23:39.176Z","updated_at":"2025-03-25T23:32:24.890Z","avatar_url":"https://github.com/hakavlad.png","language":"Makefile","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Enable or disable multigenerational LRU\n\nThere are simple shell scripts and oneshot systemd services to enable or disable multigenerational LRU at boot time or on the fly, and to get the current state of mg-LRU.\n\n[MGLRU Patches Merged To \"mm-stable\" Ahead Of Linux 6.1](https://www.phoronix.com/news/MGLRU-Reaches-mm-stable)\n\n## Usage\n\nRun `mglru` (get the current state), `set_mglru N` (enable/disable mg-LRU), and `set_min_ttl_ms M`. You can add the oneshot service to startup.\n\nGet the current state:\n```\n$ mglru\n#!/bin/sh -ev\ncat /sys/kernel/mm/lru_gen/enabled\n0x0007\ncat /sys/kernel/mm/lru_gen/min_ttl_ms\n1000\n```\n\nDisable multigenerational LRU:\n```\n$ set_mglru 0\n#!/bin/sh -ev\necho $1 | sudo tee /sys/kernel/mm/lru_gen/enabled\n0\n```\n\nEnable multigenerational LRU:\n```\n$ set_mglru 1\n#!/bin/sh -ev\necho $1 | sudo tee /sys/kernel/mm/lru_gen/enabled\n1\n```\n\nApply all the multigenerational LRU features:\n```\n$ set_mglru y\n#!/bin/sh -ev\necho $1 | sudo tee /sys/kernel/mm/lru_gen/enabled\ny\n```\n\n`set_mglru ` takes values from 0 to 7 and `[yYnN]` (since MGLRU v7). [Most users should enable or disable all the features unless some of them have unforeseen side effects.](https://lore.kernel.org/linux-mm/20220208081902.3550911-13-yuzhao@google.com/#iZ31Documentation:admin-guide:mm:multigen_lru.rst)\n\nSet `min_ttl_ms`:\n```\n$ set_min_ttl_ms 2000\n#!/bin/sh -v\necho $1 | sudo tee /sys/kernel/mm/lru_gen/min_ttl_ms\n2000\n```\n\nEnable/disable multigenerational LRU during system boot:\n```bash\n$ sudo systemctl enable mglru.service\n```\nBy default it sets `/sys/kernel/mm/lru_gen/enabled` to Y and `/sys/kernel/mm/lru_gen/min_ttl_ms` to 1000.\n\nEdit the unit file using systemctl (to change `enabled` and `min_ttl_ms` values):\n```bash\n$ sudo systemctl edit mglru.service --full\n```\n\n## Installation\n\nInstall\n```bash\n$ git clone https://github.com/hakavlad/mg-lru-helper.git\n$ cd mg-lru-helper\n$ sudo make install\n```\n\nUninstall\n```bash\n$ sudo make uninstall\n```\n\n## Kernels with mg-LRU\n\n- https://github.com/xanmod/linux (https://xanmod.org)\n- https://github.com/zen-kernel/zen-kernel (https://liquorix.net)\n- https://gitlab.com/post-factum/pf-kernel/-/wikis/README\n\n## Resources\n\nMultigenerational LRU Framework at LKML:\n- v1: https://lore.kernel.org/lkml/20210313075747.3781593-1-yuzhao@google.com/\n- v2: https://lore.kernel.org/lkml/20210413065633.2782273-1-yuzhao@google.com/\n- v3: https://lore.kernel.org/lkml/20210520065355.2736558-1-yuzhao@google.com/\n- v4: https://lore.kernel.org/lkml/20210818063107.2696454-1-yuzhao@google.com/\n- v5: https://lore.kernel.org/lkml/20211111041510.402534-1-yuzhao@google.com/\n- v6: https://lore.kernel.org/lkml/20220104202227.2903605-1-yuzhao@google.com/\n- v7: https://lore.kernel.org/lkml/20220208081902.3550911-1-yuzhao@google.com/\n- v8: https://lore.kernel.org/lkml/20220308234723.3834941-1-yuzhao@google.com/\n- v9: https://lore.kernel.org/lkml/20220309021230.721028-1-yuzhao@google.com/\n- v10: https://lore.kernel.org/lkml/20220407031525.2368067-1-yuzhao@google.com/\n- v11: https://lore.kernel.org/lkml/20220518014632.922072-1-yuzhao@google.com/\n- v12: https://lore.kernel.org/lkml/20220614071650.206064-1-yuzhao@google.com/\n- v13: https://lore.kernel.org/lkml/20220706220022.968789-1-yuzhao@google.com/\n\nMultigenerational LRU Framework at LWN.net:\n- https://lwn.net/Articles/851184/\n- https://lwn.net/Articles/856931/\n- https://lwn.net/Articles/881675/\n- https://lwn.net/Articles/894859/\n\nMultigenerational LRU Framework at phoronix:\n- https://www.phoronix.com/scan.php?page=news_item\u0026px=Linux-Multigen-LRU\n- https://www.phoronix.com/scan.php?page=news_item\u0026px=Multigenerational-LRU-v2\n- https://www.phoronix.com/scan.php?page=news_item\u0026px=Multigen-LRU-Framework-V3\n- https://www.phoronix.com/scan.php?page=news_item\u0026px=Multigen-LRU-v5\n- https://www.phoronix.com/scan.php?page=news_item\u0026px=Linux-MGLRU-v6-Linux\n- https://www.phoronix.com/scan.php?page=news_item\u0026px=MGLRU-Not-For-5.18\n- https://www.phoronix.com/scan.php?page=news_item\u0026px=Linux-MGLRU-v9-Promising\n- https://www.phoronix.com/scan.php?page=news_item\u0026px=MGLRU-v10\n- https://www.phoronix.com/scan.php?page=news_item\u0026px=MGLRU-v11-Linux-Perf\n- https://www.phoronix.com/scan.php?page=news_item\u0026px=MGLRU-v12-For-Linux-5.19-rc\n- https://www.phoronix.com/scan.php?page=news_item\u0026px=MGLRU-July-2022-Performance\n- https://www.phoronix.com/scan.php?page=news_item\u0026px=MGLRU-v13-More-Benchmarks\n\nMultigenerational LRU Framework at linux.org.ru:\n- https://www.linux.org.ru/forum/general/16321096\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhakavlad%2Fmg-lru-helper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhakavlad%2Fmg-lru-helper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhakavlad%2Fmg-lru-helper/lists"}