Re: [PATCH 1/3] mm: memory-failure: make put_ref_page() more useful

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
> ---
>  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@xxxxxxxxxx>

Thanks,
Miaohe Lin






[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux