Skip to contentSkip to conversation

hugetlbfs: fix build failure on 64-bit x86

PATCH In review Ingo Molnar 2 participants 3 messages Jul 26, 2008

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

PATCH 1/1 hugetlbfs: fix build failure on 64-bit x86

[resend, still relevant to -git]

Quoted 1 line

From 5215af24a20e5f448ee45cd1d97c4118b876c0f6 Mon Sep 17 00:00:00 2001

From: Ingo Molnar <[email protected]>
Date: Fri, 25 Jul 2008 20:45:52 +0200
Subject: [PATCH] hugetlbfs: fix build failure on 64-bit x86

fix:

arch/x86/mm/built-in.o: In function `setup_hugepagesz':
hugetlbpage.c:(.init.text+0xb49): undefined reference to `hugetlb_add_hstate'

---
 arch/x86/mm/hugetlbpage.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/mm/hugetlbpage.c +1 -1
index 8f307d9..977d185 100644
@@ -425,7 +425,7 @@ hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
 
 #endif /*HAVE_ARCH_HUGETLB_UNMAPPED_AREA*/
 
-#ifdef CONFIG_X86_64
+#if defined(CONFIG_X86_64) && defined(CONFIG_SYSCTL)
 static __init int setup_hugepagesz(char *opt)
 {
 	unsigned long ps = memparse(opt, &opt);
maintainer
#1 lore raw
Quoted 23 lines · On Sat, 26 Jul 2008 11:16:54 +0200 Ingo Molnar <[email protected]> wrote:

[resend, still relevant to -git]

Quoted 1 line

From 5215af24a20e5f448ee45cd1d97c4118b876c0f6 Mon Sep 17 00:00:00 2001

From: Ingo Molnar <[email protected]>
Date: Fri, 25 Jul 2008 20:45:52 +0200
Subject: [PATCH] hugetlbfs: fix build failure on 64-bit x86

fix:

arch/x86/mm/built-in.o: In function `setup_hugepagesz':
hugetlbpage.c:(.init.text+0xb49): undefined reference to `hugetlb_add_hstate'

---
 arch/x86/mm/hugetlbpage.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/mm/hugetlbpage.c +0 -0
index 8f307d9..977d185 100644

arch/x86/mm/hugetlbpage.c hugetlb_get_unmapped_area(struct file *file, unsigned long addr, · line 431

Quoted 8 lines
arch/x86/mm/hugetlbpage.c +1 -1
@@ -425,7 +425,7 @@ hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
 
 #endif /*HAVE_ARCH_HUGETLB_UNMAPPED_AREA*/
 
-#ifdef CONFIG_X86_64
+#if defined(CONFIG_X86_64) && defined(CONFIG_SYSCTL)
 static __init int setup_hugepagesz(char *opt)
 {
 	unsigned long ps = memparse(opt, &opt);

Seems wrong that a __setup handler would vanish if CONFIG_SYSCTL=n.

I think Nishanth's patch (sent to Linus a few hours ago) fixes this correctly, by making hugetlb_add_hstate available if CONFIG_SYSCTL=n:

From: Nishanth Aravamudan <[email protected]>

Fixes a build failure reported by Alan Cox:

mm/hugetlb.c: In function `hugetlb_acct_memory': mm/hugetlb.c:1507:
error: implicit declaration of function `cpuset_mems_nr'

Also reverts Ingo's

commit e44d1b2998d62a1f2f4d7eb17b56ba396535509f
Author: Ingo Molnar <[email protected]>
Date: Fri Jul 25 12:57:41 2008 +0200

mm/hugetlb.c: fix build failure with !CONFIG_SYSCTL

which fixed the build error but added some unused-static-function warnings.

---

 mm/hugetlb.c |   24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)
mm/hugetlb.c renamed from mm/hugetlb.c~hugetlb-fix-config_sysctl=n-build +12 -12
diff -puN mm/hugetlb.c~hugetlb-fix-config_sysctl=n-build mm/hugetlb.c
@@ -1026,18 +1026,6 @@ static void __init report_hugepages(void
 	}
 }
 
-static unsigned int cpuset_mems_nr(unsigned int *array)
-{
-	int node;
-	unsigned int nr = 0;
-
-	for_each_node_mask(node, cpuset_current_mems_allowed)
-		nr += array[node];
-
-	return nr;
-}
-
-#ifdef CONFIG_SYSCTL
 #ifdef CONFIG_HIGHMEM
 static void try_to_free_low(struct hstate *h, unsigned long count)
 {
@@ -1386,6 +1374,18 @@ static int __init hugetlb_default_setup(
 }
 __setup("default_hugepagesz=", hugetlb_default_setup);
 
+static unsigned int cpuset_mems_nr(unsigned int *array)
+{
+	int node;
+	unsigned int nr = 0;
+
+	for_each_node_mask(node, cpuset_current_mems_allowed)
+		nr += array[node];
+
+	return nr;
+}
+
+#ifdef CONFIG_SYSCTL
 int hugetlb_sysctl_handler(struct ctl_table *table, int write,
 			   struct file *file, void __user *buffer,
 			   size_t *length, loff_t *ppos)

_

author Acked-by
#2 lore raw
Quoted 36 lines · Andrew Morton
Quoted 23 lines · On Sat, 26 Jul 2008 11:16:54 +0200 Ingo Molnar <[email protected]> wrote:

[resend, still relevant to -git]

Quoted 1 line

From 5215af24a20e5f448ee45cd1d97c4118b876c0f6 Mon Sep 17 00:00:00 2001

From: Ingo Molnar <[email protected]>
Date: Fri, 25 Jul 2008 20:45:52 +0200
Subject: [PATCH] hugetlbfs: fix build failure on 64-bit x86

fix:

arch/x86/mm/built-in.o: In function `setup_hugepagesz':
hugetlbpage.c:(.init.text+0xb49): undefined reference to `hugetlb_add_hstate'

---
 arch/x86/mm/hugetlbpage.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/mm/hugetlbpage.c +0 -0
index 8f307d9..977d185 100644

arch/x86/mm/hugetlbpage.c hugetlb_get_unmapped_area(struct file *file, unsigned long addr, · line 431

Quoted 8 lines
arch/x86/mm/hugetlbpage.c +1 -1
@@ -425,7 +425,7 @@ hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
 
 #endif /*HAVE_ARCH_HUGETLB_UNMAPPED_AREA*/
 
-#ifdef CONFIG_X86_64
+#if defined(CONFIG_X86_64) && defined(CONFIG_SYSCTL)
 static __init int setup_hugepagesz(char *opt)
 {
 	unsigned long ps = memparse(opt, &opt);

Seems wrong that a __setup handler would vanish if CONFIG_SYSCTL=n.

Quoted 2 lines

I think Nishanth's patch (sent to Linus a few hours ago) fixes this correctly, by making hugetlb_add_hstate available if CONFIG_SYSCTL=n:

agreed, that's cleaner/better.

Quoted 6 lines

From: Nishanth Aravamudan <[email protected]>

Fixes a build failure reported by Alan Cox:

mm/hugetlb.c: In function `hugetlb_acct_memory': mm/hugetlb.c:1507:
error: implicit declaration of function `cpuset_mems_nr'

Ingo