[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALWNXx8pDOvDdNvw+v0rEyi33W8TL+OZW1YiFbF6Gns3PeWOLA@mail.gmail.com>
Date: Mon, 13 Oct 2025 13:42:47 +0800
From: fengnan chang <fengnanchang@...il.com>
To: Christoph Hellwig <hch@...radead.org>
Cc: Fengnan Chang <changfengnan@...edance.com>, axboe@...nel.dk, viro@...iv.linux.org.uk,
brauner@...nel.org, jack@...e.cz, asml.silence@...il.com, willy@...radead.org,
djwong@...nel.org, ritesh.list@...il.com, linux-fsdevel@...r.kernel.org,
io-uring@...r.kernel.org, linux-xfs@...r.kernel.org,
linux-ext4@...r.kernel.org
Subject: Re: [PATCH] block: enable per-cpu bio cache by default
On Mon, Oct 13, 2025 at 11:25 AM Christoph Hellwig <hch@...radead.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.
>
>
Powered by blists - more mailing lists