lkml.org 
[lkml]   [2015]   [Dec]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 16/34] x86, mm: simplify get_user_pages() PTE bit handling
From
Date
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.


\
 
 \ /
  Last update: 2015-12-08 20:21    [W:1.034 / U:0.020 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site