Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1738706

[PATCH review for 4.9 24/50] slub: do not merge cache if slub_debug contains a never-merge flag

Path csiph.com!goblin2!goblin.stu.neva.ru!news.unit0.net!news.panservice.it!bofh.it!news.nic.it!robomod
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 Mon, 25 Sep 2017 03:40:03 +0200
Message-ID <utqxl-7O2-47@gated-at.bofh.it> (permalink)
References <utqdY-7Fr-3@gated-at.bofh.it>
X-Original-To "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>, "stable@vger.kernel.org" <stable@vger.kernel.org>
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/simple; d=verizon.com; i=@verizon.com; q=dns/txt; s=corp; t=1506302043; x=1537838043; h=from:cc:to:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=IkppM5KGPB3dKY7NbueVXBF6F7VaznLDRhfmbbJrph0=; b=ha8RdeqQ2ze+iq45QmHOKrq5SUMtwtBz9PYvhkwVVxNvR2Zul99VfB0S MS51BrrQz9k4satXOFs7itB3xKMwc1gw/0uzqFy7/G7yz7Foj7fJtHs1H wPer3Uy4ObQqA+o6U3VnGtlu8T15tzaynGg+J0PFT+RB6G8VD8DGVAqg6 U=;
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/simple; d=verizon.com; i=@verizon.com; q=dns/txt; s=corp; t=1506301978; x=1537837978; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=IkppM5KGPB3dKY7NbueVXBF6F7VaznLDRhfmbbJrph0=; b=X7X7rq1x/NeCHzfE1KYS/+s5ilENlPKlNSyzF9YT723xU9a/WGUxs+xR xVaTbDJ5eNuyU8swjUk8dWGU8brR7vowWc+RogkuNTixA928+kQD9ncl/ UsQLUbL9U0SRfLojmEeWcUwkL0UMz8byQB2N8BbPIYzgd6peO+fu8tIip E=;
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/simple; d=verizon.com; i=@verizon.com; q=dns/txt; s=corp; t=1506301976; x=1537837976; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=IkppM5KGPB3dKY7NbueVXBF6F7VaznLDRhfmbbJrph0=; b=hIgOblsCkGm/h9ML+nyDuVi2P07FvVCqoQjczFQ/Y1nGmL6BriUGoOcI 3fhNKGHZQ5mrfpNAVVa2wo0e9UEAhN+EqvToOopd+ZEiaWnfpr5KdwC8A rrCEQ1aNreNgHTvp3CFp7Y+3qJt82PUkzmpAL7q/hBlZQKZEGdCvyUhwY o=;
X-Host viking.odc.vzwcorp.com
Thread-Topic [PATCH review for 4.9 24/50] slub: do not merge cache if slub_debug contains a never-merge flag
Thread-Index AQHTNZtoQznzw+qcnU+3+WJhSfizlA==
Accept-Language en-US
Content-Language en-US
X-Ms-Exchange-Messagesentrepresentingtype 1
X-Ms-Exchange-Transport-Fromentityheader Hosted
X-Originating-IP [10.144.60.250]
Content-Type text/plain; charset="iso-8859-1"
Content-Transfer-Encoding quoted-printable
MIME-Version 1.0
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 56
Organization linux.* mail to news gateway
X-Original-Cc Grygorii Maistrenko <grygoriimkd@gmail.com>, Joonsoo Kim <iamjoonsoo.kim@lge.com>, Andrew Morton <akpm@linux-foundation.org>, "Linus Torvalds" <torvalds@linux-foundation.org>, "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com>
X-Original-Date Mon, 25 Sep 2017 01:12:50 +0000
X-Original-Message-ID <20170925011225.10029-24-alexander.levin@verizon.com>
X-Original-References <20170925011225.10029-1-alexander.levin@verizon.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1738706

Show key headers only | View raw


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 | NextPrevious in thread | Find similar | Unroll thread


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