Re: [PATCH v2 01/13] mm/memory-failure: simplify put_ref_page()

From: Kefeng Wang
Date: Thu Jun 06 2024 - 02:46:16 EST




On 2024/6/6 14:32, Miaohe Lin wrote:
Remove unneeded page != NULL check. pfn_to_page() won't return NULL.
No functional change intended.

Signed-off-by: Miaohe Lin <linmiaohe@xxxxxxxxxx>
---
mm/memory-failure.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index f679b579d45d..2e6038c73119 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -2120,14 +2120,10 @@ static inline unsigned long folio_free_raw_hwp(struct folio *folio, bool flag)
/* Drop the extra refcount in case we come from madvise() */
static void put_ref_page(unsigned long pfn, int flags)

Since all calllers have a valid page,better to pass the page instead of pfn?

{
- struct page *page;
-
if (!(flags & MF_COUNT_INCREASED))
return;
- page = pfn_to_page(pfn);
- if (page)
- put_page(page);
+ put_page(pfn_to_page(pfn));
}
static int memory_failure_dev_pagemap(unsigned long pfn, int flags,