From: Shakeel Butt <shakeel.butt@linux.dev>
To: Yosry Ahmed <yosryahmed@google.com>
Cc: Jesper Dangaard Brouer <hawk@kernel.org>,
tj@kernel.org, cgroups@vger.kernel.org, hannes@cmpxchg.org,
lizefan.x@bytedance.com, longman@redhat.com,
kernel-team@cloudflare.com, linux-mm@kvack.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH V3 2/2] cgroup/rstat: Avoid thundering herd problem by kswapd across NUMA nodes
Date: Thu, 27 Jun 2024 11:45:17 -0700 [thread overview]
Message-ID: <f4hbugpz5fudmiooxe73dbcbmi4stufm3msu4j37atv2feqhc6@ywai42srcwto> (raw)
In-Reply-To: <CAJD7tkYFKTA7aLcBE=X0jA1vKG_V+6Z-HstJRnnNrvMnjnLzHw@mail.gmail.com>
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@google.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.
next prev parent reply other threads:[~2024-06-27 18:45 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-26 21:18 [PATCH V3 1/2] cgroup/rstat: Helper functions for locking expose trylock Jesper Dangaard Brouer
2024-06-26 21:18 ` [PATCH V3 2/2] cgroup/rstat: Avoid thundering herd problem by kswapd across NUMA nodes Jesper Dangaard Brouer
2024-06-27 10:33 ` Yosry Ahmed
2024-06-27 11:32 ` Yosry Ahmed
2024-06-27 18:45 ` Shakeel Butt [this message]
2024-06-27 19:18 ` Jesper Dangaard Brouer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f4hbugpz5fudmiooxe73dbcbmi4stufm3msu4j37atv2feqhc6@ywai42srcwto \
--to=shakeel.butt@linux.dev \
--cc=cgroups@vger.kernel.org \
--cc=hannes@cmpxchg.org \
--cc=hawk@kernel.org \
--cc=kernel-team@cloudflare.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lizefan.x@bytedance.com \
--cc=longman@redhat.com \
--cc=tj@kernel.org \
--cc=yosryahmed@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox