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: <45a2ab40-bc03-417e-9b9a-bb140e5f3444@huawei.com>
Date: Thu, 21 Mar 2024 17:07:58 +0800
From: Kefeng Wang <wangkefeng.wang@...wei.com>
To: Alexander Viro <viro@...iv.linux.org.uk>, Benjamin LaHaise
	<bcrl@...ck.org>, Christian Brauner <brauner@...nel.org>, Jan Kara
	<jack@...e.cz>, <linux-kernel@...r.kernel.org>, Matthew Wilcox
	<willy@...radead.org>
CC: <linux-aio@...ck.org>, <linux-fsdevel@...r.kernel.org>
Subject: Re: [PATCH 1/3] fs: aio: use a folio in aio_setup_ring()



On 2024/3/21 16:27, Kefeng Wang wrote:
> Use a folio throughout aio_setup_ring() to remove calls to compound_head().
> 
> Signed-off-by: Kefeng Wang <wangkefeng.wang@...wei.com>
> ---
>   fs/aio.c | 21 ++++++++++++---------
>   1 file changed, 12 insertions(+), 9 deletions(-)
> 
> diff --git a/fs/aio.c b/fs/aio.c
> index 9cdaa2faa536..d7f6c8705016 100644
> --- a/fs/aio.c
> +++ b/fs/aio.c
> @@ -527,17 +527,20 @@ static int aio_setup_ring(struct kioctx *ctx, unsigned int nr_events)
>   	}
>   
>   	for (i = 0; i < nr_pages; i++) {
> -		struct page *page;
> -		page = find_or_create_page(file->f_mapping,
> -					   i, GFP_USER | __GFP_ZERO);
> -		if (!page)
> +		struct folio *folio;
> +
> +		folio = __filemap_get_folio(file->f_mapping, i,
> +					    FGP_LOCK | FGP_ACCESSED | FGP_CREAT,
> +					    GFP_USER | __GFP_ZERO);
> +		if (!folio)
Oh, this should be  if (IS_ERR(folio)), will update.

>   			break;
> -		pr_debug("pid(%d) page[%d]->count=%d\n",
> -			 current->pid, i, page_count(page));
> -		SetPageUptodate(page);
> -		unlock_page(page);
>   
> -		ctx->ring_pages[i] = page;
> +		pr_debug("pid(%d) [%d] folio->count=%d\n", current->pid, i,
> +			 folio_ref_count(folio));
> +		folio_mark_uptodate(folio);
> +		folio_unlock(folio);
> +
> +		ctx->ring_pages[i] = &folio->page;
>   	}
>   	ctx->nr_pages = i;
>   

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ