On Tue, Mar 22, 2022 at 04:16:07PM -0400, Mike Snitzer wrote: > I did initially think it worthwhile to push the use of > bio_alloc_percpu_cache() down to bio_alloc_bioset() rather than > bio_alloc_clone() -- but I started slower with more targetted change > for DM's needs. Note that the nvme io_uring passthrough patches also want a non-kiocb cached alloc version. That code isn't quite ready yet but shows we'll need something there as well. > And yeah, since there isn't a REQ_ flag equivalent for IOCB_ALLOC_CACHE > (other than just allowing all REQ_POLLED access) there isn't a > meaningful way to limit access to the bioset's percpu cache. > > Curious: how do bio_alloc_kiocb() callers know when it appropriate to > set IOCB_ALLOC_CACHE or not? Seems io_uring is only one and it > unilaterally does: > kiocb->ki_flags |= IOCB_HIPRI | IOCB_ALLOC_CACHE; Yes, an uring deals with making sure they are freed in the same place. > So like IOCB_HIPRI maps to REQ_POLL, should IOCB_ALLOC_CACHE map to > REQ_ALLOC_CACHE? Or better name? The name sounds good fine, and I just it would be best done by lifting BIO_PERCPU_CACHE to the REQ_ namespace and ensure it is cleared by the bio allocator if the percpu cache isn't actually used.