lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 27 Jun 2024 11:45:17 -0700
From: Shakeel Butt <shakeel.butt@...ux.dev>
To: Yosry Ahmed <yosryahmed@...gle.com>
Cc: Jesper Dangaard Brouer <hawk@...nel.org>, tj@...nel.org, 
	cgroups@...r.kernel.org, hannes@...xchg.org, lizefan.x@...edance.com, longman@...hat.com, 
	kernel-team@...udflare.com, linux-mm@...ck.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH V3 2/2] cgroup/rstat: Avoid thundering herd problem by
 kswapd across NUMA nodes

On Thu, Jun 27, 2024 at 04:32:03AM GMT, Yosry Ahmed wrote:
> On Thu, Jun 27, 2024 at 3:33 AM Yosry Ahmed <yosryahmed@...gle.com> wrote:
[...]
> >
> > The reason why I suggested that the completion live in struct cgroup
> > is because there is a chance here that the flush completes and another
> > irrelevant flush starts between reading cgrp_rstat_ongoing_flusher and
> > calling wait_for_completion_interruptible_timeout().

Yes this can happen if flusher for irrelevant cgroup calls
reinit_completion() while the initial flusher was just about to call
wait_for_completion_interruptible_timeout().

> >
> > This will cause the caller to wait for an irrelevant flush, which may
> > be fine because today the caller would wait for the lock anyway. Just
> > mentioning this in case you think this may happen enough to be a
> > problem.
> 
> Actually, I think this can happen beyond the window I described above.
> I think it's possible that a thread waits for the flush, then gets
> woken up when complete_all() is called, but another flusher calls
> reinit_completion() immediately. The woken up thread will observe
> completion->done == 0 and go to sleep again.

I don't think it will go to sleep again as there is no retry.

> 
> I think most of these cases can be avoided if we make the completion
> per cgroup. It is still possible to wait for more flushes than
> necessary, but only if they are for the same cgroup.

Yeah, per-cgroup completion would avoid the problem of waiting for
irrelevant flush.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ