linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Yosry Ahmed <yosryahmed@google.com>
To: Ivan Babrou <ivan@cloudflare.com>
Cc: Tejun Heo <tj@kernel.org>, Waiman Long <longman@redhat.com>,
	 Shakeel Butt <shakeelb@google.com>,
	cgroups@vger.kernel.org,  Linux MM <linux-mm@kvack.org>,
	kernel-team <kernel-team@cloudflare.com>,
	 Johannes Weiner <hannes@cmpxchg.org>,
	Michal Hocko <mhocko@kernel.org>,
	 Roman Gushchin <roman.gushchin@linux.dev>,
	Muchun Song <muchun.song@linux.dev>,
	 Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: Expensive memory.stat + cpu.stat reads
Date: Mon, 14 Aug 2023 17:31:12 -0700	[thread overview]
Message-ID: <CAJD7tkbzznhwkYacA75Se2Wi2pfXSkH77B_wgGC9r90ua7N76Q@mail.gmail.com> (raw)
In-Reply-To: <CABWYdi3z7Y4qdjPv4wiHyM6Wvwy_VwSLGA92=_PdYyVZgQDSYQ@mail.gmail.com>

On Mon, Aug 14, 2023 at 5:30 PM Ivan Babrou <ivan@cloudflare.com> wrote:
>
> On Mon, Aug 14, 2023 at 5:18 PM Tejun Heo <tj@kernel.org> wrote:
> >
> > Hello,
> >
> > On Fri, Aug 11, 2023 at 05:01:08PM -0700, Yosry Ahmed wrote:
> > > There have been a lot of problems coming from this global rstat lock:
> > > hard lockups (when we used to flush atomically), unified flushing
> > > being expensive, skipping flushing being inaccurate, etc.
> > >
> > > I wonder if it's time to rethink this lock and break it down into
> > > granular locks. Perhaps a per-cgroup lock, and develop a locking
> > > scheme where you always lock a parent then a child, then flush the
> > > child and unlock it and move to the next child, etc. This will allow
> > > concurrent flushing of non-root cgroups. Even when flushing the root,
> > > if we flush all its children first without locking the root, then only
> > > lock the root when flushing the top-level children, then some level of
> > > concurrency can be achieved.
> > >
> > > Maybe this is too complicated, I never tried to implement it, but I
> > > have been bouncing around this idea in my head for a while now.
> > >
> > > We can also split the update tree per controller. As far as I can tell
> > > there is no reason to flush cpu stats for example when someone wants
> > > to read memory stats.
> >
> > There's another thread. Let's continue there but I'm a bit skeptical whether
> > splitting the lock is a good solution here. Regardless of locking, we don't
> > want to run in an atomic context for that long anwyay.
>
> Could you link to the other thread?

I supposedly CC'd you there, but I realized it didn't work for some reason:
https://lore.kernel.org/lkml/CAJD7tkYBFz-gZ2QsHxUMT=t0KNXs66S-zzMPebadHx9zaG0Q3w@mail.gmail.com/


  reply	other threads:[~2023-08-15  0:31 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-30 23:22 Ivan Babrou
2023-07-06  6:20 ` Shakeel Butt
2023-07-10 23:21   ` Ivan Babrou
2023-07-11  0:44     ` Waiman Long
2023-07-13 23:25       ` Ivan Babrou
2023-07-14 17:23         ` Waiman Long
2023-07-15  0:00           ` Ivan Babrou
2023-07-15  0:30         ` Ivan Babrou
2023-08-11 22:03           ` Ivan Babrou
2023-08-11 22:27             ` Waiman Long
2023-08-11 22:35               ` Ivan Babrou
2023-08-12  2:33                 ` Shakeel Butt
2023-08-14 17:56                   ` Ivan Babrou
2023-08-11 23:43             ` Yosry Ahmed
2023-08-12  0:01               ` Yosry Ahmed
2023-08-15  0:18                 ` Tejun Heo
2023-08-15  0:30                   ` Ivan Babrou
2023-08-15  0:31                     ` Yosry Ahmed [this message]
2023-07-15  0:14     ` Ivan Babrou
2023-07-10 14:44 ` Michal Koutný
2023-07-10 23:23   ` Ivan Babrou

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=CAJD7tkbzznhwkYacA75Se2Wi2pfXSkH77B_wgGC9r90ua7N76Q@mail.gmail.com \
    --to=yosryahmed@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=cgroups@vger.kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=ivan@cloudflare.com \
    --cc=kernel-team@cloudflare.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=longman@redhat.com \
    --cc=mhocko@kernel.org \
    --cc=muchun.song@linux.dev \
    --cc=roman.gushchin@linux.dev \
    --cc=shakeelb@google.com \
    --cc=tj@kernel.org \
    /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