From: Vladimir Davydov <vdavydov@parallels.com>
To: akpm@linux-foundation.org
Cc: cl@linux-foundation.org, penberg@kernel.org,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
devel@openvz.org
Subject: [PATCH -mm v2 0/2] slab: cleanup mem hotplug synchronization
Date: Mon, 7 Apr 2014 13:45:33 +0400 [thread overview]
Message-ID: <cover.1396857765.git.vdavydov@parallels.com> (raw)
Hi,
kmem_cache_{create,destroy,shrink} need to get a stable value of
cpu/node online mask, because they init/destroy/access per-cpu/node
kmem_cache parts, which can be allocated or destroyed on cpu/mem
hotplug. To protect against cpu hotplug, these functions use
{get,put}_online_cpus. However, they do nothing to synchronize with
memory hotplug - taking the slab_mutex does not eliminate the
possibility of race as described in patch 2.
What we need there is something like get_online_cpus, but for memory. We
already have lock_memory_hotplug, which serves for the purpose, but it's
a bit of a hammer right now, because it's backed by a mutex. As a
result, it imposes some limitations to locking order, which are not
desirable, and can't be used just like get_online_cpus. That's why in
patch 1 I substitute it with get/put_online_mems, which work exactly
like get/put_online_cpus except they block not cpu, but memory hotplug.
[ v1 can be found at https://lkml.org/lkml/2014/4/6/68. I NAK'ed it by
myself, because it used an rw semaphore for get/put_online_mems, making
them dead lock prune. ]
Thanks,
Vladimir Davydov (2):
mem-hotplug: implement get/put_online_mems
slab: lock_memory_hotplug for kmem_cache_{create,destroy,shrink}
include/linux/memory_hotplug.h | 14 ++--
include/linux/mmzone.h | 8 +--
mm/kmemleak.c | 4 +-
mm/memory-failure.c | 8 +--
mm/memory_hotplug.c | 142 ++++++++++++++++++++++++++++------------
mm/slab.c | 26 +-------
mm/slab.h | 1 +
mm/slab_common.c | 35 +++++++++-
mm/slob.c | 3 +-
mm/slub.c | 9 ++-
mm/vmscan.c | 2 +-
11 files changed, 155 insertions(+), 97 deletions(-)
--
1.7.10.4
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
WARNING: multiple messages have this Message-ID (diff)
From: Vladimir Davydov <vdavydov@parallels.com>
To: <akpm@linux-foundation.org>
Cc: <cl@linux-foundation.org>, <penberg@kernel.org>,
<linux-kernel@vger.kernel.org>, <linux-mm@kvack.org>,
<devel@openvz.org>
Subject: [PATCH -mm v2 0/2] slab: cleanup mem hotplug synchronization
Date: Mon, 7 Apr 2014 13:45:33 +0400 [thread overview]
Message-ID: <cover.1396857765.git.vdavydov@parallels.com> (raw)
Hi,
kmem_cache_{create,destroy,shrink} need to get a stable value of
cpu/node online mask, because they init/destroy/access per-cpu/node
kmem_cache parts, which can be allocated or destroyed on cpu/mem
hotplug. To protect against cpu hotplug, these functions use
{get,put}_online_cpus. However, they do nothing to synchronize with
memory hotplug - taking the slab_mutex does not eliminate the
possibility of race as described in patch 2.
What we need there is something like get_online_cpus, but for memory. We
already have lock_memory_hotplug, which serves for the purpose, but it's
a bit of a hammer right now, because it's backed by a mutex. As a
result, it imposes some limitations to locking order, which are not
desirable, and can't be used just like get_online_cpus. That's why in
patch 1 I substitute it with get/put_online_mems, which work exactly
like get/put_online_cpus except they block not cpu, but memory hotplug.
[ v1 can be found at https://lkml.org/lkml/2014/4/6/68. I NAK'ed it by
myself, because it used an rw semaphore for get/put_online_mems, making
them dead lock prune. ]
Thanks,
Vladimir Davydov (2):
mem-hotplug: implement get/put_online_mems
slab: lock_memory_hotplug for kmem_cache_{create,destroy,shrink}
include/linux/memory_hotplug.h | 14 ++--
include/linux/mmzone.h | 8 +--
mm/kmemleak.c | 4 +-
mm/memory-failure.c | 8 +--
mm/memory_hotplug.c | 142 ++++++++++++++++++++++++++++------------
mm/slab.c | 26 +-------
mm/slab.h | 1 +
mm/slab_common.c | 35 +++++++++-
mm/slob.c | 3 +-
mm/slub.c | 9 ++-
mm/vmscan.c | 2 +-
11 files changed, 155 insertions(+), 97 deletions(-)
--
1.7.10.4
next reply other threads:[~2014-04-07 9:45 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-07 9:45 Vladimir Davydov [this message]
2014-04-07 9:45 ` [PATCH -mm v2 0/2] slab: cleanup mem hotplug synchronization Vladimir Davydov
2014-04-07 9:45 ` [PATCH -mm v2 1/2] mem-hotplug: implement get/put_online_mems Vladimir Davydov
2014-04-07 9:45 ` Vladimir Davydov
2014-04-18 20:18 ` Andrew Morton
2014-04-07 9:45 ` [PATCH -mm v2 2/2] slab: get_online_mems for kmem_cache_{create,destroy,shrink} Vladimir Davydov
2014-04-07 9:45 ` Vladimir Davydov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cover.1396857765.git.vdavydov@parallels.com \
--to=vdavydov@parallels.com \
--cc=akpm@linux-foundation.org \
--cc=cl@linux-foundation.org \
--cc=devel@openvz.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=penberg@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.