Message ID | 20200320115533.9604-2-vbabka@suse.cz (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [1/2] mm, slub: prevent kmalloc_node crashes and memory leaks | expand |
* Vlastimil Babka <vbabka@suse.cz> [2020-03-20 12:55:33]: > This reverts commit ad2c8144418c6a81cefe65379fd47bbe8344cef2. > > The function node_to_mem_node() was introduced by that commit for use in SLUB > on systems with memoryless nodes, but it turned out to be unreliable on some > architectures/configurations and a simpler solution exists than fixing it up. > > Thus the previous commit "mm, slub: prevent kmalloc_node crashes and memory > leaks" removed the only user of node_to_mem_node() and we can revert the commit > that introduced it. > > Signed-off-by: Vlastimil Babka <vbabka@suse.cz> > Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com> Reviewed-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com> > --- > include/linux/topology.h | 17 ----------------- > mm/page_alloc.c | 1 - > 2 files changed, 18 deletions(-) > > diff --git a/include/linux/topology.h b/include/linux/topology.h > index eb2fe6edd73c..608fa4aadf0e 100644 > --- a/include/linux/topology.h > +++ b/include/linux/topology.h > @@ -130,20 +130,11 @@ static inline int numa_node_id(void) > * Use the accessor functions set_numa_mem(), numa_mem_id() and cpu_to_mem(). > */ > DECLARE_PER_CPU(int, _numa_mem_); > -extern int _node_numa_mem_[MAX_NUMNODES]; > > #ifndef set_numa_mem > static inline void set_numa_mem(int node) > { > this_cpu_write(_numa_mem_, node); > - _node_numa_mem_[numa_node_id()] = node; > -} > -#endif > - > -#ifndef node_to_mem_node > -static inline int node_to_mem_node(int node) > -{ > - return _node_numa_mem_[node]; > } > #endif > > @@ -166,7 +157,6 @@ static inline int cpu_to_mem(int cpu) > static inline void set_cpu_numa_mem(int cpu, int node) > { > per_cpu(_numa_mem_, cpu) = node; > - _node_numa_mem_[cpu_to_node(cpu)] = node; > } > #endif > > @@ -180,13 +170,6 @@ static inline int numa_mem_id(void) > } > #endif > > -#ifndef node_to_mem_node > -static inline int node_to_mem_node(int node) > -{ > - return node; > -} > -#endif > - > #ifndef cpu_to_mem > static inline int cpu_to_mem(int cpu) > { > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > index 3c4eb750a199..6e7e9c1d6caa 100644 > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -95,7 +95,6 @@ DEFINE_STATIC_KEY_TRUE(vm_numa_stat_key); > */ > DEFINE_PER_CPU(int, _numa_mem_); /* Kernel "local memory" node */ > EXPORT_PER_CPU_SYMBOL(_numa_mem_); > -int _node_numa_mem_[MAX_NUMNODES]; > #endif > > /* work_structs for global per-cpu drains */ > -- > 2.25.1 >
On 3/20/20 12:55 PM, Vlastimil Babka wrote: > This reverts commit ad2c8144418c6a81cefe65379fd47bbe8344cef2. > > The function node_to_mem_node() was introduced by that commit for use in SLUB > on systems with memoryless nodes, but it turned out to be unreliable on some > architectures/configurations and a simpler solution exists than fixing it up. > > Thus the previous commit "mm, slub: prevent kmalloc_node crashes and memory > leaks" removed the only user of node_to_mem_node() and we can revert the commit > that introduced it. Since the bugfix was fast-tracked to Linus, we can now reference it properly and replace the second paragraph with: Thus commit 0715e6c516f1 ("mm, slub: prevent kmalloc_node crashes and memory leaks") removed the only user of node_to_mem_node() and we can revert the commit that introduced the function.
On Tue, 24 Mar 2020 14:00:52 +0100 Vlastimil Babka <vbabka@suse.cz> wrote: > On 3/20/20 12:55 PM, Vlastimil Babka wrote: > > This reverts commit ad2c8144418c6a81cefe65379fd47bbe8344cef2. > > > > The function node_to_mem_node() was introduced by that commit for use in SLUB > > on systems with memoryless nodes, but it turned out to be unreliable on some > > architectures/configurations and a simpler solution exists than fixing it up. > > > > Thus the previous commit "mm, slub: prevent kmalloc_node crashes and memory > > leaks" removed the only user of node_to_mem_node() and we can revert the commit > > that introduced it. > > Since the bugfix was fast-tracked to Linus, we can now reference it properly and > replace the second paragraph with: > > Thus commit 0715e6c516f1 ("mm, slub: prevent kmalloc_node crashes and memory > leaks") removed the only user of node_to_mem_node() and we can revert the commit > that introduced the function. I updated the changelog, thanks.
diff --git a/include/linux/topology.h b/include/linux/topology.h index eb2fe6edd73c..608fa4aadf0e 100644 --- a/include/linux/topology.h +++ b/include/linux/topology.h @@ -130,20 +130,11 @@ static inline int numa_node_id(void) * Use the accessor functions set_numa_mem(), numa_mem_id() and cpu_to_mem(). */ DECLARE_PER_CPU(int, _numa_mem_); -extern int _node_numa_mem_[MAX_NUMNODES]; #ifndef set_numa_mem static inline void set_numa_mem(int node) { this_cpu_write(_numa_mem_, node); - _node_numa_mem_[numa_node_id()] = node; -} -#endif - -#ifndef node_to_mem_node -static inline int node_to_mem_node(int node) -{ - return _node_numa_mem_[node]; } #endif @@ -166,7 +157,6 @@ static inline int cpu_to_mem(int cpu) static inline void set_cpu_numa_mem(int cpu, int node) { per_cpu(_numa_mem_, cpu) = node; - _node_numa_mem_[cpu_to_node(cpu)] = node; } #endif @@ -180,13 +170,6 @@ static inline int numa_mem_id(void) } #endif -#ifndef node_to_mem_node -static inline int node_to_mem_node(int node) -{ - return node; -} -#endif - #ifndef cpu_to_mem static inline int cpu_to_mem(int cpu) { diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 3c4eb750a199..6e7e9c1d6caa 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -95,7 +95,6 @@ DEFINE_STATIC_KEY_TRUE(vm_numa_stat_key); */ DEFINE_PER_CPU(int, _numa_mem_); /* Kernel "local memory" node */ EXPORT_PER_CPU_SYMBOL(_numa_mem_); -int _node_numa_mem_[MAX_NUMNODES]; #endif /* work_structs for global per-cpu drains */
This reverts commit ad2c8144418c6a81cefe65379fd47bbe8344cef2. The function node_to_mem_node() was introduced by that commit for use in SLUB on systems with memoryless nodes, but it turned out to be unreliable on some architectures/configurations and a simpler solution exists than fixing it up. Thus the previous commit "mm, slub: prevent kmalloc_node crashes and memory leaks" removed the only user of node_to_mem_node() and we can revert the commit that introduced it. Signed-off-by: Vlastimil Babka <vbabka@suse.cz> Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com> --- include/linux/topology.h | 17 ----------------- mm/page_alloc.c | 1 - 2 files changed, 18 deletions(-)