From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755190Ab2AIVTv (ORCPT ); Mon, 9 Jan 2012 16:19:51 -0500 Received: from mail-yw0-f46.google.com ([209.85.213.46]:58903 "EHLO mail-yw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754772Ab2AIVTu (ORCPT ); Mon, 9 Jan 2012 16:19:50 -0500 Date: Mon, 9 Jan 2012 13:19:45 -0800 (PST) From: David Rientjes X-X-Sender: rientjes@chino.kir.corp.google.com To: Pekka Enberg cc: Christoph Lameter , Eric Dumazet , linux-kernel@vger.kernel.org Subject: [patch slab/urgent] disallow changing cpu_partial from userspace for debug caches In-Reply-To: Message-ID: References: <1326020041.32105.3.camel@jaguar> User-Agent: Alpine 2.00 (DEB 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org For caches with debugging enabled, "slub: Switch per cpu partial page support off for debugging" changes cpu_partial to 0. It shouldn't be tunable from userspace for such caches, otherwise the same accounting issues arise during validation. This patch disallows tuning /sys/kernel/slab/cache/cpu_partial to be non- zero for caches with debugging enabled. Signed-off-by: David Rientjes --- mm/slub.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/mm/slub.c b/mm/slub.c --- a/mm/slub.c +++ b/mm/slub.c @@ -4639,6 +4639,8 @@ static ssize_t cpu_partial_store(struct kmem_cache *s, const char *buf, err = strict_strtoul(buf, 10, &objects); if (err) return err; + if (objects && kmem_cache_debug(s)) + return -EINVAL; s->cpu_partial = objects; flush_all(s);