[Devel] [PATCH vz8 1/5] ve/mm/dcache: Honor changing per-memcg s[un]reclaimable counters to bytes in dcache min threshold

Pavel Tikhomirov ptikhomirov at virtuozzo.com
Wed Aug 18 15:03:10 MSK 2021


Reviewed-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>

On 18.08.2021 14:29, Konstantin Khorenko wrote:
> RHEL8.4 has following ms commit backported:
> d42f3245c7e2 ("mm: memcg: convert vmstat slab counters to bytes")
> 
> So, update places were we use per-memcg counters NR_SLAB_[UN]RECLAIMABLE_B
> accordingly.
> 
> https://jira.sw.ru/browse/PSBM-132893
> Fixes: 04a18280021f ("ve/mm: introduce min threshold for dcache")
> 
> Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
> ---
>   fs/super.c      | 2 +-
>   mm/memcontrol.c | 6 +++++-
>   2 files changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/super.c b/fs/super.c
> index 5b807bdb58e6..a68ab7d3e1b7 100644
> --- a/fs/super.c
> +++ b/fs/super.c
> @@ -65,7 +65,7 @@ bool dcache_is_low(struct mem_cgroup *memcg)
>   
>   	anon = global_node_page_state(NR_ANON_MAPPED);
>   	file = global_node_page_state(NR_FILE_PAGES);
> -	dcache = global_node_page_state(NR_SLAB_RECLAIMABLE_B);
> +	dcache = global_node_page_state_pages(NR_SLAB_RECLAIMABLE_B);
>   
>   	return dcache / vfs_cache_min_ratio <
>   			(anon + file + dcache) / 100;
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index cd12ec265c61..a1c9cb362b74 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -1521,7 +1521,11 @@ bool mem_cgroup_dcache_is_low(struct mem_cgroup *memcg, int vfs_cache_min_ratio)
>   
>   	anon = memcg_page_state(memcg, NR_ANON_MAPPED);
>   	file = memcg_page_state(memcg, NR_FILE_PAGES);
> -	dcache = memcg_page_state(memcg, NR_SLAB_RECLAIMABLE_B);
> +	/*
> +	 * After ms commit d42f3245c7e2 ("mm: memcg: convert vmstat slab
> +	 * counters to bytes") NR_SLAB_{,UN}RECLAIMABLE_B are in bytes.
> +	 */
> +	dcache = memcg_page_state(memcg, NR_SLAB_RECLAIMABLE_B) >> PAGE_SHIFT;
>   
>   	return dcache / vfs_cache_min_ratio <
>   			(anon + file + dcache) / 100;
> 

-- 
Best regards, Tikhomirov Pavel
Software Developer, Virtuozzo.


More information about the Devel mailing list