memory: move exclusivity detection in do_wp_page() into wp_can_reuse_anon_folio()
authorDavid Hildenbrand <david@redhat.com>
Mon, 2 Oct 2023 14:29:49 +0000 (16:29 +0200)
committerAndrew Morton <akpm@linux-foundation.org>
Wed, 18 Oct 2023 21:34:14 +0000 (14:34 -0700)
commitdec078cc2181fccf8b134406b86aaacc19f7163f
treedfbf376b2b90448054f106fbea336bf289938bf2
parent069686255c16a75b6a796e42df47f5af27b496a4
memory: move exclusivity detection in do_wp_page() into wp_can_reuse_anon_folio()

Let's clean up do_wp_page() a bit, removing two labels and making it a
easier to read.

wp_can_reuse_anon_folio() now only operates on the whole folio.  Move the
SetPageAnonExclusive() out into do_wp_page().  No need to do this under
page lock -- the page table lock is sufficient.

Link: https://lkml.kernel.org/r/20231002142949.235104-4-david@redhat.com
Signed-off-by: David Hildenbrand <david@redhat.com>
Cc: Mike Kravetz <mike.kravetz@oracle.com>
Cc: Muchun Song <muchun.song@linux.dev>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Matthew Wilcox <willy@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/memory.c