Commit eacde327 authored by Miaohe Lin's avatar Miaohe Lin Committed by akpm

mm/swap: avoid calling swp_swap_info when try to check SWP_STABLE_WRITES

Use flags of si directly to check SWP_STABLE_WRITES to avoid possible
READ_ONCE and thus save some cpu cycles.

[akpm@linux-foundation.org: use data_race() on si->flags, per Neil]
Link: https://lkml.kernel.org/r/20220509131416.17553-10-linmiaohe@huawei.comSigned-off-by: default avatarMiaohe Lin <linmiaohe@huawei.com>
Cc: Alistair Popple <apopple@nvidia.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: David Howells <dhowells@redhat.com>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Naoya Horiguchi <naoya.horiguchi@nec.com>
Cc: NeilBrown <neilb@suse.de>
Cc: Peter Xu <peterx@redhat.com>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Oscar Salvador <osalvador@suse.de>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 3db3264d
...@@ -3889,7 +3889,7 @@ vm_fault_t do_swap_page(struct vm_fault *vmf) ...@@ -3889,7 +3889,7 @@ vm_fault_t do_swap_page(struct vm_fault *vmf)
*/ */
exclusive = true; exclusive = true;
} else if (exclusive && PageWriteback(page) && } else if (exclusive && PageWriteback(page) &&
(swp_swap_info(entry)->flags & SWP_STABLE_WRITES)) { data_race(si->flags & SWP_STABLE_WRITES)) {
/* /*
* This is tricky: not all swap backends support * This is tricky: not all swap backends support
* concurrent page modifications while under writeback. * concurrent page modifications while under writeback.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment