]> 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, 22 May 2014 00:42:39 +0000 (10:42 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Thu, 22 May 2014 00:42:39 +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 6f04bcd51a4ebd86495f621e8b650817ef1f34ed..3510155057a226c361456dcddb547b0482644278 100644 (file)
@@ -316,10 +316,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);
 }
 
@@ -329,7 +341,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 6b1f77b635c22bfc0911414057e8778e33085787..ea42b584661a1c556c55a1a9a65a9b27b44848ca 100644 (file)
@@ -766,11 +766,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 3715443f550dbf1c9df192b37ae44941649b2dbf..5a6a5aa2b73d6f9e9935f072d1115ff1c49d1a67 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 == current) {
                si.si_code = BUS_MCEERR_AR;
index 9916787c1843952526fb23400ec8813cfe8bb668..79f21809a9ecf8b7fd0855fe60ddcb6508479aed 100644 (file)
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -1646,7 +1646,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;