linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Miaohe Lin <linmiaohe@huawei.com>
To: <akpm@linux-foundation.org>, <tony.luck@intel.com>, <bp@alien8.de>
Cc: <nao.horiguchi@gmail.com>, <linmiaohe@huawei.com>,
	<linux-mm@kvack.org>, <linux-kernel@vger.kernel.org>,
	<linux-edac@vger.kernel.org>
Subject: [PATCH v3 04/13] mm/memory-failure: save some page_folio() calls
Date: Wed, 12 Jun 2024 15:18:26 +0800	[thread overview]
Message-ID: <20240612071835.157004-5-linmiaohe@huawei.com> (raw)
In-Reply-To: <20240612071835.157004-1-linmiaohe@huawei.com>

Use local variable folio directly to save a page_folio() call. Also
use folio_mapped() to save more page_folio() calls. No functional
change intended.

Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
---
 mm/memory-failure.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index 958b17a4b0f5..470c570d779c 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -1575,7 +1575,7 @@ static bool hwpoison_user_mappings(struct folio *folio, struct page *p,
 	 * This check implies we don't kill processes if their pages
 	 * are in the swap cache early. Those are always late kills.
 	 */
-	if (!page_mapped(p))
+	if (!folio_mapped(folio))
 		return true;
 
 	if (folio_test_swapcache(folio)) {
@@ -1626,10 +1626,10 @@ static bool hwpoison_user_mappings(struct folio *folio, struct page *p,
 		try_to_unmap(folio, ttu);
 	}
 
-	unmap_success = !page_mapped(p);
+	unmap_success = !folio_mapped(folio);
 	if (!unmap_success)
 		pr_err("%#lx: failed to unmap page (folio mapcount=%d)\n",
-		       pfn, folio_mapcount(page_folio(p)));
+		       pfn, folio_mapcount(folio));
 
 	/*
 	 * try_to_unmap() might put mlocked page in lru cache, so call
-- 
2.33.0



  parent reply	other threads:[~2024-06-12  7:22 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-12  7:18 [PATCH v3 00/13] Some cleanups for memory-failure Miaohe Lin
2024-06-12  7:18 ` [PATCH v3 01/13] mm/memory-failure: simplify put_ref_page() Miaohe Lin
2024-06-12  7:18 ` [PATCH v3 02/13] mm/memory-failure: remove MF_MSG_SLAB Miaohe Lin
2024-06-12  7:18 ` [PATCH v3 03/13] mm/memory-failure: add macro GET_PAGE_MAX_RETRY_NUM Miaohe Lin
2024-06-12  7:18 ` Miaohe Lin [this message]
2024-06-12  7:18 ` [PATCH v3 05/13] mm/memory-failure: remove unneeded empty string Miaohe Lin
2024-06-12  7:18 ` [PATCH v3 06/13] mm/memory-failure: remove confusing initialization to count Miaohe Lin
2024-06-12  7:18 ` [PATCH v3 07/13] mm/memory-failure: don't export hwpoison_filter() when !CONFIG_HWPOISON_INJECT Miaohe Lin
2024-06-12  7:18 ` [PATCH v3 08/13] mm/memory-failure: use helper macro task_pid_nr() Miaohe Lin
2024-06-12  7:18 ` [PATCH v3 09/13] mm/memory-failure: remove obsolete comment in unpoison_memory() Miaohe Lin
2024-06-12  7:18 ` [PATCH v3 10/13] mm/memory-failure: move some function declarations into internal.h Miaohe Lin
2024-06-12  7:18 ` [PATCH v3 11/13] mm/memory-failure: fix comment of get_hwpoison_page() Miaohe Lin
2024-06-12  7:18 ` [PATCH v3 12/13] mm/memory-failure: remove obsolete comment in kill_proc() Miaohe Lin
2024-06-12  7:18 ` [PATCH v3 13/13] mm/memory-failure: correct comment in me_swapcache_dirty Miaohe Lin

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=20240612071835.157004-5-linmiaohe@huawei.com \
    --to=linmiaohe@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=bp@alien8.de \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=nao.horiguchi@gmail.com \
    --cc=tony.luck@intel.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