nvme: provide fallback for discard alloc failure
authorJens Axboe <axboe@kernel.dk>
Wed, 12 Dec 2018 16:18:11 +0000 (09:18 -0700)
committerChristoph Hellwig <hch@lst.de>
Thu, 13 Dec 2018 08:59:00 +0000 (09:59 +0100)
commitcb5b7262b011cfb793519bf97e54dff5282da23c
treea038a3b479612f738979529be22391aab88501e5
parent8eb5d89f483141dd076529bf5f6aa235b425886e
nvme: provide fallback for discard alloc failure

When boxes are run near (or to) OOM, we have a problem with the discard
page allocation in nvme. If we fail allocating the special page, we
return busy, and it'll get retried. But since ordering is honored for
dispatch requests, we can keep retrying this same IO and failing. Behind
that IO could be requests that want to free memory, but they never get
the chance.

Allocate a fixed discard page per controller for a safe fallback, and use
that if the initial allocation fails.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
Reviewed-by: Keith Busch <keith.busch@intel.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/nvme/host/core.c
drivers/nvme/host/nvme.h