Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp1420132imm; Wed, 20 Jun 2018 18:16:26 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKb3YtPv9/SRUueajZKoLox0/svVGmsigezlbGj6eRynHxw8gSwJ2dmLm6FZPbrXeF2pcfm X-Received: by 2002:a65:6101:: with SMTP id z1-v6mr20405514pgu.282.1529543785911; Wed, 20 Jun 2018 18:16:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529543785; cv=none; d=google.com; s=arc-20160816; b=YLSmte/xam8NkalkoZTXlufAmYeC1NKdE/Kd8PoL1jNIh0cGR0BnTgVuGOysIO8rjW gpglodCClSsbzXATL+lWbjn5kRg9Cw/Gxe2Z1QAP8mkHOLBWmCPlY2F4EYa1O6RRGnIO IvFvQnGCwTmu+Fgb6y7vDMdW8CUTHEonoT0lRIxRrLxdZF2H12ToimZPMhYho+WF8Zpa cb25jFuRrn4SXeUvYRAvJZXh3XgGLMpGX/tSSZ8g5uDU+T1GijlTVQnmebFLaQj6lKDZ qPwPQVgQKrNvBeKcXhR7qtQhDF9/C2AZeNold+ya+6cct0FHEEnzmUCNbpsFJ7Us4TSV bWIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:feedback-id:mime-version:user-agent :references:message-id:in-reply-to:subject:cc:to:from:date :dkim-signature:arc-authentication-results; bh=tDMCHpXs4aAfoFmX/Dj6MYiopWJT0Kumn/E0Fpazef0=; b=BJXhjayltuXasjd6BLy5THc9jJ1gICBBHX775/CSqAvYKvrpBXi0hvIc5ffoNqklmj PCYrz8ZTX6pawgSOYCfmr7LR3/PmYTAdtamyQIbOineHuJLEeH50F+adp3k68AGH/vrx +1ubyAkj6TApojf3aONpn42Kt4N1NZAicRnfzrp800/6YFfyr4H3rlg6wRnjTWPwpfIl ldfS16DhcbqTDJ3m2eTJQYsMYco4QgkvNAFhRI9N4r34MnFRPt0mYojBhsJnnj3v5S8R COJjCciMaecYIzt/JXBd1IQF/ok+o9igFJ5LVIdnojMm8S4om/DUZ/IrTrvDxECDFBSW ma7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazonses.com header.s=ug7nbtf4gccmlpwj322ax3p6ow6yfsug header.b=Hm6Iem3f; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d10-v6si3429727pfh.119.2018.06.20.18.16.11; Wed, 20 Jun 2018 18:16:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@amazonses.com header.s=ug7nbtf4gccmlpwj322ax3p6ow6yfsug header.b=Hm6Iem3f; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754101AbeFUBPd (ORCPT + 99 others); Wed, 20 Jun 2018 21:15:33 -0400 Received: from a9-112.smtp-out.amazonses.com ([54.240.9.112]:50862 "EHLO a9-112.smtp-out.amazonses.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752983AbeFUBPb (ORCPT ); Wed, 20 Jun 2018 21:15:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=ug7nbtf4gccmlpwj322ax3p6ow6yfsug; d=amazonses.com; t=1529543730; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:MIME-Version:Content-Type:Feedback-ID; bh=tDMCHpXs4aAfoFmX/Dj6MYiopWJT0Kumn/E0Fpazef0=; b=Hm6Iem3fK3/RdTpn40e0UXcN7X1bLBmENQaZyjqU4+OgLXsO1NBFpeAIsuKuVj7a 1DYC4L6uvMvjee6NoUSgUjYT5v51pcXaHtXyjWRXyMIfarAYWP2YMcnyDXhoe/VWcDb /Z998R9aytQJhbKmio4VuXr5gO+o4hunL0i+K06U= Date: Thu, 21 Jun 2018 01:15:30 +0000 From: Christopher Lameter X-X-Sender: cl@nuc-kabylake To: Shakeel Butt cc: "Jason A . Donenfeld" , David Rientjes , Pekka Enberg , Joonsoo Kim , Andrew Morton , Andrey Ryabinin , linux-mm@kvack.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH] slub: track number of slabs irrespective of CONFIG_SLUB_DEBUG In-Reply-To: <20180620224147.23777-1-shakeelb@google.com> Message-ID: <010001641fe92599-9006a895-d1ea-4881-a63c-f3749ff9b7b3-000000@email.amazonses.com> References: <20180620224147.23777-1-shakeelb@google.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-SES-Outgoing: 2018.06.21-54.240.9.112 Feedback-ID: 1.us-east-1.fQZZZ0Xtj2+TD7V5apTT/NrT6QKuPgzCT/IC7XYgDKI=:AmazonSES Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 20 Jun 2018, Shakeel Butt wrote: > For !CONFIG_SLUB_DEBUG, SLUB does not maintain the number of slabs > allocated per node for a kmem_cache. Thus, slabs_node() in > __kmem_cache_empty(), __kmem_cache_shrink() and __kmem_cache_destroy() > will always return 0 for such config. This is wrong and can cause issues > for all users of these functions. CONFIG_SLUB_DEBUG is set by default on almost all builds. The only case where CONFIG_SLUB_DEBUG is switched off is when we absolutely need to use the minimum amount of memory (embedded or some such thing). > The right solution is to make slabs_node() work even for > !CONFIG_SLUB_DEBUG. The commit 0f389ec63077 ("slub: No need for per node > slab counters if !SLUB_DEBUG") had put the per node slab counter under > CONFIG_SLUB_DEBUG because it was only read through sysfs API and the > sysfs API was disabled on !CONFIG_SLUB_DEBUG. However the users of the > per node slab counter assumed that it will work in the absence of > CONFIG_SLUB_DEBUG. So, make the counter work for !CONFIG_SLUB_DEBUG. Please do not do this. Find a way to avoid these checks. The objective of a !CONFIG_SLUB_DEBUG configuration is to not compile in debuggin checks etc etc in order to reduce the code/data footprint to the minimum necessary while sacrificing debuggability etc etc. Maybe make it impossible to disable CONFIG_SLUB_DEBUG if CGROUPs are in use?