Skip to contentSkip to conversation

rename and extend check_valid_hugepage_range()

PATCH In review David Gibson 1 participant 2 messages May 19, 2003 – May 22, 2003

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rename and extend check_valid_hugepage_range()

Linus, please apply:

check_valid_hugepage_range() is a terrible name, because what it's actually used to check is whether a range is invalid for normal pages, rather than whether it's valid for hugepages. It returns 0 (i.e. normal pages are ok) uniformly on all existing hugepage implementations. The patch below renames it to "is_hugepage_only_range()".

Due to segment insanity, we'll need to override this function for the ppc64 implementation of hugetlbfs which I'm working on. However, we'll need access to the mm_struct to do it. This patch also adds that.

include/linux/hugetlb.h +3 -3
diff -urN linux-congo/include/linux/hugetlb.h linux-hugepage/include/linux/hugetlb.h
@@ -37,8 +37,8 @@
 		mm->used_hugetlb = 1;
 }
 
-#ifndef ARCH_HAS_VALID_HUGEPAGE_RANGE
-#define check_valid_hugepage_range(addr, len)	0
+#ifndef ARCH_HAS_HUGEPAGE_ONLY_RANGE
+#define is_hugepage_only_range(mm, addr, len)	0
 #endif
 
 #else /* !CONFIG_HUGETLB_PAGE */
@@ -62,7 +62,7 @@
 #define follow_huge_pmd(mm, addr, pmd, write)	0
 #define is_aligned_hugepage_range(addr, len)	0
 #define pmd_huge(x)	0
-#define check_valid_hugepage_range(addr, len)	0
+#define is_hugepage_only_range(mm, addr, len)	0
 
 #ifndef HPAGE_MASK
 #define HPAGE_MASK	0		/* Keep the compiler happy */
mm/mmap.c +1 -1
diff -urN linux-congo/mm/mmap.c linux-hugepage/mm/mmap.c
@@ -829,7 +829,7 @@
 			 * reserved hugepage range.  For some archs like IA-64,
 			 * there is a separate region for hugepages.
 			 */
-			ret = check_valid_hugepage_range(addr, len);
+			ret = is_hugepage_only_range(mm, addr, len);
 		}
 		if (ret)
 			return ret;
Signature · 4 lines
David Gibson			| For every complex problem there is a
[email protected]	| solution which is simple, neat and
				| wrong.
http://www.ozlabs.org/people/dgibson
#1 lore raw
Quoted 9 lines · David Gibson

Linus, please apply:

check_valid_hugepage_range() is a terrible name, because what it's actually used to check is whether a range is invalid for normal pages, rather than whether it's valid for hugepages. It returns 0 (i.e. normal pages are ok) uniformly on all existing hugepage implementations. The patch below renames it to "is_hugepage_only_range()".

Quoted 4 lines

Due to segment insanity, we'll need to override this function for the ppc64 implementation of hugetlbfs which I'm working on. However, we'll need access to the mm_struct to do it. This patch also adds that.

Ahem. Except that it was of course, totally broken. And it turns out we don't need the mm, or rather that the approach requiring the mm is insanely hairy.

But the name is still terrible, saner patch below. I'll go put my black star on now.

include/linux/hugetlb.h +3 -3
diff -urN linux-congo/include/linux/hugetlb.h linux-hugepage/include/linux/hugetlb.h
@@ -37,8 +37,8 @@
 		mm->used_hugetlb = 1;
 }
 
-#ifndef ARCH_HAS_VALID_HUGEPAGE_RANGE
-#define check_valid_hugepage_range(addr, len)	0
+#ifndef ARCH_HAS_HUGEPAGE_ONLY_RANGE
+#define is_hugepage_only_range(addr, len)	0
 #endif
 
 #else /* !CONFIG_HUGETLB_PAGE */
@@ -62,7 +62,7 @@
 #define follow_huge_pmd(mm, addr, pmd, write)	0
 #define is_aligned_hugepage_range(addr, len)	0
 #define pmd_huge(x)	0
-#define check_valid_hugepage_range(addr, len)	0
+#define is_hugepage_only_range(addr, len)	0
 
 #ifndef HPAGE_MASK
 #define HPAGE_MASK	0		/* Keep the compiler happy */
mm/mmap.c +1 -1
diff -urN linux-congo/mm/mmap.c linux-hugepage/mm/mmap.c
@@ -829,7 +829,7 @@
 			 * reserved hugepage range.  For some archs like IA-64,
 			 * there is a separate region for hugepages.
 			 */
-			ret = check_valid_hugepage_range(addr, len);
+			ret = is_hugepage_only_range(addr, len);
 		}
 		if (ret)
 			return ret;
Signature · 4 lines
David Gibson			| For every complex problem there is a
[email protected]	| solution which is simple, neat and
				| wrong.
http://www.ozlabs.org/people/dgibson