On Mon, Jan 10, 2022 at 02:03:16PM -0500, Mike Snitzer wrote: > On Mon, Jan 10 2022 at 12:35P -0500, > Christoph Hellwig <hch@xxxxxxxxxxxxx> wrote: > > > On Mon, Jan 10, 2022 at 03:51:40PM +0800, Ming Lei wrote: > > > Add block layer API of resubmit_bio_noacct() for handling blk-throttle > > > iops limit correctly. Typical use case is that bio split, and it isn't > > > good to export blk_throtl_charge_bio_split() for drivers, so add new API > > > for serving such purpose. > > > > Umm, submit_bio_noacct is meant exactly for this case of resubmitting > > a bio. We should not need another API for that. > > > > Ming is lifting code out of __blk_queue_split() for reuse (by DM in > this instance, because it has its own bio_split+bio_chain). > > Are you saying submit_bio_noacct() should be made to call > blk_throtl_charge_bio_split() and blk_throtl_charge_bio_split() simply > return if not a split bio? (not sure bio has enough context to know, DM or MD may submit split bio to underlying queue directly, so we can't do that simply. Also some FS may call bio_split() too. Or we simply let blk_throtl_bio cover everything? That is basically what V1 did, and the only issue is that we can't run the account in case that submit_bio_noacct() is called from blk_throtl_dispatch_work_fn(). > other than looking at some side-effect change from bio_chain) > > But Ming: your __blk_queue_split() change seems wrong. > Prior to your patch __blk_queue_split() did: > > bio_chain(split, *bio); > submit_bio_noacct(*bio); > *bio = split; > blk_throtl_charge_bio_split(*bio); > > After your patch (effectively): > > bio_chain(split, *bio); > submit_bio_noacct(*bio); > blk_throtl_charge_bio_split(bio); > *bio = split; > > Maybe that was intended? (or maybe it doesn't matter because bio_split > copies fields with bio_clone_fast())? Regardless, it is subtle. It doesn't matter, blk_throtl_charge_bio_split() just accounts bio number, here the split bio is submitted to the same queue. > > Should blk_throtl_charge_bio_split() just be pushed down to > bio_split()? It is fragile, will the bio allocated from bio_split() always submitted finally? or submitted to same queue? > > In general, such narrow hacks for how to properly resubmit split bios > are asking for further trouble. I don't think it is hacks, it is one approach which has been verified as workable in blk-mq. > As is, I'm having to triage new > reports of bio-based accounting issues (which has called into question > my hack/fix commit a1e1cb72d9649 ("dm: fix redundant IO accounting for > bios that need splitting") that papered over this bigger issue of > needing proper split IO accounting, so likely needs to be revisited). Here the issue is just about bio number accounting. BTW, maybe you can follow blk-mq's way: just account after io is split, such as, move start_io_acct() to the end of __split_and_process_non_flush(), then you can just account io start once. Thanks, Ming -- dm-devel mailing list dm-devel@xxxxxxxxxx https://listman.redhat.com/mailman/listinfo/dm-devel