lkml.org 
[lkml]   [2022]   [Oct]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 1/3] mm: memory-failure: make put_ref_page() more useful
From
Date
On 2022/10/21 16:46, Kefeng Wang wrote:
> Pass pfn/flags to put_ref_page(), then check MF_COUNT_INCREASED
> and drop refcount to make the code look cleaner.
>
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
> ---
> mm/memory-failure.c | 34 +++++++++++++++++-----------------
> 1 file changed, 17 insertions(+), 17 deletions(-)
>
> diff --git a/mm/memory-failure.c b/mm/memory-failure.c
> index bead6bccc7f2..b94152abb1c9 100644
> --- a/mm/memory-failure.c
> +++ b/mm/memory-failure.c
> @@ -1913,17 +1913,25 @@ static inline unsigned long free_raw_hwp_pages(struct page *hpage, bool flag)
> }
> #endif /* CONFIG_HUGETLB_PAGE */
>
> +/* Drop the extra refcount in case we come from madvise() */
> +static void put_ref_page(unsigned long pfn, int flags)
> +{
> + struct page *page;
> +
> + if (!(flags & MF_COUNT_INCREASED))
> + return;
> +
> + page = pfn_to_page(pfn);
> + if (page)

IMO above check is unneeded. Page can't be NULL as pfn is valid. But this is trival and this patch looks
good to me. Thanks.

Reviewed-by: Miaohe Lin <linmiaohe@huawei.com>

Thanks,
Miaohe Lin


\
 
 \ /
  Last update: 2022-10-25 04:54    [W:0.596 / U:0.148 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site