mm: add support for async page locking
authorJens Axboe <axboe@kernel.dk>
Fri, 22 May 2020 15:12:09 +0000 (09:12 -0600)
committerJens Axboe <axboe@kernel.dk>
Thu, 18 Jun 2020 14:40:50 +0000 (08:40 -0600)
commit1e360f81f0a9b5cba5bd997e471268e8e7eb0e5b
tree2cd1a5010ea00ac282a952b4558a060a080847da
parentc6652c74dded3a1dce2df63e1f362a95ae3cc3f5
mm: add support for async page locking

Normally waiting for a page to become unlocked, or locking the page,
requires waiting for IO to complete. Add support for lock_page_async()
and wait_on_page_locked_async(), which are callback based instead. This
allows a caller to get notified when a page becomes unlocked, rather
than wait for it.

We add a new iocb field, ki_waitq, to pass in the necessary data for this
to happen. We can unionize this with ki_cookie, since that is only used
for polled IO. Polled IO can never co-exist with async callbacks, as it is
(by definition) polled completions. struct wait_page_key is made public,
and we define struct wait_page_async as the interface between the caller
and the core.

Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
include/linux/fs.h
include/linux/pagemap.h
mm/filemap.c