]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
mm-hugetlbfs-fix-rmapping-for-anonymous-hugepages-with-page_pgoff-v3
authorNaoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Thu, 26 Jun 2014 00:42:35 +0000 (10:42 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Thu, 26 Jun 2014 00:42:35 +0000 (10:42 +1000)
- add comment on page_size_order()
- use compound_order(compound_head(page)) instead of huge_page_size_order()
- use page_pgoff() in rmap_walk_file() too
- use page_size_order() in kill_proc()
- fix space indent

Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Cc: Sasha Levin <sasha.levin@oracle.com>
Cc: Rik van Riel <riel@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
include/linux/hugetlb_inline.h
include/linux/pagemap.h
mm/hugetlb.c
mm/memory-failure.c
mm/rmap.c

index e939975f0cba3493739c77c3f9cd541abd6abd6b..4d60c82e9fda16e3364f3a7284a833683d761b24 100644 (file)
@@ -11,7 +11,6 @@ static inline int is_vm_hugetlb_page(struct vm_area_struct *vma)
 }
 
 int PageHuge(struct page *page);
-unsigned int huge_page_size_order(struct page *page);
 
 #else
 
@@ -25,11 +24,6 @@ static inline int PageHuge(struct page *page)
        return 0;
 }
 
-static inline unsigned int huge_page_size_order(struct page *page)
-{
-       return 0;
-}
-
 #endif
 
 #endif
index c337d2af6199830058c54ce284ba637a80c60ce3..54cb1eb98355797699369ce66c935c3978ab3a70 100644 (file)
@@ -411,10 +411,22 @@ static inline loff_t page_file_offset(struct page *page)
        return ((loff_t)page_file_index(page)) << PAGE_CACHE_SHIFT;
 }
 
+/*
+ * Getting page order of a given page in the context of the pagecache which
+ * each page belongs to.
+ *
+ * Pagecache unit size is not a fixed value (hugetlbfs is an example), but
+ * vma_interval_tree and anon_vma_internval_tree APIs assume that its indices
+ * are in PAGE_SIZE unit. So this routine helps us to get normalized indices.
+ *
+ * This page should be called only for pagecache pages/hugepages and anonymous
+ * pages/hugepages, because pagecache unit size is irrelevant except for those
+ * pages.
+ */
 static inline unsigned int page_size_order(struct page *page)
 {
        return unlikely(PageHuge(page)) ?
-               huge_page_size_order(page) :
+               compound_order(compound_head(page)) :
                (PAGE_CACHE_SHIFT - PAGE_SHIFT);
 }
 
@@ -424,7 +436,7 @@ static inline unsigned int page_size_order(struct page *page)
  */
 static inline pgoff_t page_pgoff(struct page *page)
 {
-        return page->index << page_size_order(page);
+       return page->index << page_size_order(page);
 }
 
 extern pgoff_t linear_hugepage_index(struct vm_area_struct *vma,
index cccec2b4c07319bdce21027aea63404bb5416f20..7faab717ba197d0bdda9dede7a5ec81dd512c796 100644 (file)
@@ -982,11 +982,6 @@ pgoff_t __basepage_index(struct page *page)
        return (index << compound_order(page_head)) + compound_idx;
 }
 
-unsigned int huge_page_size_order(struct page *page)
-{
-       return huge_page_order(page_hstate(page));
-}
-
 static struct page *alloc_fresh_huge_page_node(struct hstate *h, int nid)
 {
        struct page *page;
index d148b54f82a23ade323b0ad7b8ced179b5d2df1b..a7a89eb2f93519d7c1d2422ec801e7f77767eefc 100644 (file)
@@ -202,7 +202,7 @@ static int kill_proc(struct task_struct *t, unsigned long addr, int trapno,
 #ifdef __ARCH_SI_TRAPNO
        si.si_trapno = trapno;
 #endif
-       si.si_addr_lsb = compound_order(compound_head(page)) + PAGE_SHIFT;
+       si.si_addr_lsb = page_size_order(page) + PAGE_SHIFT;
 
        if ((flags & MF_ACTION_REQUIRED) && t->mm == current->mm) {
                si.si_code = BUS_MCEERR_AR;
index 672ee4cebe809aa873c1dabdfaa03cfcc2f11c78..e4c9f7856cd1e0332357bc50bd3f15b7543ed0aa 100644 (file)
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -1676,7 +1676,7 @@ static int rmap_walk_anon(struct page *page, struct rmap_walk_control *rwc)
 static int rmap_walk_file(struct page *page, struct rmap_walk_control *rwc)
 {
        struct address_space *mapping = page->mapping;
-       pgoff_t pgoff = page->index << compound_order(page);
+       pgoff_t pgoff = page_pgoff(page);
        struct vm_area_struct *vma;
        int ret = SWAP_AGAIN;