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: <d1560177-b7ec-45f0-beb2-62bd5fe7d3a6@pankajraghav.com>
Date: Mon, 11 Aug 2025 11:35:24 +0200
From: Pankaj Raghav <kernel@...kajraghav.com>
To: Jens Axboe <axboe@...nel.dk>, hch@....de
Cc: linux-kernel@...r.kernel.org, "Liam R . Howlett"
 <Liam.Howlett@...cle.com>, Nico Pache <npache@...hat.com>,
 Thomas Gleixner <tglx@...utronix.de>,
 Lorenzo Stoakes <lorenzo.stoakes@...cle.com>,
 David Hildenbrand <david@...hat.com>, Michal Hocko <mhocko@...e.com>,
 Dave Hansen <dave.hansen@...ux.intel.com>, Mike Rapoport <rppt@...nel.org>,
 Zi Yan <ziy@...dia.com>, Vlastimil Babka <vbabka@...e.cz>,
 Ryan Roberts <ryan.roberts@....com>, Dev Jain <dev.jain@....com>,
 Suren Baghdasaryan <surenb@...gle.com>,
 Andrew Morton <akpm@...ux-foundation.org>, linux-mm@...ck.org,
 willy@...radead.org, Ritesh Harjani <ritesh.list@...il.com>,
 linux-block@...r.kernel.org, linux-fsdevel@...r.kernel.org,
 "Darrick J . Wong" <djwong@...nel.org>, mcgrof@...nel.org,
 gost.dev@...sung.com, Pankaj Raghav <p.raghav@...sung.com>,
 Baolin Wang <baolin.wang@...ux.alibaba.com>
Subject: Re: [PATCH v3 5/5] block: use largest_zero_folio in
 __blkdev_issue_zero_pages()

On 8/11/25 10:41, Pankaj Raghav (Samsung) wrote:
> From: Pankaj Raghav <p.raghav@...sung.com>
> 
> Use largest_zero_folio() in __blkdev_issue_zero_pages().
> On systems with CONFIG_PERSISTENT_HUGE_ZERO_FOLIO enabled, we will end up
> sending larger bvecs instead of multiple small ones.
> 
> Noticed a 4% increase in performance on a commercial NVMe SSD which does
> not support OP_WRITE_ZEROES. The device's MDTS was 128K. The performance
> gains might be bigger if the device supports bigger MDTS.
> 
> Acked-by: Lorenzo Stoakes <lorenzo.stoakes@...cle.com>
> Signed-off-by: Pankaj Raghav <p.raghav@...sung.com>
> ---
>  block/blk-lib.c | 15 ++++++++-------
>  1 file changed, 8 insertions(+), 7 deletions(-)
> 

@Jens and @Christoph, is it possible to take a quick look of this patch when you have the time?

I already made the changes that Christoph mentioned before, so I think it should
be good to go.

@Christoph, I will send the follow up patches to iomap direct io code once we get these changes
merged.

> diff --git a/block/blk-lib.c b/block/blk-lib.c
> index 4c9f20a689f7..3030a772d3aa 100644
> --- a/block/blk-lib.c
> +++ b/block/blk-lib.c
> @@ -196,6 +196,8 @@ static void __blkdev_issue_zero_pages(struct block_device *bdev,
>  		sector_t sector, sector_t nr_sects, gfp_t gfp_mask,
>  		struct bio **biop, unsigned int flags)
>  {
> +	struct folio *zero_folio = largest_zero_folio();
> +
>  	while (nr_sects) {
>  		unsigned int nr_vecs = __blkdev_sectors_to_bio_pages(nr_sects);
>  		struct bio *bio;
> @@ -208,15 +210,14 @@ static void __blkdev_issue_zero_pages(struct block_device *bdev,
>  			break;
>  
>  		do {
> -			unsigned int len, added;
> +			unsigned int len;
>  
> -			len = min_t(sector_t,
> -				PAGE_SIZE, nr_sects << SECTOR_SHIFT);
> -			added = bio_add_page(bio, ZERO_PAGE(0), len, 0);
> -			if (added < len)
> +			len = min_t(sector_t, folio_size(zero_folio),
> +				    nr_sects << SECTOR_SHIFT);
> +			if (!bio_add_folio(bio, zero_folio, len, 0))
>  				break;
> -			nr_sects -= added >> SECTOR_SHIFT;
> -			sector += added >> SECTOR_SHIFT;
> +			nr_sects -= len >> SECTOR_SHIFT;
> +			sector += len >> SECTOR_SHIFT;
>  		} while (nr_sects);
>  
>  		*biop = bio_chain_and_submit(*biop, bio);


--
Pankaj

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ