Message ID | 094050f349fdf7eed4a20335e9a7573d7c8c9b35.1499881589.git.shli@fb.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
> static void bio_free(struct bio *bio) > { > struct bio_set *bs = bio->bi_pool; > void *p; > > - bio_uninit(bio); > + bio_disassociate_task(bio); As said in the last mail I think there is no point in having this call.. > @@ -294,7 +289,7 @@ void bio_reset(struct bio *bio) > { > unsigned long flags = bio->bi_flags & (~0UL << BIO_RESET_BITS); > > - bio_uninit(bio); > + bio_disassociate_task(bio); .. and this one. And I suspect it would make sense to have all these changes in a single patch.
On Thu, Jul 13, 2017 at 09:45:19AM +0200, Christoph Hellwig wrote: > > static void bio_free(struct bio *bio) > > { > > struct bio_set *bs = bio->bi_pool; > > void *p; > > > > - bio_uninit(bio); > > + bio_disassociate_task(bio); > > As said in the last mail I think there is no point in having this call.. I'm hesitant to do this. bio_associate_blkcg/bio_associate_current can be called in any time for a bio, so we not just attach cgroup info to info in bio submit (maybe the bio_associate_blkcg/bio_associate_current callers do sumbit always, but I didn't audit yet). The other reason is I'd like blk_throtl_bio_endio is only called once for the whole bio not for splitted bio, so this depends on bio_free to free cgroup info for chained bio which always does bio_put. > > @@ -294,7 +289,7 @@ void bio_reset(struct bio *bio) > > { > > unsigned long flags = bio->bi_flags & (~0UL << BIO_RESET_BITS); > > > > - bio_uninit(bio); > > + bio_disassociate_task(bio); > > .. and this one. And I suspect it would make sense to have all these > changes in a single patch. This one is likely ok, but again I didn't audit yet. I'm ok these changes are in a single patch. Thanks, Shaohua
On Thu, Jul 13, 2017 at 09:50:23AM -0700, Shaohua Li wrote: > > As said in the last mail I think there is no point in having this call.. > > I'm hesitant to do this. bio_associate_blkcg/bio_associate_current can be > called in any time for a bio, so we not just attach cgroup info to info in bio > submit (maybe the bio_associate_blkcg/bio_associate_current callers do sumbit > always, but I didn't audit yet). bio_associate_current is only called from blk_throtl_assoc_bio, which is only called from blk_throtl_bio, which is only called from blkcg_bio_issue_check, which is only called from generic_make_request_checks, which is only called from generic_make_request, which at that point consumes the bio from the callers perspective. bio_associate_blkcg might be a different story, but then we should treat both very differently. > The other reason is I'd like > blk_throtl_bio_endio is only called once for the whole bio not for splitted > bio, so this depends on bio_free to free cgroup info for chained bio which > always does bio_put. Then we'll need to fix that. We really should not require every caller of bio_init to pair it with a new uninit call, which would be a whole lot more work.
diff --git a/block/bio.c b/block/bio.c index ce078fb..8773d1b 100644 --- a/block/bio.c +++ b/block/bio.c @@ -240,17 +240,12 @@ struct bio_vec *bvec_alloc(gfp_t gfp_mask, int nr, unsigned long *idx, return bvl; } -static void bio_uninit(struct bio *bio) -{ - bio_disassociate_task(bio); -} - static void bio_free(struct bio *bio) { struct bio_set *bs = bio->bi_pool; void *p; - bio_uninit(bio); + bio_disassociate_task(bio); if (bs) { bvec_free(bs->bvec_pool, bio->bi_io_vec, BVEC_POOL_IDX(bio)); @@ -294,7 +289,7 @@ void bio_reset(struct bio *bio) { unsigned long flags = bio->bi_flags & (~0UL << BIO_RESET_BITS); - bio_uninit(bio); + bio_disassociate_task(bio); memset(bio, 0, BIO_RESET_BYTES); bio->bi_flags = flags; @@ -1828,7 +1823,7 @@ void bio_endio(struct bio *bio) blk_throtl_bio_endio(bio); /* release cgroup info */ - bio_uninit(bio); + bio_disassociate_task(bio); if (bio->bi_end_io) bio->bi_end_io(bio); }