[PATCH v2 hmm 4/9] mm/hmm: remove HMM_FAULT_SNAPSHOT
Christoph Hellwig
hch at lst.de
Tue Mar 24 07:33:39 UTC 2020
>
> +/*
> + * If the valid flag is masked off, and default_flags doesn't set valid, then
> + * hmm_pte_need_fault() always returns 0.
> + */
> +static bool hmm_can_fault(struct hmm_range *range)
> +{
> + return ((range->flags[HMM_PFN_VALID] & range->pfn_flags_mask) |
> + range->default_flags) &
> + range->flags[HMM_PFN_VALID];
> +}
So my idea behind the helper was to turn this into something readable :)
E.g.
/*
* We only need to fault if either the default mask requires to fault all
* pages, or at least the mask allows for individual pages to be faulted.
*/
static bool hmm_can_fault(struct hmm_range *range)
{
return ((range->default_flags | range->pfn_flags_mask) &
range->flags[HMM_PFN_VALID]);
}
In fact now that I managed to destill it down to this I'm not even
sure we really even need the helper, although the comment really helps.
More information about the amd-gfx
mailing list