[Devel] [PATCH rh7 v2 05/10] mm/mem_cgroup_iter: NULL-ify 'last_visited' for invalidated iterators

Kirill Tkhai ktkhai at virtuozzo.com
Wed Feb 24 14:10:22 MSK 2021


On 24.02.2021 13:48, Konstantin Khorenko wrote:
> Our target is to invalidate only those iterators which have our
> dying memcg as 'last_visited' and put NULL there instead.
> 
> As the first step let's put NULL to all iterators'
> 'last_visited' we are invalidating.
> 
> https://jira.sw.ru/browse/PSBM-123655
> 
> Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
> ---
>  mm/memcontrol.c | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index 2f1dfb0de524..c56d68d12c24 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -1567,6 +1567,22 @@ static struct mem_cgroup *__mem_cgroup_iter_next(struct mem_cgroup *root,
>  
>  static void mem_cgroup_iter_invalidate(struct mem_cgroup *root)
>  {
> +	struct mem_cgroup_reclaim_iter *iter;
> +	struct mem_cgroup_per_zone *mz;
> +	int zone, node, i;
> +
> +	for_each_node(node) {
> +		for (zone = 0; zone < MAX_NR_ZONES; zone++) {
> +			mz = mem_cgroup_zoneinfo(root, node, zone);
> +
> +			for (i = 0; i < ARRAY_SIZE(mz->reclaim_iter); i++) {
> +				iter = &mz->reclaim_iter[i];
> +				rcu_assign_pointer(iter->last_visited, NULL);
> +				}

What is this bracket for?

> +			}
> +		}
> +	}
> +
>  	/*
>  	 * When a group in the hierarchy below root is destroyed, the
>  	 * hierarchy iterator can no longer be trusted since it might
> 



More information about the Devel mailing list