From: Michal Hocko Subject: Re: [PATCH v2 0/5] Introduce memcg_stock_pcp remote draining Date: Wed, 1 Feb 2023 13:41:16 +0100 Message-ID: References: <20230125073502.743446-1-leobras@redhat.com> <9e61ab53e1419a144f774b95230b789244895424.camel@redhat.com> <0122005439ffb7895efda7a1a67992cbe41392fe.camel@redhat.com> Mime-Version: 1.0 Return-path: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1675255277; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=pgarzvo5Cio7GL8GEMMFzzwnzoa+QoIct7DEsSsHtqA=; b=MWzo9/68aPfyUUKt0sBZONEVCQnB5Rnc7js3asZl1hGklDyD/kUD3l3yb52I05gyiwCGwJ FkltqazCB0qBi1IKYo4fWm7hphLeefGDPXjfrTgp8Qe/444/6AfB68SNhBTUfZhen1TiXu 2Go0U87UliFst4DLvBn7AcwTkPETxhg= Content-Disposition: inline In-Reply-To: List-ID: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Marcelo Tosatti Cc: Leonardo =?iso-8859-1?Q?Br=E1s?= , Johannes Weiner , Roman Gushchin , Shakeel Butt , Muchun Song , Andrew Morton , cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org On Tue 31-01-23 08:35:34, Marcelo Tosatti wrote: [...] > So it would be good to point out a specific problematic > testcase/scenario with using the spinlock in this particular case? Please think about it some more. The sole purpose of the pcp charge caching is to avoid atomics because the normal fast path (i.e. no limit hit) is a page counter which is an atomic counter. If you go with a spin lock for the pcp cache you are just losing some of the advantage of the caching. Sure that would be a smaller atomics use than a deeper memcg hierarchy but still. Not to mention a potential contention which is hard to predict and it will depend on the specific runtime very much. So not something that would be easy to test for other than artificial testcases. Full cpu pcp draining is not a very common operation and one could argue that the problem will be limited but so far I haven't really heard any strong arguments against the proposal to avoid scheduling the work on isolated cpus which is a much more simpler solution and achieves the same effect. -- Michal Hocko SUSE Labs