Re: [PATCH] mm: move the easily assessable conditions forward

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

 



On Thu, 15 Aug 2024 16:31:01 +0800 Huan Yang <link@xxxxxxxx> wrote:

> Current try_to_map_unused_to_zeropage try to use shared zero page to
> save some memory of sub page.
> 
> If forbids zeropage, no need to do anything rather than attempting to
> assess wthether to use it afterwards.
> 
> ...
>
> --- a/mm/migrate.c
> +++ b/mm/migrate.c
> @@ -192,6 +192,9 @@ static bool try_to_map_unused_to_zeropage(struct page_vma_mapped_walk *pvmw,
>  	VM_BUG_ON_PAGE(!PageLocked(page), page);
>  	VM_BUG_ON_PAGE(pte_present(*pvmw->pte), page);
>  
> +	if (mm_forbids_zeropage(pvmw->vma->vm_mm))
> +		return false;
> +
>  	if (PageMlocked(page) || (pvmw->vma->vm_flags & VM_LOCKED))
>  		return false;
>  
> @@ -204,7 +207,7 @@ static bool try_to_map_unused_to_zeropage(struct page_vma_mapped_walk *pvmw,
>  	contains_data = memchr_inv(addr, 0, PAGE_SIZE);
>  	kunmap_local(addr);
>  
> -	if (contains_data || mm_forbids_zeropage(pvmw->vma->vm_mm))
> +	if (contains_data)
>  		return false;
>  

Looks sensible.  I'll add it as a fixup to "mm: remap unused subpages to shared zeropage when splitting isolated thp".




[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