Files
lkl_linux/include/linux
Suren Baghdasaryan 1235ccd05b mm: handle swap page faults under per-VMA lock
When page fault is handled under per-VMA lock protection, all swap page
faults are retried with mmap_lock because folio_lock_or_retry has to drop
and reacquire mmap_lock if folio could not be immediately locked.  Follow
the same pattern as mmap_lock to drop per-VMA lock when waiting for folio
and retrying once folio is available.

With this obstacle removed, enable do_swap_page to operate under per-VMA
lock protection.  Drivers implementing ops->migrate_to_ram might still
rely on mmap_lock, therefore we have to fall back to mmap_lock in that
particular case.

Note that the only time do_swap_page calls synchronous swap_readpage is
when SWP_SYNCHRONOUS_IO is set, which is only set for
QUEUE_FLAG_SYNCHRONOUS devices: brd, zram and nvdimms (both btt and pmem).
Therefore we don't sleep in this path, and there's no need to drop the
mmap or per-VMA lock.

Link: https://lkml.kernel.org/r/20230630211957.1341547-6-surenb@google.com
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Tested-by: Alistair Popple <apopple@nvidia.com>
Reviewed-by: Alistair Popple <apopple@nvidia.com>
Acked-by: Peter Xu <peterx@redhat.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Christian Brauner <brauner@kernel.org>
Cc: Christoph Hellwig <hch@lst.de>
Cc: David Hildenbrand <david@redhat.com>
Cc: David Howells <dhowells@redhat.com>
Cc: Davidlohr Bueso <dave@stgolabs.net>
Cc: Hillf Danton <hdanton@sina.com>
Cc: "Huang, Ying" <ying.huang@intel.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Jan Kara <jack@suse.cz>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Josef Bacik <josef@toxicpanda.com>
Cc: Laurent Dufour <ldufour@linux.ibm.com>
Cc: Liam R. Howlett <Liam.Howlett@oracle.com>
Cc: Lorenzo Stoakes <lstoakes@gmail.com>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Michel Lespinasse <michel@lespinasse.org>
Cc: Minchan Kim <minchan@google.com>
Cc: Pavel Tatashin <pasha.tatashin@soleen.com>
Cc: Punit Agrawal <punit.agrawal@bytedance.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Yu Zhao <yuzhao@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2023-08-24 16:20:17 -07:00
..
2023-06-16 12:27:04 -06:00
2023-05-20 19:20:30 +02:00
2023-06-27 10:47:08 -04:00
2023-05-19 23:23:52 +05:30
2023-06-12 12:17:22 -05:00
2023-05-31 13:06:57 +02:00
2023-08-18 10:12:31 -07:00
2023-05-25 09:26:19 +02:00
2023-04-17 18:01:23 +02:00
2023-06-13 16:49:23 +02:00
2023-06-09 17:30:47 +02:00
2023-05-01 17:50:18 -07:00
2023-05-22 17:38:45 +02:00
2023-08-18 10:12:10 -07:00
2023-06-20 20:17:10 -07:00
2023-05-24 18:08:49 +02:00
2023-06-19 15:08:12 -04:00
2023-08-18 10:12:25 -07:00
2023-08-21 14:28:45 -07:00
2023-06-23 16:59:30 -07:00
2023-06-05 09:36:39 +02:00
2023-05-23 12:55:12 -07:00
2023-06-23 16:59:28 -07:00
2023-05-18 19:52:31 -07:00
2023-06-11 18:22:47 +02:00
2023-06-05 09:36:39 +02:00
2023-06-24 15:50:13 -07:00
2023-08-21 13:37:26 -07:00
2023-08-21 13:37:26 -07:00
2023-03-29 08:19:38 +01:00
2023-04-05 20:03:01 -07:00
2023-04-21 03:02:34 -04:00
2023-08-21 13:37:27 -07:00