From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.7 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A5ADEC433DF for ; Mon, 15 Jun 2020 07:50:55 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 677902068E for ; Mon, 15 Jun 2020 07:50:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=bytedance-com.20150623.gappssmtp.com header.i=@bytedance-com.20150623.gappssmtp.com header.b="T/af5lYC" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 677902068E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=bytedance.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id BB7896B0005; Mon, 15 Jun 2020 03:50:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B69116B0006; Mon, 15 Jun 2020 03:50:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A57816B0007; Mon, 15 Jun 2020 03:50:54 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0248.hostedemail.com [216.40.44.248]) by kanga.kvack.org (Postfix) with ESMTP id 8B8516B0005 for ; Mon, 15 Jun 2020 03:50:54 -0400 (EDT) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 40D94181AC9BF for ; Mon, 15 Jun 2020 07:50:54 +0000 (UTC) X-FDA: 76930674828.29.trail14_090b3f826df4 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin29.hostedemail.com (Postfix) with ESMTP id 0617418086CDD for ; Mon, 15 Jun 2020 07:50:53 +0000 (UTC) X-HE-Tag: trail14_090b3f826df4 X-Filterd-Recvd-Size: 6152 Received: from mail-io1-f68.google.com (mail-io1-f68.google.com [209.85.166.68]) by imf30.hostedemail.com (Postfix) with ESMTP for ; Mon, 15 Jun 2020 07:50:53 +0000 (UTC) Received: by mail-io1-f68.google.com with SMTP id s18so16832780ioe.2 for ; Mon, 15 Jun 2020 00:50:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=rst6EJ64kU6WWCXs2TxPcGzwZ7aK4wuG8DOHEM83sBQ=; b=T/af5lYCXK01UJwFupPnNH1kgwBEwNXYCFeXOSRoYvtP4Ks0xRfBvxrhJQtCfgus3u YmaSFUUkfJliKMaf/bpGANLh/TamWzfuGNgxKp0AqpoIMH17ePWI4ocRfp9e62IrqAyb 3/HCIXM/fjc6Bi42KzRYb9AVoggk/PPzp4zDXh6vsy/M1SnL1F+0QXs60X28naC2p4sU n2BEh7Vatnb02z9J5koI/ECFpWHZHM2+0pkta0uuZ2dgYNgbDdjfsH97Uq3No3b2lj1t 5h8h7QRwfonGqeyOS8/r3i83vx+kHrUhdX8fifmi8r1x57/wQqBQkTioG/stuH8ue87G Y6oQ== 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:content-transfer-encoding; bh=rst6EJ64kU6WWCXs2TxPcGzwZ7aK4wuG8DOHEM83sBQ=; b=F+XnXSuQa2i8c4jiP1VvhmAki0iVfOxY7NfGX6BLosUaf8hBWgz0V6NZUXRoGLFxdN G14FHRQ8Q8eID/P++gyf1bdOjdyehaC7ekzgb5oCru0R6iWZXQQZ98eo87Yr1zboOJKm OWaK0bF3NDQ6KCQAHMSP7ZIZwsbYomN328B5GRwEfvQxliVxKQdpi8iHQoy1dk2fqw5d JZDJXQ293zXzA1huQHdEOQ7vpE/eA6GBt8D3sViCyMWy97d+p+umDeKPVtZrECaIV4yy rwPwTO1Thek9HRYZCKYqMfchWt3qmL+SLna+Qb6IE/cTRvSvEBGZcTiHhuWBbbF7GPiG JhEA== X-Gm-Message-State: AOAM530bDvgyEykbLsU94fLFUJOtXkh6a7UaFC0AbHOWLZNkN2tdr9+M vZhDAhlfPlJ8OVbVvWRrOd+5YXFY3RM/FjBtgh9fFw== X-Google-Smtp-Source: ABdhPJzI5BYPzBe4OBGTcgTWBbMKV9OFMgaY9GUo1gVRr78tJ5tz8uA7MBds+fzzZsB/O5LoOkAKdk8yvnXTTBgwyuA= X-Received: by 2002:a02:cccd:: with SMTP id k13mr20666457jaq.53.1592207452602; Mon, 15 Jun 2020 00:50:52 -0700 (PDT) MIME-Version: 1.0 References: <20200614123923.99189-1-songmuchun@bytedance.com> <20200614123923.99189-4-songmuchun@bytedance.com> In-Reply-To: From: Muchun Song Date: Mon, 15 Jun 2020 15:50:16 +0800 Message-ID: Subject: Re: [External] Re: [PATCH 3/3] mm/slub: Fix release all resources used by a slab cache To: Joonsoo Kim Cc: Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Linux Memory Management List , LKML Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 0617418086CDD X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam04 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon, Jun 15, 2020 at 3:25 PM Joonsoo Kim wrote: > > 2020=EB=85=84 6=EC=9B=94 15=EC=9D=BC (=EC=9B=94) =EC=98=A4=ED=9B=84 3:41,= Muchun Song =EB=8B=98=EC=9D=B4 =EC=9E=91=EC=84= =B1: > > > > On Mon, Jun 15, 2020 at 2:23 PM Joonsoo Kim wrote: > > > > > > 2020=EB=85=84 6=EC=9B=94 14=EC=9D=BC (=EC=9D=BC) =EC=98=A4=ED=9B=84 9= :39, Muchun Song =EB=8B=98=EC=9D=B4 =EC=9E=91=EC= =84=B1: > > > > > > > > The function of __kmem_cache_shutdown() is that release all resourc= es > > > > used by the slab cache, while currently it stop release resources w= hen > > > > the preceding node is not empty. > > > > > > > > Signed-off-by: Muchun Song > > > > --- > > > > mm/slub.c | 7 ++++--- > > > > 1 file changed, 4 insertions(+), 3 deletions(-) > > > > > > > > diff --git a/mm/slub.c b/mm/slub.c > > > > index b73505df3de2..4e477ef0f2b9 100644 > > > > --- a/mm/slub.c > > > > +++ b/mm/slub.c > > > > @@ -3839,6 +3839,7 @@ bool __kmem_cache_empty(struct kmem_cache *s) > > > > */ > > > > int __kmem_cache_shutdown(struct kmem_cache *s) > > > > { > > > > + int ret =3D 0; > > > > int node; > > > > struct kmem_cache_node *n; > > > > > > > > @@ -3846,11 +3847,11 @@ int __kmem_cache_shutdown(struct kmem_cache= *s) > > > > /* Attempt to free all objects */ > > > > for_each_kmem_cache_node(s, node, n) { > > > > free_partial(s, n); > > > > - if (node_nr_slabs(n)) > > > > - return 1; > > > > + if (!ret && node_nr_slabs(n)) > > > > + ret =3D 1; > > > > } > > > > > > I don't think that this is an improvement. > > > > > > If the shutdown condition isn't met, we don't need to process further= . > > > Just 'return 1' looks okay to me. > > > > > > And, with this change, sysfs_slab_remove() is called even if the > > > shutdown is failed. > > > It's better not to have side effects when failing. > > > > If someone calls __kmem_cache_shutdown, he may want to release > > resources used by the slab cache as much as possible. If we continue, > > we may release more pages. From this point, is it an improvement? > > My opinion is not strong but I still think that it's not useful enough > to complicate > the code. > > If shutdown is failed, it implies there are some bugs and someone should = fix it. Yeah, I agree with you. > Releasing more resources would mitigate the resource problem but doesn't > change the situation that someone should fix it soon. > > Anyway, I don't object more if you don't agree with my opinion. In that c= ase, > please fix not to call sysfs_slab_remove() when ret is 1. > Yeah, we should call sysfs_slab_remove only when ret is zero. Thanks very much. --=20 Yours, Muchun