aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/hugetlb.h
diff options
context:
space:
mode:
authorAndi Kleen <ak@linux.intel.com>2010-10-06 15:45:00 -0400
committerAndi Kleen <ak@linux.intel.com>2010-10-08 03:32:46 -0400
commitaa50d3a7aa8147b9e14dc9d5972a5d2359db4ef8 (patch)
tree68fae5060333dcc24c17e9dd00a87bd760d883e9 /include/linux/hugetlb.h
parent6f39ce056ab2ab2d29b2fae4aed61ed0b485972f (diff)
Encode huge page size for VM_FAULT_HWPOISON errors
This fixes a problem introduced with the hugetlb hwpoison handling The user space SIGBUS signalling wants to know the size of the hugepage that caused a HWPOISON fault. Unfortunately the architecture page fault handlers do not have easy access to the struct page. Pass the information out in the fault error code instead. I added a separate VM_FAULT_HWPOISON_LARGE bit for this case and encode the hpage index in some free upper bits of the fault code. The small page hwpoison keeps stays with the VM_FAULT_HWPOISON name to minimize changes. Also add code to hugetlb.h to convert that index into a page shift. Will be used in a further patch. Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> Cc: fengguang.wu@intel.com Signed-off-by: Andi Kleen <ak@linux.intel.com>
Diffstat (limited to 'include/linux/hugetlb.h')
-rw-r--r--include/linux/hugetlb.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 796f30e00806..943c76b3d4bb 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -307,6 +307,11 @@ static inline struct hstate *page_hstate(struct page *page)
307 return size_to_hstate(PAGE_SIZE << compound_order(page)); 307 return size_to_hstate(PAGE_SIZE << compound_order(page));
308} 308}
309 309
310static inline unsigned hstate_index_to_shift(unsigned index)
311{
312 return hstates[index].order + PAGE_SHIFT;
313}
314
310#else 315#else
311struct hstate {}; 316struct hstate {};
312#define alloc_huge_page_node(h, nid) NULL 317#define alloc_huge_page_node(h, nid) NULL
@@ -324,6 +329,7 @@ static inline unsigned int pages_per_huge_page(struct hstate *h)
324{ 329{
325 return 1; 330 return 1;
326} 331}
332#define hstate_index_to_shift(index) 0
327#endif 333#endif
328 334
329#endif /* _LINUX_HUGETLB_H */ 335#endif /* _LINUX_HUGETLB_H */