All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC 0/3] mm, slab, slub: remove cpu and memory hotplug locks
@ 2021-01-06 17:40 Vlastimil Babka
  2021-01-06 17:40 ` [RFC 1/3] mm, slab, slub: stop taking memory hotplug lock Vlastimil Babka
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Vlastimil Babka @ 2021-01-06 17:40 UTC (permalink / raw)
  To: linux-mm
  Cc: linux-kernel, Christoph Lameter, Pekka Enberg, David Rientjes,
	Joonsoo Kim, Vladimir Davydov, Qian Cai, David Hildenbrand,
	Michal Hocko, Vlastimil Babka

Hi,

some related work caused me to look at how we use get/put_mems_online() and
get/put_online_cpus() during kmem cache creation/descruction/shrinking, and
realize that it should be actually safe to remove all of that with rather small
effort (as e.g. Michal Hocko suspected in some of the past discussions
already). This has the benefit to avoid rather heavy locks that have caused
locking order issues already in the past. So this is the result, Patches 1 and
2 remove memory hotplug and cpu hotplug locking, respectively. Patch 3 is due
to realization that in fact some races exist despite the locks (even if not
removed), but the most sane solution is not to introduce more of them, but
rather accept some wasted memory in scenarios that should be rare anyway (full
memory hot remove), as we do the same in other contexts already. It's all RFC
for now, as I might have missed some reason why it's not safe.

Vlastimil Babka (3):
  mm, slab, slub: stop taking memory hotplug lock
  mm, slab, slub: stop taking cpu hotplug lock
  mm, slub: stop freeing kmem_cache_node structures on node offline

 mm/slab_common.c | 20 ++++--------------
 mm/slub.c        | 54 ++++++++++++++++++++++++++++++++----------------
 2 files changed, 40 insertions(+), 34 deletions(-)

-- 
2.29.2


^ permalink raw reply	[flat|nested] 9+ messages in thread
* Re: [RFC 3/3] mm, slub: stop freeing kmem_cache_node structures on node offline
@ 2021-01-07  0:44 kernel test robot
  0 siblings, 0 replies; 9+ messages in thread
From: kernel test robot @ 2021-01-07  0:44 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 4026 bytes --]

CC: kbuild-all(a)lists.01.org
In-Reply-To: <20210106174029.12654-4-vbabka@suse.cz>
References: <20210106174029.12654-4-vbabka@suse.cz>
TO: Vlastimil Babka <vbabka@suse.cz>

Hi Vlastimil,

[FYI, it's a private test report for your RFC patch.]
[auto build test WARNING on linux/master]
[also build test WARNING on linus/master hnaz-linux-mm/master v5.11-rc2 next-20210104]
[cannot apply to mmotm/master]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Vlastimil-Babka/mm-slab-slub-remove-cpu-and-memory-hotplug-locks/20210107-014224
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 09162bc32c880a791c6c0668ce0745cf7958f576
:::::: branch date: 7 hours ago
:::::: commit date: 7 hours ago
compiler: c6x-elf-gcc (GCC) 9.3.0

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


cppcheck possible warnings: (new ones prefixed by >>, may not real problems)

>> mm/slub.c:4223:26: warning: Unused variable: n [unusedVariable]
    struct kmem_cache_node *n;
                            ^
>> mm/slub.c:4224:21: warning: Unused variable: s [unusedVariable]
    struct kmem_cache *s;
                       ^
   mm/slub.c:5581:4: warning: Either the condition '!name' is redundant or there is pointer arithmetic with NULL pointer. [nullPointerArithmeticRedundantCheck]
    *p++ = ':';
      ^
   mm/slub.c:5579:9: note: Assuming that condition '!name' is not redundant
    BUG_ON(!name);
           ^
   mm/slub.c:5577:12: note: Assignment 'p=name', assigned value is 0
    char *p = name;
              ^
   mm/slub.c:5581:4: note: Null pointer addition
    *p++ = ':';
      ^

vim +4223 mm/slub.c

b9049e234401e1 Yasunori Goto     2007-10-21  4220  
b9049e234401e1 Yasunori Goto     2007-10-21  4221  static void slab_mem_offline_callback(void *arg)
b9049e234401e1 Yasunori Goto     2007-10-21  4222  {
b9049e234401e1 Yasunori Goto     2007-10-21 @4223  	struct kmem_cache_node *n;
b9049e234401e1 Yasunori Goto     2007-10-21 @4224  	struct kmem_cache *s;
b9049e234401e1 Yasunori Goto     2007-10-21  4225  	struct memory_notify *marg = arg;
b9049e234401e1 Yasunori Goto     2007-10-21  4226  	int offline_node;
b9049e234401e1 Yasunori Goto     2007-10-21  4227  
b9d5ab2562ecee Lai Jiangshan     2012-12-11  4228  	offline_node = marg->status_change_nid_normal;
b9049e234401e1 Yasunori Goto     2007-10-21  4229  
b9049e234401e1 Yasunori Goto     2007-10-21  4230  	/*
b9049e234401e1 Yasunori Goto     2007-10-21  4231  	 * If the node still has available memory. we need kmem_cache_node
b9049e234401e1 Yasunori Goto     2007-10-21  4232  	 * for it yet.
b9049e234401e1 Yasunori Goto     2007-10-21  4233  	 */
b9049e234401e1 Yasunori Goto     2007-10-21  4234  	if (offline_node < 0)
b9049e234401e1 Yasunori Goto     2007-10-21  4235  		return;
b9049e234401e1 Yasunori Goto     2007-10-21  4236  
18004c5d4084d9 Christoph Lameter 2012-07-06  4237  	mutex_lock(&slab_mutex);
27153f04e4a5f9 Vlastimil Babka   2021-01-06  4238  	node_clear(offline_node, slab_nodes);
b9049e234401e1 Yasunori Goto     2007-10-21  4239  	/*
9d5e878e997461 Vlastimil Babka   2021-01-06  4240  	 * We no longer free kmem_cache_node structures here, as it would be
9d5e878e997461 Vlastimil Babka   2021-01-06  4241  	 * racy with all get_node() users, and infeasible to protect them with
9d5e878e997461 Vlastimil Babka   2021-01-06  4242  	 * slab_mutex.
b9049e234401e1 Yasunori Goto     2007-10-21  4243  	 */
18004c5d4084d9 Christoph Lameter 2012-07-06  4244  	mutex_unlock(&slab_mutex);
b9049e234401e1 Yasunori Goto     2007-10-21  4245  }
b9049e234401e1 Yasunori Goto     2007-10-21  4246  

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-01-11 17:56 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-06 17:40 [RFC 0/3] mm, slab, slub: remove cpu and memory hotplug locks Vlastimil Babka
2021-01-06 17:40 ` [RFC 1/3] mm, slab, slub: stop taking memory hotplug lock Vlastimil Babka
2021-01-06 17:40 ` [RFC 2/3] mm, slab, slub: stop taking cpu " Vlastimil Babka
2021-01-06 17:40 ` [RFC 3/3] mm, slub: stop freeing kmem_cache_node structures on node offline Vlastimil Babka
2021-01-07  0:49   ` kernel test robot
2021-01-06 19:09 ` [RFC 0/3] mm, slab, slub: remove cpu and memory hotplug locks Christoph Lameter
2021-01-06 19:09   ` Christoph Lameter
2021-01-11 17:55   ` Vlastimil Babka
2021-01-07  0:44 [RFC 3/3] mm, slub: stop freeing kmem_cache_node structures on node offline kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.