Kent, On Mon, Sep 10, 2012 at 2:56 PM, Kent Overstreet <koverstreet@xxxxxxxxxx> wrote: .. <snip> .. > > +static void bio_alloc_rescue(struct work_struct *work) > +{ > + struct bio_set *bs = container_of(work, struct bio_set, rescue_work); > + struct bio *bio; > + > + while (1) { > + spin_lock(&bs->rescue_lock); > + bio = bio_list_pop(&bs->rescue_list); > + spin_unlock(&bs->rescue_lock); > + > + if (!bio) > + break; > + > + generic_make_request(bio); > + } > +} > + > +static void punt_bios_to_rescuer(struct bio_set *bs) > +{ > + struct bio_list punt, nopunt; > + struct bio *bio; > + > + /* > + * In order to guarantee forward progress we must punt only bios that > + * were allocated from this bio_set; otherwise, if there was a bio on > + * there for a stacking driver higher up in the stack, processing it > + * could require allocating bios from this bio_set, and doing that from > + * our own rescuer would be bad. > + * > + * Since bio lists are singly linked, pop them all instead of trying to > + * remove from the middle of the list: > + */ > + > + bio_list_init(&punt); > + bio_list_init(&nopunt); > + > + while ((bio = bio_list_pop(current->bio_list))) > + bio_list_add(bio->bi_pool == bs ? &punt : &nopunt, bio); > + > + *current->bio_list = nopunt; > + > + spin_lock(&bs->rescue_lock); > + bio_list_merge(&bs->rescue_list, &punt); > + spin_unlock(&bs->rescue_lock); > + > + queue_work(bs->rescue_workqueue, &bs->rescue_work); > +} Does this preserve the CPU from which the bio was submitted originally. Not familiar with cmwq, may be Tejun can clarify. Tejun - the question is, do we honor the rq_affinity with the above rescue worker implementation? Regards, Muthu -- dm-devel mailing list dm-devel@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/dm-devel