[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YNXsid0Wg5X9/hAC@blackbook>
Date: Fri, 25 Jun 2021 16:47:37 +0200
From: Michal Koutný <mkoutny@...e.com>
To: Dan Schatzberg <schatzberg.dan@...il.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
"open list:BLOCK LAYER" <linux-block@...r.kernel.org>,
open list <linux-kernel@...r.kernel.org>,
"open list:CONTROL GROUP (CGROUP)" <cgroups@...r.kernel.org>,
"open list:MEMORY MANAGEMENT" <linux-mm@...ck.org>,
Johannes Weiner <hannes@...xchg.org>,
Tejun Heo <tj@...nel.org>, Chris Down <chris@...isdown.name>,
Jens Axboe <axboe@...nel.dk>,
Shakeel Butt <shakeelb@...gle.com>
Subject: Re: [PATCH 2/3] mm: Charge active memcg when no mm is set
On Thu, Jun 10, 2021 at 10:39:43AM -0700, Dan Schatzberg <schatzberg.dan@...il.com> wrote:
> @@ -926,8 +937,17 @@ struct mem_cgroup *get_mem_cgroup_from_mm(struct mm_struct *mm)
> * counting is disabled on the root level in the
> * cgroup core. See CSS_NO_REF.
> */
> - if (unlikely(!mm))
> - return root_mem_cgroup;
> + if (unlikely(!mm)) {
> + memcg = active_memcg();
> + if (unlikely(memcg)) {
> + /* remote memcg must hold a ref */
> + css_get(&memcg->css);
> + return memcg;
> + }
> + mm = current->mm;
> + if (unlikely(!mm))
> + return root_mem_cgroup;
> + }
With the change in __add_to_page_cache_locked() all page cache charges
will supply null mm, so the first !mm unlikely hint may not be warranted
anymore. Just an interesting point, generally, I'm adding
Reviewed-by: Michal Koutný <mkoutny@...e.com>
Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)
Powered by blists - more mailing lists