Skip to contentSkip to conversation

mm: hugepage: make hstate_is_gigantic() inline

PATCH In review Arnd Bergmann 2 participants 2 messages May 22, 2017 HugeTLB

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mm: hugepage: make hstate_is_gigantic() inline

Ignoring the argument of both alloc_huge_page_node() and hstate_is_gigantic() causes a harmless warning:

mm/memory-failure.c: In function 'new_page':
mm/memory-failure.c:1493:18: error: unused variable 'hstate' [-Werror=unused-variable]

Turning one into an inline function makes the compiler see that the variable is not meant to be unused.

Fixes d81a077951f8 ("mm/madvise: enable (soft|hard) offline of HugeTLB pages at PGD level")
Fixes 39b80148ffd7 ("mm/follow_page_mask: add support for hugepage directory entry")
---
 include/linux/hugetlb.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
include/linux/hugetlb.h +5 -1
index 76b9ddcd8c3c..c92a1f0c7240 100644
@@ -532,7 +532,11 @@ struct hstate {};
 #define vma_mmu_pagesize(v) PAGE_SIZE
 #define huge_page_order(h) 0
 #define huge_page_shift(h) PAGE_SHIFT
-#define hstate_is_gigantic(h) 0
+static inline bool hstate_is_gigantic(struct hstate *h)
+{
+	return false;
+}
+
 static inline unsigned int pages_per_huge_page(struct hstate *h)
 {
 	return 1;
Signature · 1 line
2.9.0
#1 lore raw
Quoted 11 lines · Arnd Bergmann

Ignoring the argument of both alloc_huge_page_node() and hstate_is_gigantic() causes a harmless warning:

mm/memory-failure.c: In function 'new_page':
mm/memory-failure.c:1493:18: error: unused variable 'hstate' [-Werror=unused-variable]

Turning one into an inline function makes the compiler see that the variable is not meant to be unused.

Fixes d81a077951f8 ("mm/madvise: enable (soft|hard) offline of HugeTLB pages at PGD level")
Fixes 39b80148ffd7 ("mm/follow_page_mask: add support for hugepage directory entry")

Both these sha1 are unstable because they are in Andrew's mmotm tree and will change in future next trees. I would just drop them.

Quoted 1 line

the patch itself looks OK

Quoted 24 lines
---
 include/linux/hugetlb.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
include/linux/hugetlb.h +5 -1
index 76b9ddcd8c3c..c92a1f0c7240 100644
@@ -532,7 +532,11 @@ struct hstate {};
 #define vma_mmu_pagesize(v) PAGE_SIZE
 #define huge_page_order(h) 0
 #define huge_page_shift(h) PAGE_SHIFT
-#define hstate_is_gigantic(h) 0
+static inline bool hstate_is_gigantic(struct hstate *h)
+{
+	return false;
+}
+
 static inline unsigned int pages_per_huge_page(struct hstate *h)
 {
 	return 1;
Signature · 1 line
2.9.0
Signature · 2 lines
Michal Hocko
SUSE Labs