Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp1260609imm; Wed, 20 Jun 2018 14:38:44 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKa5T98GmBh8BPxurOrIUE0WBOHuB08R36LMynlEZz8N3hQwA5utOKIpRTyxomaJrjp5pyn X-Received: by 2002:a17:902:e209:: with SMTP id ce9-v6mr25255943plb.233.1529530724317; Wed, 20 Jun 2018 14:38:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529530724; cv=none; d=google.com; s=arc-20160816; b=c0kDR1z7JnCl7Qs2ak8+Sp6vTjakztQO9T0HyDv91Ckba5fHWxaZnFJmbrCuFpiUf7 R90I89n+9vG3x4whBpmTzkGlR1gABo2gyaJ3q/zYyfqEeAVaI65nTrUnGcjMb5Pjti/T AKpIlv50An6Y66LQDU30WHvsR9/2rx995Gu86T6oXZXExZeVhFDuT1/6huFgHEYOof7k XKpQR8Px5wYITZyal4Zkt8PcBg8OP1Kvau5PInr7hWcy6iOms4Fie7OamLJJngLn3Zgd Hjf5w1PHPxnih7t1znFQsvbTqUO9KvarJPUiur/jHgXI2QoCdfjksPLZskX58E0tJ8rY Dgvg== 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=k8Pkgmes/3/iqbMtNDJpFKF39YTC864fd4gbEv6tRCw=; b=1GZ7EzYdwjVAWm8wI0PHgZauRCOu4fYvyvSHi1eTKUc7I6ymq5NUe/xvx9K1wE/l+D vSEcQ6oP3Vbs0uL4bIingSsOhqFD6ap4O/PeQQ56YLNT90izKNbay1SCrNnWlC2AXe/c 27Qvb4SuNeiaMka5k0oASUZLCGH5UtPHxq8h0AHAd54M/zWgPRsCpGpLHOQ+LNahYwUT LJGpwy0i+jw7CYRlBR2jcb02UvuKxgwNZztt9cK18bHfxFxaEY/YykXKdJVzWjb2/2tC MT6yvt4K9BJm4fY38Q0k95mkOQ/ug4Sda0i5u6wvx0iuuKFDYiVjEC3CUgy4MJoIcSvO rFfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=MXnmSmB2; 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 68-v6si3250694pfo.229.2018.06.20.14.38.30; Wed, 20 Jun 2018 14:38:44 -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=MXnmSmB2; 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 S933391AbeFTVgs (ORCPT + 99 others); Wed, 20 Jun 2018 17:36:48 -0400 Received: from mail-wr0-f195.google.com ([209.85.128.195]:33923 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933225AbeFTVgr (ORCPT ); Wed, 20 Jun 2018 17:36:47 -0400 Received: by mail-wr0-f195.google.com with SMTP id a12-v6so977889wro.1 for ; Wed, 20 Jun 2018 14:36:46 -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=k8Pkgmes/3/iqbMtNDJpFKF39YTC864fd4gbEv6tRCw=; b=MXnmSmB2cHtRxErjKFDq9lfiRXupwNCYlKMPv78cNEMa6XOL1FJ6e/JpXBpVZAymNT Kd9DkZKxTjt2t9PCR3FDvg5OHYsUrPxwQnwU4WuYAvZ1dfwjgv0t+1CeqrZoZC/a3F2Z rakzcCahuFAhLygXUE2tE0VDzeRCrTpAz9tT3hVRdPjOD2ubvyb8bQp1mB25YPYDC3mh gB1l//JDfU4kKkpfIBr9Fwoqz02Lq2RU549hYfGiyZG8R6kPAvUcy1COLyj5qe59hII9 Gr4cr2z1bI6ZoSY/hqtovmxpoTT+ZcCr1NVzNqQlAAkt/6adbyZLCUUdb4BuvuEuwYb5 vsgQ== 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=k8Pkgmes/3/iqbMtNDJpFKF39YTC864fd4gbEv6tRCw=; b=J+2b7S3G9nVD4kLt/8GkHsSyAEJ7PdbOXNB11Am9OCFjZZAtZTpcO6bz4H3+aYGbvX LsRLStdoHNW5aV9pGb7j8oRA33qj/T1QmOAmvd3DbiDZbkjVT1q7OuqSLO4NiPSClu/S bwuKl2gyMDQWSZye8cwF71cg4j7KafUc62nw+tzZzCjEtYtSIHsxwfPrrvaeGEcP05aA TB2yKbDctngHvx15cFonBL2qXX9n5G12fUYYTXbv8R6VSu/F9JOHTbc/IWvGSPMkczrX Q89dObPnfiBWWlgYew57ssE+wP3G1e9SVrVzVE8ep6QIKR9lWvNQdjPlDAlCEW+TdmwG erAQ== X-Gm-Message-State: APt69E1B0RpIIz80z/FmGkyT9d+P5IE19Rwdi9FKXKQIgkdcl5FzeodY COjeYABImOGjJEcRLZD4YLVpwyjGMV5q4Yy1mDB0uQ== X-Received: by 2002:adf:e48e:: with SMTP id i14-v6mr20713220wrm.8.1529530605690; Wed, 20 Jun 2018 14:36:45 -0700 (PDT) MIME-Version: 1.0 References: <20180619213352.71740-1-shakeelb@google.com> <3f61e143-e7b3-5517-fbaf-d663675f0e96@virtuozzo.com> In-Reply-To: <3f61e143-e7b3-5517-fbaf-d663675f0e96@virtuozzo.com> From: Shakeel Butt Date: Wed, 20 Jun 2018 14:36:33 -0700 Message-ID: Subject: Re: [PATCH] slub: fix __kmem_cache_empty for !CONFIG_SLUB_DEBUG To: Andrey Ryabinin Cc: "Jason A . Donenfeld" , Linux MM , LKML , Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , 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 5:08 AM Andrey Ryabinin wrote: > > > > On 06/20/2018 12:33 AM, 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() will always return 0. So, in such situation, it is > > required to check per-cpu slabs to make sure if a kmem_cache is empty or > > not. > > > > Please note that __kmem_cache_shutdown() and __kmem_cache_shrink() are > > not affected by !CONFIG_SLUB_DEBUG as they call flush_all() to clear > > per-cpu slabs. > > So what? Yes, they call flush_all() and then check if there are non-empty slabs left. > And that check doesn't work in case of disabled CONFIG_SLUB_DEBUG. > How is flush_all() or per-cpu slabs even relevant here? > The flush_all() will move all cpu slabs and partials to node's partial list and thus later check of node's partial list will handle non-empty slabs situation. However what I missed is the 'full slabs' which are not on any list for !CONFIG_SLUB_DEBUG. So, this patch is not the complete solution. I think David's suggestion is the complete solution. I will post a patch based on David's suggestion.