linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [RFC] mm: Change the data type of huge page size from unsigned long to u64
@ 2016-09-13  9:26 Rui Teng
  2016-09-13  9:32 ` Kirill A. Shutemov
  0 siblings, 1 reply; 5+ messages in thread
From: Rui Teng @ 2016-09-13  9:26 UTC (permalink / raw)
  To: linux-kernel, linux-mm
  Cc: Andrew Morton, Michal Hocko, Naoya Horiguchi, Chen Gang,
	Kirill A . Shutemov, Vlastimil Babka, Aneesh Kumar K . V,
	hejianet, Rui Teng

The huge page size could be 16G(0x400000000) on ppc64 architecture, and it will
cause an overflow on unsigned long data type(0xFFFFFFFF).

For example, huge_page_size() will return 0, if the PAGE_SIZE is 65536 and
h->order is 18, which is the result on ppc64 with 16G huge page enabled.

I think it needs to change the data type from unsigned long to u64. But it will
cause a lot of functions and data structures changed. Any comments and
suggestions?

Thanks!

Signed-off-by: Rui Teng <rui.teng@linux.vnet.ibm.com>
---
 include/linux/hugetlb.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index c26d463..efbe5cf 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -374,9 +374,9 @@ static inline struct hstate *hstate_vma(struct vm_area_struct *vma)
 	return hstate_file(vma->vm_file);
 }
 
-static inline unsigned long huge_page_size(struct hstate *h)
+static inline u64 huge_page_size(struct hstate *h)
 {
-	return (unsigned long)PAGE_SIZE << h->order;
+	return (u64)PAGE_SIZE << h->order;
 }
 
 extern unsigned long vma_kernel_pagesize(struct vm_area_struct *vma);
-- 
2.7.4

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-09-13 13:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-13  9:26 [RFC] mm: Change the data type of huge page size from unsigned long to u64 Rui Teng
2016-09-13  9:32 ` Kirill A. Shutemov
2016-09-13 11:21   ` Rui Teng
2016-09-13 11:40     ` Kirill A. Shutemov
2016-09-13 13:08       ` Rui Teng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).