[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231202080717.ykhhu7fvryarphmi@google.com>
Date: Sat, 2 Dec 2023 08:07:17 +0000
From: Shakeel Butt <shakeelb@...gle.com>
To: Yosry Ahmed <yosryahmed@...gle.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Johannes Weiner <hannes@...xchg.org>,
Michal Hocko <mhocko@...nel.org>,
Roman Gushchin <roman.gushchin@...ux.dev>,
Muchun Song <muchun.song@...ux.dev>,
Ivan Babrou <ivan@...udflare.com>, Tejun Heo <tj@...nel.org>,
"Michal Koutný" <mkoutny@...e.com>,
Waiman Long <longman@...hat.com>, kernel-team@...udflare.com,
Wei Xu <weixugc@...gle.com>, Greg Thelen <gthelen@...gle.com>,
Domenico Cerasuolo <cerasuolodomenico@...il.com>,
linux-mm@...ck.org, cgroups@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [mm-unstable v4 4/5] mm: workingset: move the stats flush into workingset_test_recent()
On Wed, Nov 29, 2023 at 03:21:52AM +0000, Yosry Ahmed wrote:
> The workingset code flushes the stats in workingset_refault() to get
> accurate stats of the eviction memcg. In preparation for more scoped
> flushed and passing the eviction memcg to the flush call, move the call
> to workingset_test_recent() where we have a pointer to the eviction
> memcg.
>
> The flush call is sleepable, and cannot be made in an rcu read section.
> Hence, minimize the rcu read section by also moving it into
> workingset_test_recent(). Furthermore, instead of holding the rcu read
> lock throughout workingset_test_recent(), only hold it briefly to get a
> ref on the eviction memcg. This allows us to make the flush call after
> we get the eviction memcg.
>
> As for workingset_refault(), nothing else there appears to be protected
> by rcu. The memcg of the faulted folio (which is not necessarily the
> same as the eviction memcg) is protected by the folio lock, which is
> held from all callsites. Add a VM_BUG_ON() to make sure this doesn't
> change from under us.
>
> No functional change intended.
>
> Signed-off-by: Yosry Ahmed <yosryahmed@...gle.com>
> Tested-by: Domenico Cerasuolo <cerasuolodomenico@...il.com>
Acked-by: Shakeel Butt <shakeelb@...gle.com>
Powered by blists - more mailing lists