rue/mm: compatible with mglru for pagecache limit

The pagecache limit for system and per-cgroup will
cause the process to get stuck when mglru is enabled.
Use lru_gen_enabled() to check whether mglru is
enabled in the system.

Signed-off-by: Honglin Li <honglinli@tencent.com>
Signed-off-by: Kairui Song <kasong@tencent.com>
Signed-off-by: Jingxiang Zeng <linuszeng@tencent.com>
This commit is contained in:
Honglin Li 2024-05-07 15:56:07 +08:00 committed by Haisu Wang
parent 4e6f350b03
commit 7c45f9b01f
1 changed files with 4 additions and 1 deletions

View File

@ -7869,6 +7869,9 @@ void batch_shrink_page_cache(gfp_t mask)
void shrink_page_cache(gfp_t mask, struct page *page)
{
if (lru_gen_enabled())
return;
if (!sysctl_vm_memory_qos || !vm_pagecache_limit_global)
return;
@ -7881,7 +7884,7 @@ void shrink_page_cache(gfp_t mask, struct page *page)
long shrink_page_cache_memcg(gfp_t mask, struct mem_cgroup *memcg,
unsigned long nr_pages)
{
if (!vm_pagecache_limit_global)
if (!vm_pagecache_limit_global && !lru_gen_enabled())
return __shrink_page_cache(mask, memcg, nr_pages);
return -EINVAL;