mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Pankaj Raghav (Samsung)" <kernel@pankajraghav.com>
To: Brian Foster <bfoster@redhat.com>,
	Kent Overstreet <kent.overstreet@linux.dev>
Cc: gost.dev@samsung.com, linux-bcachefs@vger.kernel.org,
	willy@infradead.org, mcgrof@kernel.org,
	linux-kernel@vger.kernel.org,
	Pankaj Raghav <p.raghav@samsung.com>
Subject: [PATCH v2 2/2] bcachefs: set fgf order hint before starting a buffered write
Date: Fri, 14 Jun 2024 16:30:58 +0000	[thread overview]
Message-ID: <20240614163058.74882-3-kernel@pankajraghav.com> (raw)
In-Reply-To: <20240614163058.74882-1-kernel@pankajraghav.com>

From: Pankaj Raghav <p.raghav@samsung.com>

Set the preferred folio order in the fgp_flags by calling
fgf_set_order(). Page cache will try to allocate large folio of the
preferred order whenever possible instead of allocating multiple 0 order
folios.

This improves the buffered write performance up to 1.25x with default
mount options and up to 1.57x when mounted with no_data_io option with
the following fio workload:

fio --name=bcachefs --filename=/mnt/test  --size=100G \
     --ioengine=io_uring --iodepth=16 --rw=write --bs=128k

Signed-off-by: Pankaj Raghav <p.raghav@samsung.com>
---
 fs/bcachefs/fs-io-buffered.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/bcachefs/fs-io-buffered.c b/fs/bcachefs/fs-io-buffered.c
index 3c9a5a8edd1e..d478703d219f 100644
--- a/fs/bcachefs/fs-io-buffered.c
+++ b/fs/bcachefs/fs-io-buffered.c
@@ -678,7 +678,7 @@ int bch2_write_begin(struct file *file, struct address_space *mapping,
 	bch2_pagecache_add_get(inode);
 
 	folio = __filemap_get_folio(mapping, pos >> PAGE_SHIFT,
-				FGP_WRITEBEGIN,
+				FGP_WRITEBEGIN | fgf_set_order(len),
 				mapping_gfp_mask(mapping));
 	if (IS_ERR_OR_NULL(folio))
 		goto err_unlock;
@@ -820,7 +820,7 @@ static int __bch2_buffered_write(struct bch_inode_info *inode,
 	darray_init(&fs);
 
 	ret = bch2_filemap_get_contig_folios_d(mapping, pos, end,
-				   FGP_WRITEBEGIN,
+				   FGP_WRITEBEGIN | fgf_set_order(len),
 				   mapping_gfp_mask(mapping),
 				   &fs);
 	if (ret)
-- 
2.44.1


      parent reply	other threads:[~2024-06-14 16:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-14 16:30 [PATCH v2 0/2] improve buffered write performance with fgf order hint Pankaj Raghav (Samsung)
2024-06-14 16:30 ` [PATCH v2 1/2] bcachefs: use FGP_WRITEBEGIN instead of combining individual flags Pankaj Raghav (Samsung)
2024-06-14 16:30 ` Pankaj Raghav (Samsung) [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240614163058.74882-3-kernel@pankajraghav.com \
    --to=kernel@pankajraghav.com \
    --cc=bfoster@redhat.com \
    --cc=gost.dev@samsung.com \
    --cc=kent.overstreet@linux.dev \
    --cc=linux-bcachefs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=p.raghav@samsung.com \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®