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=unavailable 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 253D5C433E0 for ; Mon, 15 Jun 2020 06:41:59 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id DABBE20714 for ; Mon, 15 Jun 2020 06:41:58 +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="oNj8hWZt" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DABBE20714 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 6A28D6B0005; Mon, 15 Jun 2020 02:41:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 653936B0006; Mon, 15 Jun 2020 02:41:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 541606B0007; Mon, 15 Jun 2020 02:41:57 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0052.hostedemail.com [216.40.44.52]) by kanga.kvack.org (Postfix) with ESMTP id 38E1D6B0005 for ; Mon, 15 Jun 2020 02:41:57 -0400 (EDT) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id E6503180AD804 for ; Mon, 15 Jun 2020 06:41:56 +0000 (UTC) X-FDA: 76930501032.18.bone96_5305ea726df4 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin18.hostedemail.com (Postfix) with ESMTP id BBDF7100ED3A8 for ; Mon, 15 Jun 2020 06:41:56 +0000 (UTC) X-HE-Tag: bone96_5305ea726df4 X-Filterd-Recvd-Size: 4982 Received: from mail-il1-f193.google.com (mail-il1-f193.google.com [209.85.166.193]) by imf46.hostedemail.com (Postfix) with ESMTP for ; Mon, 15 Jun 2020 06:41:56 +0000 (UTC) Received: by mail-il1-f193.google.com with SMTP id g3so14210141ilq.10 for ; Sun, 14 Jun 2020 23:41:55 -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=bK0Qp6h6dwfemWmyvHsC+Wip59HhIpavOmMER/ZWjbw=; b=oNj8hWZtqPfHdMws2rjs6Zk9srH9hbdHfv4lMssnWJONTrkBSWKZ/qkpqhTrc0kG2X KpMM55sKx6/MSq9CpAj3L6i1BnwfQnWPAWfbhvkzsIed7u+BuvCZDOA6Rk4o0aIo09rH DO/OIb1SuKDxpoLs6tm8UFJ5vMWJCTCTYxys2qj8r/1Zf9s/9fDYAWLCCzsZdsludgj8 Wy7gr8hb9yBkBgEXVmAEu5FUDPaYeLzCAvguRIPcFpvViOK2gBD28JilN8FFa5EKJ2p8 VqTnw2KN+SWWaFZrNYDtKofXfUjNfZtMYsN2IMEI7vqPpJPNw133B+5Yez8b3PNDCLhE 4HTw== 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=bK0Qp6h6dwfemWmyvHsC+Wip59HhIpavOmMER/ZWjbw=; b=OVNqGyUAFFmUIejgqHUcg/nbb/qPGvD+ouBY1uodqQlEftsZ3mULTAKRyetzMTuMKp 9dKxRuggFixJTZbOFWLHWcDdoTekfq2VpqhV4qmLWsAqpQUk+DjVepOjyHJCe8sRH1AA DHSiMlslpjSCW+GB1ONlQVsbb3fKiUZ4Ty1l3OL4wo27RiylByRG/Tr0IA6ptJnMrHxb pTKK1GcneL2F09gbIT2/ljvMsjEYAGfalw8IG4n8C8kR4wpkD4udWDWnegbb9vFVeFoE 1j1c5o9KWFJX+NgfGE2uupmBSt1e7QfmK0PAeUb10w778ZKvGutp8HT59HTonEC8WlWq Ja9g== X-Gm-Message-State: AOAM533KLIF3pZcBpENialv5NCJquLImGrlTAimmCwJixaxd7gFX/hKI MhVferGi2tVbOyyYUz7yUIK+cDCkrIRe5z1nm14nyQ== X-Google-Smtp-Source: ABdhPJzlI9S3kYF9RYQ4+SUFFVK1+FFHn0zDGsj9Q8tKs+ZRaYfChlqYUW4i6u1gfiAX/mlgFULixFQDtsob/T5Ip8U= X-Received: by 2002:a92:d1d0:: with SMTP id u16mr24697660ilg.2.1592203315520; Sun, 14 Jun 2020 23:41:55 -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 14:41:19 +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: BBDF7100ED3A8 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 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 resources > > used by the slab cache, while currently it stop release resources when > > 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? --=20 Yours, Muchun