]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-4.14/mm-gup-fix-gup_pmd_range-for-dax.patch
Linux 4.9.165
[thirdparty/kernel/stable-queue.git] / queue-4.14 / mm-gup-fix-gup_pmd_range-for-dax.patch
1 From a5f7bbe4a8a35ccf65738311c1eea15c7dd64fe2 Mon Sep 17 00:00:00 2001
2 From: Yu Zhao <yuzhao@google.com>
3 Date: Tue, 12 Feb 2019 15:35:58 -0800
4 Subject: mm/gup: fix gup_pmd_range() for dax
5
6 [ Upstream commit 414fd080d125408cb15d04ff4907e1dd8145c8c7 ]
7
8 For dax pmd, pmd_trans_huge() returns false but pmd_huge() returns true
9 on x86. So the function works as long as hugetlb is configured.
10 However, dax doesn't depend on hugetlb.
11
12 Link: http://lkml.kernel.org/r/20190111034033.601-1-yuzhao@google.com
13 Signed-off-by: Yu Zhao <yuzhao@google.com>
14 Reviewed-by: Jan Kara <jack@suse.cz>
15 Cc: Dan Williams <dan.j.williams@intel.com>
16 Cc: Huang Ying <ying.huang@intel.com>
17 Cc: Matthew Wilcox <willy@infradead.org>
18 Cc: Keith Busch <keith.busch@intel.com>
19 Cc: "Michael S . Tsirkin" <mst@redhat.com>
20 Cc: John Hubbard <jhubbard@nvidia.com>
21 Cc: Wei Yang <richard.weiyang@gmail.com>
22 Cc: Mike Rapoport <rppt@linux.ibm.com>
23 Cc: Andrea Arcangeli <aarcange@redhat.com>
24 Cc: "Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>
25 Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
26 Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
27 Signed-off-by: Sasha Levin <sashal@kernel.org>
28 ---
29 mm/gup.c | 3 ++-
30 1 file changed, 2 insertions(+), 1 deletion(-)
31
32 diff --git a/mm/gup.c b/mm/gup.c
33 index 4cc8a6ff0f56..7c0e5b1bbcd4 100644
34 --- a/mm/gup.c
35 +++ b/mm/gup.c
36 @@ -1643,7 +1643,8 @@ static int gup_pmd_range(pud_t pud, unsigned long addr, unsigned long end,
37 if (!pmd_present(pmd))
38 return 0;
39
40 - if (unlikely(pmd_trans_huge(pmd) || pmd_huge(pmd))) {
41 + if (unlikely(pmd_trans_huge(pmd) || pmd_huge(pmd) ||
42 + pmd_devmap(pmd))) {
43 /*
44 * NUMA hinting faults need to be handled in the GUP
45 * slowpath for accounting purposes and so that they
46 --
47 2.19.1
48