*/
struct zap_details {
struct folio *single_folio; /* Locked folio to be unmapped */
- bool even_cows; /* Zap COWed private pages too? */
+ bool skip_cows; /* Do not zap COWed private pages */
bool reclaim_pt; /* Need reclaim page tables? */
zap_flags_t zap_flags; /* Extra flags for zapping */
};
static inline bool should_zap_cows(struct zap_details *details)
{
/* By default, zap all pages */
- if (!details || details->reclaim_pt)
+ if (!details)
return true;
+ VM_WARN_ON_ONCE(details->skip_cows && details->reclaim_pt);
+
/* Or, we zap COWed pages only if the caller wants to */
- return details->even_cows;
+ return !details->skip_cows;
}
/* Decides whether we should zap this folio with the folio pointer specified */
struct mmu_notifier_range range;
struct zap_details details = {
.zap_flags = ZAP_FLAG_DROP_MARKER | ZAP_FLAG_UNMAP,
- /* Careful - we need to zap private pages too! */
- .even_cows = true,
};
vma = unmap->first;
first_index = folio->index;
last_index = folio_next_index(folio) - 1;
- details.even_cows = false;
+ details.skip_cows = true;
details.single_folio = folio;
details.zap_flags = ZAP_FLAG_DROP_MARKER;
pgoff_t first_index = start;
pgoff_t last_index = start + nr - 1;
- details.even_cows = even_cows;
+ details.skip_cows = !even_cows;
if (last_index < first_index)
last_index = ULONG_MAX;