From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michal Hocko Subject: Re: [PATCH 3/3] mm: memcg: use non-unified stats flushing for userspace reads Date: Tue, 29 Aug 2023 17:17:24 +0200 Message-ID: References: <599b167c-deaf-4b92-aa8b-5767b8608483@redhat.com> <5906501e-4dff-4c66-7ab3-e9193d312270@redhat.com> Mime-Version: 1.0 Return-path: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1693322244; 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=BOigw10DFMaZ6FlTz/kuzcWWW1zJctEYt2mbUACfshw=; b=cf6cfut5qMHHLRMDbwkQ2gYlsH8BstjRGecp7d4wrj6kl1juJGA88uZVLY/nIkvn4joG6o yc1WtUrbFGH37RngP2icfs7mhlOiLLHfvX3nXod/VcciRd/wn+9pFBlSTbq9Qw6JFxynhg vLQnqh8YI4Amh1yo0orGgcpcoRZ6h+E= Content-Disposition: inline In-Reply-To: <5906501e-4dff-4c66-7ab3-e9193d312270@redhat.com> List-ID: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Waiman Long Cc: Yosry Ahmed , Shakeel Butt , Andrew Morton , Johannes Weiner , Roman Gushchin , Muchun Song , Ivan Babrou , Tejun Heo , linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org On Tue 29-08-23 11:05:28, Waiman Long wrote: > On 8/29/23 03:27, Michal Hocko wrote: > > On Mon 28-08-23 13:27:23, Waiman Long wrote: > > > On 8/28/23 13:07, Yosry Ahmed wrote: > > > > > Here I agree with you. Let's go with the approach which is easy to > > > > > undo for now. Though I prefer the new explicit interface for flushing, > > > > > that step would be very hard to undo. Let's reevaluate if the proposed > > > > > approach shows negative impact on production traffic and I think > > > > > Cloudflare folks can give us the results soon. > > > > Do you prefer we also switch to using a mutex (with preemption > > > > disabled) to avoid the scenario Michal described where flushers give > > > > up the lock and sleep resulting in an unbounded wait time in the worst > > > > case? > > > Locking with mutex with preemption disabled is an oxymoron. > > I believe Yosry wanted to disable preemption _after_ the lock is taken > > to reduce the time spent while it is held. The idea to use the mutex is > > to reduce spinning and more importantly to get rid of lock dropping > > part. It is not really clear (but unlikely) we can drop it while > > preserving the spinlock as the thing scales with O(#cgroups x #cpus) > > in the worst case. > > As I have said later in my email, I am not against disabling preemption > selectively on some parts of the lock critical section where preemption is > undesirable. However, I am against disabling preemption for the whole > duration of the code where the mutex lock is held as it defeats the purpose > of using mutex in the first place. I certainly agree this is an antipattern. -- Michal Hocko SUSE Labs