Lines Matching +full:entry +full:- +full:address

1 // SPDX-License-Identifier: GPL-2.0
3 * Helper functions for KVM guest address space mapping code
21 * ptep_zap_softleaf_entry() - discard a software leaf entry.
23 * @entry: the software leaf entry that needs to be zapped
25 * Discards the given software leaf entry. If the leaf entry was an actual
26 * swap entry (and not a migration entry, for example), the actual swapped
29 static void ptep_zap_softleaf_entry(struct mm_struct *mm, softleaf_t entry) in ptep_zap_softleaf_entry() argument
31 if (softleaf_is_swap(entry)) in ptep_zap_softleaf_entry()
33 else if (softleaf_is_migration(entry)) in ptep_zap_softleaf_entry()
34 dec_mm_counter(mm, mm_counter(softleaf_to_folio(entry))); in ptep_zap_softleaf_entry()
35 free_swap_and_cache(entry); in ptep_zap_softleaf_entry()
39 * gmap_helper_zap_one_page() - discard a page if it was swapped.
41 * @vmaddr: the userspace virtual address that needs to be discarded
43 * If the given address maps to a swap entry, discard it.
56 /* Find the vm address for the guest address */ in gmap_helper_zap_one_page()
61 /* Get pointer to the page table entry */ in gmap_helper_zap_one_page()
80 * gmap_helper_discard() - discard user pages in the given range
82 * @vmaddr: starting userspace address
83 * @end: end address (first address outside the range)
100 zap_page_range_single(vma, vmaddr, min(end, vma->vm_end) - vmaddr, NULL); in gmap_helper_discard()
101 vmaddr = vma->vm_end; in gmap_helper_discard()
109 unsigned long *found_addr = walk->private; in find_zeropage_pte_entry()
119 if (!is_cow_mapping(walk->vma->vm_flags)) in find_zeropage_pte_entry()
120 return -EFAULT; in find_zeropage_pte_entry()
133 /** __gmap_helper_unshare_zeropages() - unshare all shared zeropages
140 * This must be called after mm->context.allow_cow_sharing was
147 * mm->context.allow_cow_sharing is set to 0.
163 if ((vma->vm_flags & VM_PFNMAP) || is_vm_hugetlb_page(vma)) in __gmap_helper_unshare_zeropages()
165 addr = vma->vm_start; in __gmap_helper_unshare_zeropages()
168 rc = walk_page_range_vma(vma, addr, vma->vm_end, in __gmap_helper_unshare_zeropages()
180 return -ENOMEM; in __gmap_helper_unshare_zeropages()
183 * must start the lookup from the current address, because in __gmap_helper_unshare_zeropages()
199 * gmap_helper_disable_cow_sharing() - disable all COW sharing
201 * Disable most COW-sharing of memory pages for the whole process:
205 * Not that we currently don't bother with COW-shared pages that are shared
210 struct mm_struct *mm = current->mm; in gmap_helper_disable_cow_sharing()
215 if (!mm->context.allow_cow_sharing) in gmap_helper_disable_cow_sharing()
218 mm->context.allow_cow_sharing = 0; in gmap_helper_disable_cow_sharing()
225 * from re-enabling it. in gmap_helper_disable_cow_sharing()
230 mm->context.allow_cow_sharing = 1; in gmap_helper_disable_cow_sharing()