Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp1633841imm; Wed, 20 Jun 2018 23:31:45 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLDWMYJN95Y4hAD/h0H6mqXStpAGrKhBNnXRd0Sq5ysbCbPIf5vkU7tYHLi2O4bISoBu4GM X-Received: by 2002:a17:902:b483:: with SMTP id y3-v6mr27372351plr.66.1529562705390; Wed, 20 Jun 2018 23:31:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529562705; cv=none; d=google.com; s=arc-20160816; b=x+3I5RJw+MQ2wcyRRKsR/iT6qs83q0Tei/aOsKJ/K5QZc/4JceuXZ3pk1r3TFnu0qI b6e/ym1rxPwfS6crWb96Ac8t/V6Y9KfNh5bk+JYGIin0CZ1jdOUKuBAEw7k/3KgUHeHp F8JzJT363roAE+1BF5membztnbEBFaofzl5eZarUody0iFOc+/Bsx9sdkHEHzxOLqu/y g1DQ9xeG1KTWba71dZjXgKzhaIfIe4wrmHMBfxMFal7Ao2d2c4d55dz4cQjmDaSjVAz9 WuPMbvxMH8TFucOrzaBSqybYUcxK+KL9cnurQ1Q8o8PqKqE8eVtrfOITA4qYSnbNk13q cJ6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature :arc-authentication-results; bh=qetVJMR9BXAytswHwx5TeHMKsYk5lZhH0E06bN+1lvY=; b=fTPY+LAcPd1f3JTP39sBgmJSOdGm3+peqMa/pouenQ/AAdM+GDy6QGQmyN69+jDtoB QR8+CDdCNMz9bdE2pn7M0uisSr7Zdi5jrqLoX3zdDuuxKNClbtaIyHDByNwIZa3SCPRw LKNBF+oaPD4NYnZ6v3Ztx+pmB4dpWPfsAU7g0lXUAwhnMXnXS9V9hs/nNFhdSA/GSHin qDWqjuMIrpSrUw4b7qFrZSK4TGoY9NdBG9IbZUY27cGR/UWfxE3I0BVSHocQ3Ok+USh4 /QUnMjjnmgJGbr4boZs73GRF1PqyA5jungV4/sfw7RSOJ0btBwpiYBghZD83jIqPC/4w te/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=BYcn5uk7; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z23-v6si3796873pfe.296.2018.06.20.23.31.31; Wed, 20 Jun 2018 23:31:45 -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=@google.com header.s=20161025 header.b=BYcn5uk7; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754018AbeFUGao (ORCPT + 99 others); Thu, 21 Jun 2018 02:30:44 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:40331 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751150AbeFUGan (ORCPT ); Thu, 21 Jun 2018 02:30:43 -0400 Received: by mail-wm0-f67.google.com with SMTP id n5-v6so3590073wmc.5 for ; Wed, 20 Jun 2018 23:30:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=qetVJMR9BXAytswHwx5TeHMKsYk5lZhH0E06bN+1lvY=; b=BYcn5uk7Jzas4T+3eBbGSRq0OWSfYF+2IN9Zw7mgbSQCTGVpUMzB9F94rfxADE56WJ HAlahcwPTZXnmrexSgNjSPTz8p5sJ1YT4Xu2GI1CjO1gYLY3OTID75YGtk2ZEjcU4lEw eo2FWUP5aknEgxvRBliJW9TJz/64+M8ciznqel+ISCRsA7k2JTAv4s1WPH9eOp1zWQr8 dehb1VeXxZqm3BzEz14xbHFnQXzKyCqneQZYtD6Rv8M+TnxaGsMdD32n01O9n3iyMESB WxfFmRTdmKiLvw8qSIW/9pZSOxKR8kDCyxrY2i1272VatewsIZ/DXXYuwWz0ss7XyPst CNOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=qetVJMR9BXAytswHwx5TeHMKsYk5lZhH0E06bN+1lvY=; b=M5aAf/G8m/M+5LsQUGdU8BTIyvkGVp1+R4OW9sdQzuLxfdKU1jF6SlO6E4ptCXEz2c 6I2ULqELMWMyX+FiGO9q2Lxi9dsydLLLxdOUCWoejzURBnCeZ0U9KoY0jk4CBVkLY2VR RZhG4xp63p94JJVSpjH3jhTA50RKxd19NfUrKlMi0eyu1bu6IXiECAbVhO9c0rGc9Yx4 ZCwIDZPiAuEMKBn5Ru2fp4XOHnuMvWaDF8eL+hxODpqEH7CE0XefGXw9vkTFzxtffSCy hcpnu0haczjg2cOC6tvd5Icb4O66ZzBkSCDXyHyYlU6Y0YfLin2iNrh7MiKQupNQZWQr vtdQ== X-Gm-Message-State: APt69E2+/O81Awx6dyGeJi0ykIlaoPS9RaNRyixgonUCg5W20IN8JK+P Tu23pml0EsuLnLkDCiTmlYBCfRA8GOABGFzbHrLHDg== X-Received: by 2002:a1c:1c8f:: with SMTP id c137-v6mr3884950wmc.142.1529562641633; Wed, 20 Jun 2018 23:30:41 -0700 (PDT) MIME-Version: 1.0 References: <20180620224147.23777-1-shakeelb@google.com> <010001641fe92599-9006a895-d1ea-4881-a63c-f3749ff9b7b3-000000@email.amazonses.com> In-Reply-To: <010001641fe92599-9006a895-d1ea-4881-a63c-f3749ff9b7b3-000000@email.amazonses.com> From: Shakeel Butt Date: Wed, 20 Jun 2018 23:30:29 -0700 Message-ID: Subject: Re: [PATCH] slub: track number of slabs irrespective of CONFIG_SLUB_DEBUG To: Christoph Lameter Cc: "Jason A . Donenfeld" , David Rientjes , Pekka Enberg , Joonsoo Kim , Andrew Morton , Andrey Ryabinin , Linux MM , LKML , stable@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 20, 2018 at 6:15 PM Christopher Lameter wrote: > > 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? > Copying from the other thread: On Wed, Jun 20, 2018 at 6:22 PM Jason A. Donenfeld wrote: > > On Thu, Jun 21, 2018 at 3:20 AM Christopher Lameter wrote: > > > > NAK. Its easier to simply not allow !CONFIG_SLUB_DEBUG for cgroups based > > configs because in that case you certainly have enough memory to include > > the runtime debug code as well as the extended counters. > > > > FWIW, I ran into issues with a combination of KASAN+CONFIG_SLUB > without having CONFIG_SLUB_DEBUG, because KASAN was using functions > that were broken without CONFIG_SLUB_DEBUG, so while you're at it with > creating dependencies, you might want to also say KASAN+CONFIG_SLUB > ==> CONFIG_SLUB_DEBUG. KASAN is the only user of __kmem_cache_empty(). So, enforcing KASAN+CONFIG_SLUB => CONFIG_SLUB_DEBUG makes sense but not sure about cgroups or memcg. Though is it ok let __kmem_cache_shrink() & __kmem_cache_shutdown() be broken for !CONFIG_SLUB_DEBUG? For __kmem_cache_shutdown(), I can understand that shutting down a kmem_cache when there are still objects allocated from it, is broken and wrong. For __kmem_cache_shrink(), maybe wrong answer from it is tolerable. Shakeel