diff options
author | Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> | 2017-02-24 17:59:53 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-02-24 20:46:56 -0500 |
commit | db08f2030a173fdb95b2e8e28d82c4e8c04df2ac (patch) | |
tree | 7a6abca436184c04f2bf78c0e87cc14346d6b160 | |
parent | 199eaa05adc53825503a5303db624dd57397b93a (diff) |
mm/gup: check for protnone only if it is a PTE entry
Do the prot_none/FOLL_NUMA check after we are sure this is a THP pte.
Archs can implement prot_none such that it can return true for regular
pmd entries.
Link: http://lkml.kernel.org/r/1487498326-8734-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Cc: Rik van Riel <riel@surriel.com>
Cc: Mel Gorman <mgorman@techsingularity.net>
Cc: Hillf Danton <hillf.zj@alibaba-inc.com>
Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | mm/gup.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -272,8 +272,6 @@ struct page *follow_page_mask(struct vm_area_struct *vma, | |||
272 | return page; | 272 | return page; |
273 | return no_page_table(vma, flags); | 273 | return no_page_table(vma, flags); |
274 | } | 274 | } |
275 | if ((flags & FOLL_NUMA) && pmd_protnone(*pmd)) | ||
276 | return no_page_table(vma, flags); | ||
277 | if (pmd_devmap(*pmd)) { | 275 | if (pmd_devmap(*pmd)) { |
278 | ptl = pmd_lock(mm, pmd); | 276 | ptl = pmd_lock(mm, pmd); |
279 | page = follow_devmap_pmd(vma, address, pmd, flags); | 277 | page = follow_devmap_pmd(vma, address, pmd, flags); |
@@ -284,6 +282,9 @@ struct page *follow_page_mask(struct vm_area_struct *vma, | |||
284 | if (likely(!pmd_trans_huge(*pmd))) | 282 | if (likely(!pmd_trans_huge(*pmd))) |
285 | return follow_page_pte(vma, address, pmd, flags); | 283 | return follow_page_pte(vma, address, pmd, flags); |
286 | 284 | ||
285 | if ((flags & FOLL_NUMA) && pmd_protnone(*pmd)) | ||
286 | return no_page_table(vma, flags); | ||
287 | |||
287 | ptl = pmd_lock(mm, pmd); | 288 | ptl = pmd_lock(mm, pmd); |
288 | if (unlikely(!pmd_trans_huge(*pmd))) { | 289 | if (unlikely(!pmd_trans_huge(*pmd))) { |
289 | spin_unlock(ptl); | 290 | spin_unlock(ptl); |