lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <fdce21be-81a9-8eb4-9b06-daaab287f6f6@huawei.com>
Date:   Mon, 3 Jul 2023 17:29:31 +0800
From:   "zhangpeng (AS)" <zhangpeng362@...wei.com>
To:     Sidhartha Kumar <sidhartha.kumar@...cle.com>,
        <linux-kernel@...r.kernel.org>, <linux-mm@...ck.org>
CC:     <akpm@...ux-foundation.org>, <willy@...radead.org>
Subject: Re: [PATCH 2/4] mm/memory: convert wp_page_shared() to use folios

On 2023/7/3 13:58, Sidhartha Kumar wrote:

> Saves five implicit calls to compound_head().
>
> Signed-off-by: Sidhartha Kumar <sidhartha.kumar@...cle.com>

Reviewed-by: ZhangPeng <zhangpeng362@...wei.com>

> ---
>   mm/memory.c | 13 +++++++------
>   1 file changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/mm/memory.c b/mm/memory.c
> index 098fac2f5efc0..93480e846ace6 100644
> --- a/mm/memory.c
> +++ b/mm/memory.c
> @@ -3286,8 +3286,9 @@ static vm_fault_t wp_page_shared(struct vm_fault *vmf)
>   {
>   	struct vm_area_struct *vma = vmf->vma;
>   	vm_fault_t ret = 0;
> +	struct folio *folio = page_folio(vmf->page);
>   
> -	get_page(vmf->page);
> +	folio_get(folio);
>   
>   	if (vma->vm_ops && vma->vm_ops->page_mkwrite) {
>   		vm_fault_t tmp;
> @@ -3296,21 +3297,21 @@ static vm_fault_t wp_page_shared(struct vm_fault *vmf)
>   		tmp = do_page_mkwrite(vmf);
>   		if (unlikely(!tmp || (tmp &
>   				      (VM_FAULT_ERROR | VM_FAULT_NOPAGE)))) {
> -			put_page(vmf->page);
> +			folio_put(folio);
>   			return tmp;
>   		}
>   		tmp = finish_mkwrite_fault(vmf);
>   		if (unlikely(tmp & (VM_FAULT_ERROR | VM_FAULT_NOPAGE))) {
> -			unlock_page(vmf->page);
> -			put_page(vmf->page);
> +			folio_unlock(folio);
> +			folio_put(folio);
>   			return tmp;
>   		}
>   	} else {
>   		wp_page_reuse(vmf);
> -		lock_page(vmf->page);
> +		folio_lock(folio);
>   	}
>   	ret |= fault_dirty_shared_page(vmf);
> -	put_page(vmf->page);
> +	folio_put(folio);
>   
>   	return ret;
>   }

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ