linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Yosry Ahmed <yosryahmed@google.com>
To: Shakeel Butt <shakeelb@google.com>
Cc: Brendan Jackman <jackmanb@google.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	 Johannes Weiner <hannes@cmpxchg.org>,
	Michal Hocko <mhocko@kernel.org>,
	 Muchun Song <muchun.song@linux.dev>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH v2] mm/page_alloc: Dedupe some memcg uncharging logic
Date: Wed, 8 Nov 2023 16:07:21 -0800	[thread overview]
Message-ID: <CAJD7tkYJJOq5cZCaymbTT_PdGrQOb6iGUvrtaPK9FAFXYFduUg@mail.gmail.com> (raw)
In-Reply-To: <CALvZod4Uj9rR3OL7CYfq5t8gsRLAa7b2wa3m26nyDhfvQaWQ+g@mail.gmail.com>

On Wed, Nov 8, 2023 at 3:52 PM Shakeel Butt <shakeelb@google.com> wrote:
>
> On Wed, Nov 8, 2023 at 8:49 AM Brendan Jackman <jackmanb@google.com> wrote:
> >
> > The duplication makes it seem like some work is required before
> > uncharging in the !PageHWPoison case. But it isn't, so we can simplify
> > the code a little.
> >
> > Note the PageMemcgKmem check is redundant, but I've left it in as it
> > avoids an unnecessary function call.
> >
> > Signed-off-by: Brendan Jackman <jackmanb@google.com>
>
> Thanks for the patch. Actually the PageMemcgKmem/folio_memcg_kmem
> check should be in memcg_kmem_uncharge_page() and not in
> __memcg_kmem_uncharge_page(). Anyways, that is orthogonal to this
> patch.

Agreed. If we move the check into memcg_kmem_uncharge_page(), perhaps
we should call it directly here instead of doing the checks, since
there won't be an extra function call as it is inline, right? We can
also make __memcg_kmem_uncharge_page static to mm/memcontrol.c

I suspect the same can be done for __memcg_kmem_charge_page() as well.


      reply	other threads:[~2023-11-09  0:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-08 16:49 Brendan Jackman
2023-11-08 20:19 ` Yosry Ahmed
2023-11-08 23:51 ` Shakeel Butt
2023-11-09  0:07   ` Yosry Ahmed [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=CAJD7tkYJJOq5cZCaymbTT_PdGrQOb6iGUvrtaPK9FAFXYFduUg@mail.gmail.com \
    --to=yosryahmed@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=jackmanb@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --cc=muchun.song@linux.dev \
    --cc=shakeelb@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