]> www.infradead.org Git - nvme.git/commit
mm, virt: merge AS_UNMOVABLE and AS_INACCESSIBLE
authorPaolo Bonzini <pbonzini@redhat.com>
Thu, 11 Jul 2024 17:56:54 +0000 (13:56 -0400)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 12 Jul 2024 15:13:13 +0000 (11:13 -0400)
commit27e6a24a4cf3d25421c0f6ebb7c39f45fc14d20f
tree09d0af44ac90344bdb617ea78b12f3c1e744f99b
parent02b0d3b9d4dd1ef76b3e8c63175f1ae9ff392313
mm, virt: merge AS_UNMOVABLE and AS_INACCESSIBLE

The flags AS_UNMOVABLE and AS_INACCESSIBLE were both added just for guest_memfd;
AS_UNMOVABLE is already in existing versions of Linux, while AS_INACCESSIBLE was
acked for inclusion in 6.11.

But really, they are the same thing: only guest_memfd uses them, at least for
now, and guest_memfd pages are unmovable because they should not be
accessed by the CPU.

So merge them into one; use the AS_INACCESSIBLE name which is more comprehensive.
At the same time, this fixes an embarrassing bug where AS_INACCESSIBLE was used
as a bit mask, despite it being just a bit index.

The bug was mostly benign, because AS_INACCESSIBLE's bit representation (1010)
corresponded to setting AS_UNEVICTABLE (which is already set) and AS_ENOSPC
(except no async writes can happen on the guest_memfd).  So the AS_INACCESSIBLE
flag simply had no effect.

Fixes: 1d23040caa8b ("KVM: guest_memfd: Use AS_INACCESSIBLE when creating guest_memfd inode")
Fixes: c72ceafbd12c ("mm: Introduce AS_INACCESSIBLE for encrypted/confidential memory")
Cc: linux-mm@kvack.org
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Acked-by: David Hildenbrand <david@redhat.com>
Tested-by: Michael Roth <michael.roth@amd.com>
Reviewed-by: Michael Roth <michael.roth@amd.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
include/linux/pagemap.h
mm/compaction.c
mm/migrate.c
mm/truncate.c
virt/kvm/guest_memfd.c