Re: [Patch] mm: make CONFIG_NUMA depend on CONFIG_SYSFS

From: Cong Wang
Date: Tue Jul 19 2011 - 02:20:40 EST

ä 2011å07æ18æ 21:52, Mel Gorman åé:
On Mon, Jul 18, 2011 at 07:18:29PM +0800, Amerigo Wang wrote:
On ppc, we got this build error with randconfig:

drivers/built-in.o:(.toc1+0xf90): undefined reference to `vmstat_text': 1 errors in 1 logs

This is due to that it enabled CONFIG_NUMA but not CONFIG_SYSFS.

And the user-space tool numactl depends on sysfs files too.
So, I think it is very reasonable to make CONFIG_NUMA depend on CONFIG_SYSFS.

That looks a bit awful. There is no obvious connection between SYSFS
and NUMA. One is exporting information to userspace and the other is
the memory model. Without sysfs, NUMA support might be less useful
but the memory policies should still work and set_mempolicy() should
still be an option.

You didn't post where the buggy reference to vmstat_text but I'm
assuming it is in drivers/base/node.c . It would be preferable that
it be fixed to not reference vmstat_text unless either CONFIG_PROC_FS
or CONFIG_SYSFS is defined similar to what is in mm/vmstat.c .

Hmm, since we don't have to enable SYSFS for NUMA, how about
make a new Kconfig for drivers/base/node.c? I.e., CONFIG_NUMA_SYSFS,
like patch below.

Thanks. Introduce a new Kconfig CONFIG_NUMA_SYSFS for drivers/base/node.c
which just provides sysfs interface, so that when we select
CONFIG_NUMA, we don't have to enable the sysfs interface too.

This by the way fixes a randconfig build error when NUMA && !SYSFS.

Signed-off-by: WANG Cong <amwang@xxxxxxxxxx>

diff --git a/drivers/base/Makefile b/drivers/base/Makefile
index 4c5701c..f34abe6 100644
--- a/drivers/base/Makefile
+++ b/drivers/base/Makefile
@@ -10,7 +10,7 @@ obj-$(CONFIG_HAS_DMA) += dma-mapping.o
obj-$(CONFIG_HAVE_GENERIC_DMA_COHERENT) += dma-coherent.o
obj-$(CONFIG_ISA) += isa.o
obj-$(CONFIG_FW_LOADER) += firmware_class.o
-obj-$(CONFIG_NUMA) += node.o
+obj-$(CONFIG_NUMA_SYSFS) += node.o
obj-$(CONFIG_SMP) += topology.o
obj-$(CONFIG_IOMMU_API) += iommu.o
diff --git a/mm/Kconfig b/mm/Kconfig
index 8ca47a5..f89ab19 100644
--- a/mm/Kconfig
+++ b/mm/Kconfig
@@ -340,6 +340,16 @@ choice

+config NUMA_SYSFS
+ bool "Enable NUMA sysfs interface for user-space"
+ depends on NUMA
+ depends on SYSFS
+ default y
+ help
+ This enables NUMA sysfs interface, /sys/devices/system/node/,
+ for user-space tools, like numactl. If you have enabled NUMA,
+ probably you also need this one.
# UP and nommu archs use km based percpu allocator