Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1738706
| From | "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH review for 4.9 24/50] slub: do not merge cache if slub_debug contains a never-merge flag |
| Date | 2017-09-25 03:40 +0200 |
| Message-ID | <utqxl-7O2-47@gated-at.bofh.it> (permalink) |
| References | <utqdY-7Fr-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Grygorii Maistrenko <grygoriimkd@gmail.com>
[ Upstream commit c6e28895a4372992961888ffaadc9efc643b5bfe ]
In case CONFIG_SLUB_DEBUG_ON=n, find_mergeable() gets debug features from
commandline but never checks if there are features from the
SLAB_NEVER_MERGE set.
As a result selected by slub_debug caches are always mergeable if they
have been created without a custom constructor set or without one of the
SLAB_* debug features on.
This moves the SLAB_NEVER_MERGE check below the flags update from
commandline to make sure it won't merge the slab cache if one of the debug
features is on.
Link: http://lkml.kernel.org/r/20170101124451.GA4740@lp-laptop-d
Signed-off-by: Grygorii Maistrenko <grygoriimkd@gmail.com>
Reviewed-by: Pekka Enberg <penberg@kernel.org>
Acked-by: David Rientjes <rientjes@google.com>
Acked-by: Christoph Lameter <cl@linux.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
---
mm/slab_common.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/mm/slab_common.c b/mm/slab_common.c
index 5d2f24fbafc5..622f6b6ae844 100644
--- a/mm/slab_common.c
+++ b/mm/slab_common.c
@@ -255,7 +255,7 @@ struct kmem_cache *find_mergeable(size_t size, size_t align,
{
struct kmem_cache *s;
- if (slab_nomerge || (flags & SLAB_NEVER_MERGE))
+ if (slab_nomerge)
return NULL;
if (ctor)
@@ -266,6 +266,9 @@ struct kmem_cache *find_mergeable(size_t size, size_t align,
size = ALIGN(size, align);
flags = kmem_cache_flags(size, flags, name, NULL);
+ if (flags & SLAB_NEVER_MERGE)
+ return NULL;
+
list_for_each_entry_reverse(s, &slab_caches, list) {
if (slab_unmergeable(s))
continue;
--
2.11.0
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH review for 4.9 01/50] xen-netback: Use GFP_ATOMIC to allocate hash "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com> - 2017-09-25 03:40 +0200 [PATCH review for 4.9 17/50] f2fs: do not wait for writeback in write_begin "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com> - 2017-09-25 03:40 +0200 [PATCH review for 4.9 15/50] sched/fair: Update rq clock before changing a task's CPU affinity "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com> - 2017-09-25 03:40 +0200 [PATCH review for 4.9 26/50] ASoC: mediatek: add I2C dependency for CS42XX8 "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com> - 2017-09-25 03:40 +0200 [PATCH review for 4.9 42/50] hrtimer: Catch invalid clockids again "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com> - 2017-09-25 03:40 +0200 [PATCH review for 4.9 06/50] mac80211_hwsim: check HWSIM_ATTR_RADIO_NAME length "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com> - 2017-09-25 03:40 +0200 [PATCH review for 4.9 07/50] ALSA: hda: Add Geminilake HDMI codec ID "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com> - 2017-09-25 03:40 +0200 [PATCH review for 4.9 05/50] initramfs: finish fput() before accessing any binary from initramfs "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com> - 2017-09-25 03:40 +0200 [PATCH review for 4.9 14/50] f2fs: do SSR for data when there is enough free space "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com> - 2017-09-25 03:40 +0200 [PATCH review for 4.9 02/50] locking/lockdep: Add nest_lock integrity test "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com> - 2017-09-25 03:40 +0200 [PATCH review for 4.9 18/50] md/linear: shutup lockdep warnning "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com> - 2017-09-25 03:40 +0200 [PATCH review for 4.9 12/50] netfilter: nf_ct_expect: Change __nf_ct_expect_check() return value. "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com> - 2017-09-25 03:40 +0200 [PATCH review for 4.9 24/50] slub: do not merge cache if slub_debug contains a never-merge flag "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com> - 2017-09-25 03:40 +0200
csiph-web