diff options
author | Sean Christopherson <seanjc@google.com> | 2024-10-10 11:23:05 -0700 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2024-10-25 12:54:42 -0400 |
commit | 3af91068b7e10dba438f70eae94d877f20842fa1 (patch) | |
tree | 1f45e3485f60ee600bbc753f40a598549fa2f646 /include | |
parent | 85e88b2bbaacb4135499fdb219f78ac38ef6e8d4 (diff) | |
download | linux-3af91068b7e10dba438f70eae94d877f20842fa1.tar.gz linux-3af91068b7e10dba438f70eae94d877f20842fa1.tar.bz2 linux-3af91068b7e10dba438f70eae94d877f20842fa1.zip |
KVM: Add kvm_release_page_unused() API to put pages that KVM never consumes
Add an API to release an unused page, i.e. to put a page without marking
it accessed or dirty. The API will be used when KVM faults-in a page but
bails before installing the guest mapping (and other similar flows).
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Tested-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Tested-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-ID: <20241010182427.1434605-4-seanjc@google.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/kvm_host.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index 0b280e5bad0a..8de9acb0b35e 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h @@ -1216,6 +1216,15 @@ unsigned long gfn_to_hva_prot(struct kvm *kvm, gfn_t gfn, bool *writable); unsigned long gfn_to_hva_memslot(struct kvm_memory_slot *slot, gfn_t gfn); unsigned long gfn_to_hva_memslot_prot(struct kvm_memory_slot *slot, gfn_t gfn, bool *writable); + +static inline void kvm_release_page_unused(struct page *page) +{ + if (!page) + return; + + put_page(page); +} + void kvm_release_page_clean(struct page *page); void kvm_release_page_dirty(struct page *page); |