On 12/08/2015 10:01 AM, Thomas Gleixner wrote:
> static inline int pte_allows_gup(unsigned long pteval, int write)
> {
>       unsigned long mask = _PAGE_PRESENT|_PAGE_USER;
> 
>       if (write)
>               mask |= _PAGE_RW;
> 
>       if ((pteval & mask) != mask)
>               return 0;
> 
>       if (!__pkru_allows_pkey(pte_flags_pkey(pteval), write))
>               return 0;
>       return 1;
> }
> 
> and at the callsites do:
> 
>     if (pte_allows_gup(pte_val(pte, write))
> 
>     if (pte_allows_gup(pmd_val(pmd, write))
> 
>     if (pte_allows_gup(pud_val(pud, write))
> 
> Hmm?

Looks fine to me.  I'll do that.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to