With support for large pages in gmem, it may happen that part of the gmem is mapped with large pages and part with 4k pages. For example, if a conversion happens on a small region within a large page, the large page has to be smashed into small pages even if backed by a large folio. Each of the small pages will have its own state of preparedness, which makes it harder to use the uptodate flag for preparedness. Just switch to a bitmap in the inode's i_private data. This is a stupidly large amount of code; first because we need to add back a gmem filesystem just in order to plug in custom inode operations, second because bitmap operations have to be atomic. Apart from that, it's not too hard. Please review! Paolo Paolo Bonzini (3): KVM: gmem: allocate private data for the gmem inode KVM: gmem: adjust functions to query preparedness state KVM: gmem: track preparedness a page at a time include/uapi/linux/magic.h | 1 + virt/kvm/guest_memfd.c | 243 ++++++++++++++++++++++++++++++++++--- virt/kvm/kvm_main.c | 7 +- virt/kvm/kvm_mm.h | 8 +- 4 files changed, 237 insertions(+), 22 deletions(-) -- 2.43.5