Messages in this thread | | | Subject | Re: [PATCH 16/34] x86, mm: simplify get_user_pages() PTE bit handling | From | Dave Hansen <> | Date | Tue, 8 Dec 2015 10:30:38 -0800 |
| |
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.
| |