diff options
author | Kirill A. Shutemov <kirill.shutemov@linux.intel.com> | 2016-01-15 19:53:46 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-01-15 20:56:32 -0500 |
commit | e1534ae95004d6a307839a44eed40389d608c935 (patch) | |
tree | 43daec95b0face855da72b54bb75bfbc6a6e49a3 /arch/sh | |
parent | 53f9263baba69fc1630e3c780c4d11b72643f962 (diff) |
mm: differentiate page_mapped() from page_mapcount() for compound pages
Let's define page_mapped() to be true for compound pages if any
sub-pages of the compound page is mapped (with PMD or PTE).
On other hand page_mapcount() return mapcount for this particular small
page.
This will make cases like page_get_anon_vma() behave correctly once we
allow huge pages to be mapped with PTE.
Most users outside core-mm should use page_mapcount() instead of
page_mapped().
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Tested-by: Sasha Levin <sasha.levin@oracle.com>
Tested-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Acked-by: Jerome Marchand <jmarchan@redhat.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Dave Hansen <dave.hansen@intel.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Rik van Riel <riel@redhat.com>
Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Cc: Steve Capper <steve.capper@linaro.org>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@suse.cz>
Cc: Christoph Lameter <cl@linux.com>
Cc: David Rientjes <rientjes@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/sh')
-rw-r--r-- | arch/sh/mm/cache-sh4.c | 2 | ||||
-rw-r--r-- | arch/sh/mm/cache.c | 8 |
2 files changed, 5 insertions, 5 deletions
diff --git a/arch/sh/mm/cache-sh4.c b/arch/sh/mm/cache-sh4.c index 51d8f7f31d1d..58aaa4f33b81 100644 --- a/arch/sh/mm/cache-sh4.c +++ b/arch/sh/mm/cache-sh4.c | |||
@@ -241,7 +241,7 @@ static void sh4_flush_cache_page(void *args) | |||
241 | */ | 241 | */ |
242 | map_coherent = (current_cpu_data.dcache.n_aliases && | 242 | map_coherent = (current_cpu_data.dcache.n_aliases && |
243 | test_bit(PG_dcache_clean, &page->flags) && | 243 | test_bit(PG_dcache_clean, &page->flags) && |
244 | page_mapped(page)); | 244 | page_mapcount(page)); |
245 | if (map_coherent) | 245 | if (map_coherent) |
246 | vaddr = kmap_coherent(page, address); | 246 | vaddr = kmap_coherent(page, address); |
247 | else | 247 | else |
diff --git a/arch/sh/mm/cache.c b/arch/sh/mm/cache.c index f770e3992620..e58cfbf45150 100644 --- a/arch/sh/mm/cache.c +++ b/arch/sh/mm/cache.c | |||
@@ -59,7 +59,7 @@ void copy_to_user_page(struct vm_area_struct *vma, struct page *page, | |||
59 | unsigned long vaddr, void *dst, const void *src, | 59 | unsigned long vaddr, void *dst, const void *src, |
60 | unsigned long len) | 60 | unsigned long len) |
61 | { | 61 | { |
62 | if (boot_cpu_data.dcache.n_aliases && page_mapped(page) && | 62 | if (boot_cpu_data.dcache.n_aliases && page_mapcount(page) && |
63 | test_bit(PG_dcache_clean, &page->flags)) { | 63 | test_bit(PG_dcache_clean, &page->flags)) { |
64 | void *vto = kmap_coherent(page, vaddr) + (vaddr & ~PAGE_MASK); | 64 | void *vto = kmap_coherent(page, vaddr) + (vaddr & ~PAGE_MASK); |
65 | memcpy(vto, src, len); | 65 | memcpy(vto, src, len); |
@@ -78,7 +78,7 @@ void copy_from_user_page(struct vm_area_struct *vma, struct page *page, | |||
78 | unsigned long vaddr, void *dst, const void *src, | 78 | unsigned long vaddr, void *dst, const void *src, |
79 | unsigned long len) | 79 | unsigned long len) |
80 | { | 80 | { |
81 | if (boot_cpu_data.dcache.n_aliases && page_mapped(page) && | 81 | if (boot_cpu_data.dcache.n_aliases && page_mapcount(page) && |
82 | test_bit(PG_dcache_clean, &page->flags)) { | 82 | test_bit(PG_dcache_clean, &page->flags)) { |
83 | void *vfrom = kmap_coherent(page, vaddr) + (vaddr & ~PAGE_MASK); | 83 | void *vfrom = kmap_coherent(page, vaddr) + (vaddr & ~PAGE_MASK); |
84 | memcpy(dst, vfrom, len); | 84 | memcpy(dst, vfrom, len); |
@@ -97,7 +97,7 @@ void copy_user_highpage(struct page *to, struct page *from, | |||
97 | 97 | ||
98 | vto = kmap_atomic(to); | 98 | vto = kmap_atomic(to); |
99 | 99 | ||
100 | if (boot_cpu_data.dcache.n_aliases && page_mapped(from) && | 100 | if (boot_cpu_data.dcache.n_aliases && page_mapcount(from) && |
101 | test_bit(PG_dcache_clean, &from->flags)) { | 101 | test_bit(PG_dcache_clean, &from->flags)) { |
102 | vfrom = kmap_coherent(from, vaddr); | 102 | vfrom = kmap_coherent(from, vaddr); |
103 | copy_page(vto, vfrom); | 103 | copy_page(vto, vfrom); |
@@ -153,7 +153,7 @@ void __flush_anon_page(struct page *page, unsigned long vmaddr) | |||
153 | unsigned long addr = (unsigned long) page_address(page); | 153 | unsigned long addr = (unsigned long) page_address(page); |
154 | 154 | ||
155 | if (pages_do_alias(addr, vmaddr)) { | 155 | if (pages_do_alias(addr, vmaddr)) { |
156 | if (boot_cpu_data.dcache.n_aliases && page_mapped(page) && | 156 | if (boot_cpu_data.dcache.n_aliases && page_mapcount(page) && |
157 | test_bit(PG_dcache_clean, &page->flags)) { | 157 | test_bit(PG_dcache_clean, &page->flags)) { |
158 | void *kaddr; | 158 | void *kaddr; |
159 | 159 | ||