summaryrefslogtreecommitdiff
path: root/mm/hugetlb.c
diff options
context:
space:
mode:
authorAndrey Konovalov <andrey.konovalov@linaro.org>2013-07-17 22:48:19 +0400
committerAndrey Konovalov <andrey.konovalov@linaro.org>2013-07-17 22:48:19 +0400
commit3ca462b2813df4bd319588ca8a0112512f54ca24 (patch)
tree12403ffd4b5136ab3e3010ed1ff6846e6135cdbb /mm/hugetlb.c
parentdb26963ceff6f678070a50b4aac113b490aaa55a (diff)
parentcb5d8be972cfbea114ea56fd63ed5ce1644863df (diff)
Automatically merging tracking-linux-3.10.y into merge-linux-linarosamsung-linux-3.10-2013.07ll-20130717.0linux-linaro-3.10.1-2013.07
Conflicting files: kernel/futex.c
Diffstat (limited to 'mm/hugetlb.c')
-rw-r--r--mm/hugetlb.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index e2bfbf73a551..5cf99bf8cce2 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -690,6 +690,23 @@ int PageHuge(struct page *page)
}
EXPORT_SYMBOL_GPL(PageHuge);
+pgoff_t __basepage_index(struct page *page)
+{
+ struct page *page_head = compound_head(page);
+ pgoff_t index = page_index(page_head);
+ unsigned long compound_idx;
+
+ if (!PageHuge(page_head))
+ return page_index(page);
+
+ if (compound_order(page_head) >= MAX_ORDER)
+ compound_idx = page_to_pfn(page) - page_to_pfn(page_head);
+ else
+ compound_idx = page - page_head;
+
+ return (index << compound_order(page_head)) + compound_idx;
+}
+
static struct page *alloc_fresh_huge_page_node(struct hstate *h, int nid)
{
struct page *page;