diff mbox series

[v2,4/4] powerpc/numa: Set fallback nodes for offline nodes

Message ID 20200318072810.9735-5-srikar@linux.vnet.ibm.com (mailing list archive)
State New, archived
Headers show
Series Fix kmalloc_node on offline nodes | expand

Commit Message

Srikar Dronamraju March 18, 2020, 7:28 a.m. UTC
Currently fallback nodes for offline nodes aren't set. Hence by default
node 0 ends up being the default node. However node 0 might be offline.

Fix this by explicitly setting fallback node. Ensure first_memory_node
is set before kernel does explicit setting of fallback node.

Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm@kvack.org
Cc: Mel Gorman <mgorman@suse.de>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Sachin Sant <sachinp@linux.vnet.ibm.com>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Christopher Lameter <cl@linux.com>
Cc: linuxppc-dev@lists.ozlabs.org
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Kirill Tkhai <ktkhai@virtuozzo.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Cc: Bharata B Rao <bharata@linux.ibm.com>
Cc: Nathan Lynch <nathanl@linux.ibm.com>

Reported-by: Sachin Sant <sachinp@linux.vnet.ibm.com>
Tested-by: Sachin Sant <sachinp@linux.vnet.ibm.com>
Signed-off-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
---
Changelog v1 -> v2:
- Handled comments from Bharata B Rao
	- Dont use dump_numa_cpu_topology to set fallback nodes

 arch/powerpc/include/asm/topology.h | 16 ++++++++++++++++
 arch/powerpc/kernel/smp.c           |  1 +
 2 files changed, 17 insertions(+)

Comments

kernel test robot March 18, 2020, 2:28 p.m. UTC | #1
Hi Srikar,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on powerpc/next]
[also build test WARNING on next-20200317]
[cannot apply to linus/master asm-generic/master mpe/next v5.6-rc6]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Srikar-Dronamraju/Fix-kmalloc_node-on-offline-nodes/20200318-180303
base:   https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
config: powerpc-motionpro_defconfig (attached as .config)
compiler: powerpc-linux-gcc (GCC) 9.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=9.2.0 make.cross ARCH=powerpc 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   In file included from include/linux/topology.h:36,
                    from include/linux/gfp.h:9,
                    from include/linux/mm.h:10,
                    from include/linux/bvec.h:13,
                    from include/linux/blk_types.h:10,
                    from include/linux/iomap.h:7,
                    from fs/iomap/trace.c:5:
   arch/powerpc/include/asm/topology.h: In function 'update_default_numa_mem':
>> arch/powerpc/include/asm/topology.h:108:1: warning: no return statement in function returning non-void [-Wreturn-type]
     108 | static inline int update_default_numa_mem(void) {}
         | ^~~~~~
--
   In file included from include/linux/topology.h:36,
                    from include/linux/gfp.h:9,
                    from include/linux/slab.h:15,
                    from include/linux/crypto.h:19,
                    from include/crypto/hash.h:11,
                    from include/linux/uio.h:10,
                    from include/linux/socket.h:8,
                    from include/linux/compat.h:15,
                    from arch/powerpc/kernel/asm-offsets.c:14:
   arch/powerpc/include/asm/topology.h: In function 'update_default_numa_mem':
>> arch/powerpc/include/asm/topology.h:108:1: warning: no return statement in function returning non-void [-Wreturn-type]
     108 | static inline int update_default_numa_mem(void) {}
         | ^~~~~~
   29 real  8 user  16 sys  85.32% cpu 	make prepare

vim +108 arch/powerpc/include/asm/topology.h

   107	
 > 108	static inline int update_default_numa_mem(void) {}
   109	#endif /* CONFIG_NUMA */
   110	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
kernel test robot March 18, 2020, 6:56 p.m. UTC | #2
Hi Srikar,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on powerpc/next]
[also build test ERROR on next-20200317]
[cannot apply to linus/master asm-generic/master mpe/next v5.6-rc6]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Srikar-Dronamraju/Fix-kmalloc_node-on-offline-nodes/20200318-180303
base:   https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
config: powerpc-defconfig (attached as .config)
compiler: powerpc64-linux-gcc (GCC) 9.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=9.2.0 make.cross ARCH=powerpc 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>

All error/warnings (new ones prefixed by >>):

   In file included from include/linux/topology.h:36,
                    from include/linux/gfp.h:9,
                    from include/linux/slab.h:15,
                    from include/linux/crypto.h:19,
                    from include/crypto/hash.h:11,
                    from include/linux/uio.h:10,
                    from include/linux/socket.h:8,
                    from include/linux/compat.h:15,
                    from arch/powerpc/kernel/asm-offsets.c:14:
   arch/powerpc/include/asm/topology.h: In function 'update_default_numa_mem':
>> arch/powerpc/include/asm/topology.h:77:4: error: implicit declaration of function 'reset_numa_mem' [-Werror=implicit-function-declaration]
      77 |    reset_numa_mem(node);
         |    ^~~~~~~~~~~~~~
   arch/powerpc/include/asm/topology.h:79:1: warning: no return statement in function returning non-void [-Wreturn-type]
      79 | }
         | ^
   In file included from include/linux/gfp.h:9,
                    from include/linux/slab.h:15,
                    from include/linux/crypto.h:19,
                    from include/crypto/hash.h:11,
                    from include/linux/uio.h:10,
                    from include/linux/socket.h:8,
                    from include/linux/compat.h:15,
                    from arch/powerpc/kernel/asm-offsets.c:14:
   include/linux/topology.h: At top level:
>> include/linux/topology.h:151:20: warning: conflicting types for 'reset_numa_mem'
     151 | static inline void reset_numa_mem(int node)
         |                    ^~~~~~~~~~~~~~
>> include/linux/topology.h:151:20: error: static declaration of 'reset_numa_mem' follows non-static declaration
   In file included from include/linux/topology.h:36,
                    from include/linux/gfp.h:9,
                    from include/linux/slab.h:15,
                    from include/linux/crypto.h:19,
                    from include/crypto/hash.h:11,
                    from include/linux/uio.h:10,
                    from include/linux/socket.h:8,
                    from include/linux/compat.h:15,
                    from arch/powerpc/kernel/asm-offsets.c:14:
   arch/powerpc/include/asm/topology.h:77:4: note: previous implicit declaration of 'reset_numa_mem' was here
      77 |    reset_numa_mem(node);
         |    ^~~~~~~~~~~~~~
   cc1: some warnings being treated as errors
   make[2]: *** [scripts/Makefile.build:101: arch/powerpc/kernel/asm-offsets.s] Error 1
   make[2]: Target '__build' not remade because of errors.
   make[1]: *** [Makefile:1112: prepare0] Error 2
   make[1]: Target 'prepare' not remade because of errors.
   make: *** [Makefile:179: sub-make] Error 2
   256 real  58 user  115 sys  67.93% cpu 	make prepare

vim +/reset_numa_mem +77 arch/powerpc/include/asm/topology.h

    65	
    66	static inline int update_default_numa_mem(void)
    67	{
    68		unsigned int node;
    69	
    70		for_each_node(node) {
    71			/*
    72			 * For all possible but not yet online nodes, ensure their
    73			 * node_numa_mem is set correctly so that kmalloc_node works
    74			 * for such nodes.
    75			 */
    76			if (!node_online(node))
  > 77				reset_numa_mem(node);
    78		}
    79	}
    80	#else
    81	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff mbox series

Patch

diff --git a/arch/powerpc/include/asm/topology.h b/arch/powerpc/include/asm/topology.h
index 2db7ba789720..baa89364197c 100644
--- a/arch/powerpc/include/asm/topology.h
+++ b/arch/powerpc/include/asm/topology.h
@@ -62,6 +62,21 @@  static inline int early_cpu_to_node(int cpu)
 	 */
 	return (nid < 0) ? 0 : nid;
 }
+
+static inline int update_default_numa_mem(void)
+{
+	unsigned int node;
+
+	for_each_node(node) {
+		/*
+		 * For all possible but not yet online nodes, ensure their
+		 * node_numa_mem is set correctly so that kmalloc_node works
+		 * for such nodes.
+		 */
+		if (!node_online(node))
+			reset_numa_mem(node);
+	}
+}
 #else
 
 static inline int early_cpu_to_node(int cpu) { return 0; }
@@ -90,6 +105,7 @@  static inline int cpu_distance(__be32 *cpu1_assoc, __be32 *cpu2_assoc)
 	return 0;
 }
 
+static inline int update_default_numa_mem(void) {}
 #endif /* CONFIG_NUMA */
 
 #if defined(CONFIG_NUMA) && defined(CONFIG_PPC_SPLPAR)
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index 37c12e3bab9e..d23faa70ea2d 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -1383,6 +1383,7 @@  void __init smp_cpus_done(unsigned int max_cpus)
 	if (smp_ops && smp_ops->bringup_done)
 		smp_ops->bringup_done();
 
+	update_default_numa_mem();
 	dump_numa_cpu_topology();
 
 #ifdef CONFIG_SCHED_SMT