On Wed, Dec 12, 2018 at 08:22:37AM -0700, Jens Axboe wrote: > That one is a little worse, since we only need a full page if we > use all 256 segments. I don't want to make the fast case of > 16 bytes single segment allocs get a full page, so we have to > track if we used kmalloc() or mempool_alloc() for this particular > range. > > I guess I could abuse ->end_io for that, set it if we end up > punting to mempool. I'll do that. How about a full emergency page hanging off struct nvme_ctrl, and then in the completion path we can do: if (req->special_vec.bv_page == ctrl->discard_emergency_page) // clear some bit in ctrl->flags else kfree(page_address(req->special_vec.bv_page) +