[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <96b39919-7054-7378-a6ab-a20401458d7c@huawei.com>
Date: Tue, 25 Oct 2022 10:52:58 +0800
From: Miaohe Lin <linmiaohe@...wei.com>
To: Kefeng Wang <wangkefeng.wang@...wei.com>
CC: <linux-mm@...ck.org>, <linux-kernel@...r.kernel.org>,
Naoya Horiguchi <naoya.horiguchi@....com>,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH 1/3] mm: memory-failure: make put_ref_page() more useful
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@...wei.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@...wei.com>
Thanks,
Miaohe Lin
Powered by blists - more mailing lists