All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tim Chen <tim.c.chen@linux.intel.com>
To: Yosry Ahmed <yosryahmed@google.com>,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	Christian Brauner <brauner@kernel.org>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Michal Hocko <mhocko@kernel.org>,
	Roman Gushchin <roman.gushchin@linux.dev>,
	Shakeel Butt <shakeelb@google.com>,
	Muchun Song <songmuchun@bytedance.com>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	cgroups@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH mm-unstable RFC 0/5] cgroup: eliminate atomic rstat
Date: Thu, 06 Apr 2023 11:23:47 -0700	[thread overview]
Message-ID: <f26eed88dddcf6c8d2a127f4cdc6aaf740bbfb7d.camel@linux.intel.com> (raw)
In-Reply-To: <20230403220337.443510-1-yosryahmed@google.com>

On Mon, 2023-04-03 at 22:03 +0000, Yosry Ahmed wrote:
> A previous patch series ([1] currently in mm-unstable) changed most

Can you include the link to [1]?

Thanks.

Tim

> atomic rstat flushing contexts to become non-atomic. This was done to
> avoid an expensive operation that scales with # cgroups and # cpus to
> happen with irqs disabled and scheduling not permitted. There were two
> remaining atomic flushing contexts after that series. This series tries
> to eliminate them as well, eliminating atomic rstat flushing completely.
> 
> The two remaining atomic flushing contexts are:
> (a) wb_over_bg_thresh()->mem_cgroup_wb_stats()
> (b) mem_cgroup_threshold()->mem_cgroup_usage()
> 
> For (a), flushing needs to be atomic as wb_writeback() calls
> wb_over_bg_thresh() with a spinlock held. However, it seems like the
> call to wb_over_bg_thresh() doesn't need to be protected by that
> spinlock, so this series proposes a refactoring that moves the call
> outside the lock criticial section and makes the stats flushing
> in mem_cgroup_wb_stats() non-atomic.
> 
> For (b), flushing needs to be atomic as mem_cgroup_threshold() is called
> with irqs disabled. We only flush the stats when calculating the root
> usage, as it is approximated as the sum of some memcg stats (file, anon,
> and optionally swap) instead of the conventional page counter. This
> series proposes changing this calculation to use the global stats
> instead, eliminating the need for a memcg stat flush.
> 
> After these 2 contexts are eliminated, we no longer need
> mem_cgroup_flush_stats_atomic() or cgroup_rstat_flush_atomic(). We can
> remove them and simplify the code.
> 
> Yosry Ahmed (5):
>   writeback: move wb_over_bg_thresh() call outside lock section
>   memcg: flush stats non-atomically in mem_cgroup_wb_stats()
>   memcg: calculate root usage from global state
>   memcg: remove mem_cgroup_flush_stats_atomic()
>   cgroup: remove cgroup_rstat_flush_atomic()
> 
>  fs/fs-writeback.c          | 16 +++++++----
>  include/linux/cgroup.h     |  1 -
>  include/linux/memcontrol.h |  5 ----
>  kernel/cgroup/rstat.c      | 26 ++++--------------
>  mm/memcontrol.c            | 54 ++++++++------------------------------
>  5 files changed, 27 insertions(+), 75 deletions(-)
> 


      parent reply	other threads:[~2023-04-06 18:23 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-03 22:03 [PATCH mm-unstable RFC 0/5] cgroup: eliminate atomic rstat Yosry Ahmed
2023-04-03 22:03 ` Yosry Ahmed
2023-04-03 22:03 ` [PATCH mm-unstable RFC 2/5] memcg: flush stats non-atomically in mem_cgroup_wb_stats() Yosry Ahmed
2023-04-19 11:44   ` Michal Koutný
     [not found]   ` <20230403220337.443510-3-yosryahmed-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2023-04-20 18:55     ` Shakeel Butt
2023-04-20 18:55       ` Shakeel Butt
2023-04-03 22:03 ` [PATCH mm-unstable RFC 3/5] memcg: calculate root usage from global state Yosry Ahmed
2023-04-11 12:53   ` Michal Koutný
2023-04-11 16:59     ` Yosry Ahmed
2023-04-11 16:59       ` Yosry Ahmed
     [not found]   ` <20230403220337.443510-4-yosryahmed-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2023-04-20 18:57     ` Shakeel Butt
2023-04-20 18:57       ` Shakeel Butt
     [not found] ` <20230403220337.443510-1-yosryahmed-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2023-04-03 22:03   ` [PATCH mm-unstable RFC 1/5] writeback: move wb_over_bg_thresh() call outside lock section Yosry Ahmed
2023-04-03 22:03     ` Yosry Ahmed
     [not found]     ` <20230403220337.443510-2-yosryahmed-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2023-04-19 11:38       ` Michal Koutný
2023-04-19 11:38         ` Michal Koutný
2023-04-20 20:23         ` Yosry Ahmed
2023-04-20 20:23           ` Yosry Ahmed
2023-04-20 18:53       ` Shakeel Butt
2023-04-20 18:53         ` Shakeel Butt
     [not found]         ` <CALvZod5h5G9YNu8d9fAOL5eXie5iM3urw9QgD=vucBdCMAQnxA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2023-04-20 20:22           ` Yosry Ahmed
2023-04-20 20:22             ` Yosry Ahmed
2023-04-21  8:53       ` Jan Kara
2023-04-21  8:53         ` Jan Kara
2023-04-21 17:21         ` Yosry Ahmed
2023-04-21 17:21           ` Yosry Ahmed
2023-04-03 22:03   ` [PATCH mm-unstable RFC 4/5] memcg: remove mem_cgroup_flush_stats_atomic() Yosry Ahmed
2023-04-03 22:03     ` Yosry Ahmed
2023-04-20 19:38     ` Shakeel Butt
2023-04-20 19:38       ` Shakeel Butt
2023-04-03 22:03   ` [PATCH mm-unstable RFC 5/5] cgroup: remove cgroup_rstat_flush_atomic() Yosry Ahmed
2023-04-03 22:03     ` Yosry Ahmed
2023-04-20 19:40     ` Shakeel Butt
2023-04-20 19:40       ` Shakeel Butt
     [not found]       ` <CALvZod79Au=Fw9MTW7fP0P7KwQQ_NUiKgRHsNUFnv9v61pKnZA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2023-04-20 19:48         ` Tejun Heo
2023-04-20 19:48           ` Tejun Heo
2023-04-20 20:19           ` Yosry Ahmed
2023-04-03 22:04   ` [PATCH mm-unstable RFC 0/5] cgroup: eliminate atomic rstat Yosry Ahmed
2023-04-03 22:04     ` Yosry Ahmed
     [not found]     ` <CAJD7tkZ5vh5ssDux1LStX9ZivmGmXsFyxfADGJD5AXDaMnGWRQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2023-04-06 18:26       ` Tim Chen
2023-04-06 18:26         ` Tim Chen
2023-04-17 11:54   ` Yosry Ahmed
2023-04-17 11:54     ` Yosry Ahmed
2023-04-06 18:23 ` Tim Chen [this message]

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=f26eed88dddcf6c8d2a127f4cdc6aaf740bbfb7d.camel@linux.intel.com \
    --to=tim.c.chen@linux.intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=brauner@kernel.org \
    --cc=cgroups@vger.kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --cc=roman.gushchin@linux.dev \
    --cc=shakeelb@google.com \
    --cc=songmuchun@bytedance.com \
    --cc=viro@zeniv.linux.org.uk \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.