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: <6800d1d2-4378-f851-f2bd-5b8479358234@oracle.com>
Date:   Fri, 30 Jun 2023 11:58:55 -0400
From:   Sidhartha Kumar <sidhartha.kumar@...cle.com>
To:     Peng Zhang <zhangpeng362@...wei.com>, linux-mm@...ck.org,
        linux-kernel@...r.kernel.org
Cc:     willy@...radead.org, akpm@...ux-foundation.org,
        wangkefeng.wang@...wei.com, sunnanyong@...wei.com
Subject: Re: [PATCH 2/2] mm: use a folio in fault_dirty_shared_page()

On 6/30/23 5:13 AM, Peng Zhang wrote:
> From: ZhangPeng <zhangpeng362@...wei.com>
> 
> We can replace four implicit calls to compound_head() with one by using
> folio.
> 
> Signed-off-by: ZhangPeng <zhangpeng362@...wei.com>
> ---
>   mm/memory.c | 10 +++++-----
>   1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/mm/memory.c b/mm/memory.c
> index 6921df44a99f..73b03706451c 100644
> --- a/mm/memory.c
> +++ b/mm/memory.c
> @@ -2967,20 +2967,20 @@ static vm_fault_t fault_dirty_shared_page(struct vm_fault *vmf)
>   {
>   	struct vm_area_struct *vma = vmf->vma;
>   	struct address_space *mapping;
> -	struct page *page = vmf->page;
> +	struct folio *folio = page_folio(vmf->page);
>   	bool dirtied;
>   	bool page_mkwrite = vma->vm_ops && vma->vm_ops->page_mkwrite;
>   
> -	dirtied = set_page_dirty(page);
> -	VM_BUG_ON_PAGE(PageAnon(page), page);
> +	dirtied = folio_mark_dirty(folio);
> +	VM_BUG_ON_FOLIO(folio_test_anon(folio), folio);
>   	/*
>   	 * Take a local copy of the address_space - page.mapping may be zeroed
>   	 * by truncate after unlock_page().   The address_space itself remains
>   	 * pinned by vma->vm_file's reference.  We rely on unlock_page()'s
>   	 * release semantics to prevent the compiler from undoing this copying.
>   	 */
> -	mapping = folio_raw_mapping(page_folio(page));
> -	unlock_page(page);
> +	mapping = folio_raw_mapping(folio);
> +	folio_unlock(folio);
>   
>   	if (!page_mkwrite)
>   		file_update_time(vma->vm_file);
Reviewed-by: Sidhartha Kumar <sidhartha.kumar@...cle.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ