linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Shengken Lin <shengken.lin@amlogic.com>
To: <akpm@linux-foundation.org>
Cc: <linux-mm@kvack.org>, <linux-kernel@vger.kernel.org>,
	Shengken Lin <shengken.lin@amlogic.com>
Subject: [PATCH] mm: Remove redundant PageMemcgKmem(page) call
Date: Wed, 12 Feb 2025 10:06:27 +0800	[thread overview]
Message-ID: <20250212020627.3461237-1-shengken.lin@amlogic.com> (raw)

The function of PageMemcgKmem(page) is the same as that of
folio_memcg_kmem(folio).

Since __memcg_kmem_uncharge_page already uses folio_memcg_kmem to check
if a folio has been uncharged, calling PageMemcgKmem(page) before
__memcg_kmem_uncharge_page is redundant.

Signed-off-by: Shengken Lin <shengken.lin@amlogic.com>
---
 mm/page_alloc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 579789600a3c..5a76760de495 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -1055,7 +1055,7 @@ __always_inline bool free_pages_prepare(struct page *page,
 	trace_mm_page_free(page, order);
 	kmsan_free_page(page, order);

-	if (memcg_kmem_online() && PageMemcgKmem(page))
+	if (memcg_kmem_online())
 		__memcg_kmem_uncharge_page(page, order);

 	/*
--
2.34.1



             reply	other threads:[~2025-02-12  2:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-12  2:06 Shengken Lin [this message]
2025-02-12  4:28 ` Matthew Wilcox
2025-02-20  9:47   ` Shengken.Lin
2025-02-20 13:22     ` Matthew Wilcox

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=20250212020627.3461237-1-shengken.lin@amlogic.com \
    --to=shengken.lin@amlogic.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.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