On Tue, Dec 12 2023 at 8:13P -0500, Christoph Hellwig <hch@xxxxxxxxxxxxx> wrote: > On Tue, Dec 12, 2023 at 07:11:46PM +0800, Hongyu Jin wrote: > > From: Hongyu Jin <hongyu.jin@xxxxxxxxxx> > > > > Move bio_set_ioprio() into submit_bio(): > > 1. Only call bio_set_ioprio() once to set the priority of original bio, > > the bio that cloned and splited from original bio will auto inherit > > the priority of original bio in clone process. > > > > 2. The IO priority can be passed to module that implement > > struct gendisk::fops::submit_bio, help resolve some > > of the IO priority loss issues. > > Can we reword this a bit. AFAICS what this primarily does it to ensure > the priority is set before dispatching to submit_bio based drivers or > blk-mq instead of just blk-mq, and the rest follows from that. Yeah, I agree.. something like: Move bio_set_ioprio() and caller up from blk_mq_submit_bio() to submit_bio(). This ensures all block drivers call bio_set_ioprio() during initial bio submission. > > +static void bio_set_ioprio(struct bio *bio) > > +{ > > + /* Nobody set ioprio so far? Initialize it based on task's nice value */ > > + if (IOPRIO_PRIO_CLASS(bio->bi_ioprio) == IOPRIO_CLASS_NONE) > > + bio->bi_ioprio = get_current_ioprio(); > > + blkcg_set_ioprio(bio); > > +} > > I don't think we need the check here as anyone resubmitting a bio should > be using submit_bio_noact. This patch moves the caller from blk_mq_submit_bio() to submit_bio(). So I'm not sure why you're seizing on the "resubmitting a bio" usecase as reason for dropping this check (which occurs in submit_bio). The original justification for the check is detailed in commit a78418e6a04c93b ("block: Always initialize bio IO priority on submit"). Mike