Re: [PATCH] iomap: allow iomap using the per-cpu bio cache

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Matthew Wilcox <willy@xxxxxxxxxxxxx> writes:

> On Fri, Aug 22, 2025 at 08:05:50AM -0700, Darrick J. Wong wrote:
>> On Fri, Aug 22, 2025 at 04:26:06PM +0800, Fengnan Chang wrote:
>> > When use io_uring with direct IO, we could use per-cpu bio cache
>> > from bio_alloc_bioset, So pass IOCB_ALLOC_CACHE flag to alloc
>> > bio helper.
>> >  
>> > +	if (iter->flags & IOMAP_ALLOC_CACHE)
>> > +		bio_opf |= REQ_ALLOC_CACHE;
>> 
>> Is there a reason /not/ to use the per-cpu bio cache unconditionally?
>
> AIUI it's not safe because completions might happen on a different CPU
> from the submission.

At max the bio de-queued from cpu X can be returned to cpu Y cache, this
shouldn't be unsafe right? e.g. bio_put_percpu_cache(). 
Not optimal for performance though.

Also even for io-uring the IRQ completions (non-polling requests) can
get routed to a different cpu then the submitting cpu, correct?
Then the completions (bio completion processing) are handled via IPIs on
the submtting cpu or based on the cache topology, right?

> At least, there's nowhere that sets REQ_ALLOC_CACHE unconditionally.
>
> This could do with some better documentation ..

Agreed. Looking at the history this got added for polling mode first but
later got enabled for even irq driven io-uring rw requests [1]. So it
make sense to understand if this can be added unconditionally for DIO
requests or not.

[1]: https://lore.kernel.org/io-uring/aab3521d49fd6c1ff6ea194c9e63d05565efc103.1666347703.git.asml.silence@xxxxxxxxx/

-ritesh




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux