Message ID | 20171204021912.25974-1-aneesh.kumar@linux.vnet.ibm.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 5fa5b16be5b319184378870467352eab6700b1de |
Headers | show |
Series | [1/3] arch/powerpc/hugetlb: Use pte_access_permitted for hugetlb access check | expand |
On Mon, 2017-12-04 at 02:19:10 UTC, "Aneesh Kumar K.V" wrote: > No functional change in this patch. This update gup_hugepte to use the > helper. This will help later when we add memory keys. > > Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> Series applied to powerpc next, thanks. https://git.kernel.org/powerpc/c/5fa5b16be5b319184378870467352e cheers
Le 04/12/2017 à 03:19, Aneesh Kumar K.V a écrit : > No functional change in this patch. This update gup_hugepte to use the > helper. This will help later when we add memory keys. > > Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> > --- > arch/powerpc/mm/hugetlbpage.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c > index a9b9083c5e49..c7e5afe5e118 100644 > --- a/arch/powerpc/mm/hugetlbpage.c > +++ b/arch/powerpc/mm/hugetlbpage.c > @@ -855,9 +855,7 @@ int gup_hugepte(pte_t *ptep, unsigned long sz, unsigned long addr, > > pte = READ_ONCE(*ptep); > > - if (!pte_present(pte) || !pte_read(pte)) > - return 0; > - if (write && !pte_write(pte)) > + if (!pte_access_permitted(pte, write)) Seems like pte_access_permitted() doesn't check _PAGE_RO whereas pte_write() does. Christophe > return 0; > > /* hugepages are never "special" */ >
diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c index a9b9083c5e49..c7e5afe5e118 100644 --- a/arch/powerpc/mm/hugetlbpage.c +++ b/arch/powerpc/mm/hugetlbpage.c @@ -855,9 +855,7 @@ int gup_hugepte(pte_t *ptep, unsigned long sz, unsigned long addr, pte = READ_ONCE(*ptep); - if (!pte_present(pte) || !pte_read(pte)) - return 0; - if (write && !pte_write(pte)) + if (!pte_access_permitted(pte, write)) return 0; /* hugepages are never "special" */
No functional change in this patch. This update gup_hugepte to use the helper. This will help later when we add memory keys. Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> --- arch/powerpc/mm/hugetlbpage.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)