linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: fengnan chang <fengnanchang@gmail.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: Fengnan Chang <changfengnan@bytedance.com>,
	axboe@kernel.dk, viro@zeniv.linux.org.uk,  brauner@kernel.org,
	jack@suse.cz, asml.silence@gmail.com, willy@infradead.org,
	 djwong@kernel.org, ritesh.list@gmail.com,
	linux-fsdevel@vger.kernel.org,  io-uring@vger.kernel.org,
	linux-xfs@vger.kernel.org,  linux-ext4@vger.kernel.org
Subject: Re: [PATCH] block: enable per-cpu bio cache by default
Date: Mon, 13 Oct 2025 13:42:47 +0800	[thread overview]
Message-ID: <CALWNXx8pDOvDdNvw+v0rEyi33W8TL+OZW1YiFbF6Gns3PeWOLA@mail.gmail.com> (raw)
In-Reply-To: <aOxxBS8075_gMXgy@infradead.org>

On Mon, Oct 13, 2025 at 11:25 AM Christoph Hellwig <hch@infradead.org> wrote:
>
> On Sat, Oct 11, 2025 at 09:33:12AM +0800, Fengnan Chang wrote:
> > +     opf |= REQ_ALLOC_CACHE;
> > +     if (bs->cache && nr_vecs <= BIO_INLINE_VECS) {
> > +             bio = bio_alloc_percpu_cache(bdev, nr_vecs, opf,
> > +                                          gfp_mask, bs);
> > +             if (bio)
> > +                     return bio;
> > +             /*
> > +              * No cached bio available, bio returned below marked with
> > +              * REQ_ALLOC_CACHE to participate in per-cpu alloc cache.
> > +              */
> > +     } else
>
> > +             opf &= ~REQ_ALLOC_CACHE;
>
> Just set the req flag in the branch instead of unconditionally setting
> it and then clearing it.

clearing this flag is necessary, because bio_alloc_clone will call this in
boot stage, maybe the bs->cache of the new bio is not initialized yet.

>
> > +     /*
> > +      * Even REQ_ALLOC_CACHE is enabled by default, we still need this to
> > +      * mark bio is allocated by bio_alloc_bioset.
> > +      */
> >       if (rq->cmd_flags & REQ_ALLOC_CACHE && (nr_vecs <= BIO_INLINE_VECS)) {
>
> I can't really parse the comment, can you explain what you mean?

This is to tell others that REQ_ALLOC_CACHE can't be deleted here, and
that this flag
serves other purposes here.

>
>

  reply	other threads:[~2025-10-13  5:42 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-11  1:33 [PATCH] block: enable per-cpu bio cache by default Fengnan Chang
2025-10-11  1:36 ` fengnan chang
2025-10-11  1:43   ` fengnan chang
2025-10-13  3:24 ` Christoph Hellwig
2025-10-13  5:42   ` fengnan chang [this message]
2025-10-13  6:28     ` Christoph Hellwig
2025-10-13 12:58       ` [External] " Fengnan Chang
2025-10-13 13:31         ` Pavel Begunkov
2025-10-14  2:38           ` Fengnan Chang
2025-10-13  5:18 ` Ming Lei
2025-10-13  5:44   ` fengnan chang

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=CALWNXx8pDOvDdNvw+v0rEyi33W8TL+OZW1YiFbF6Gns3PeWOLA@mail.gmail.com \
    --to=fengnanchang@gmail.com \
    --cc=asml.silence@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=brauner@kernel.org \
    --cc=changfengnan@bytedance.com \
    --cc=djwong@kernel.org \
    --cc=hch@infradead.org \
    --cc=io-uring@vger.kernel.org \
    --cc=jack@suse.cz \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=ritesh.list@gmail.com \
    --cc=viro@zeniv.linux.org.uk \
    --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;
as well as URLs for NNTP newsgroup(s).