Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp2022727rdb; Sat, 2 Dec 2023 22:02:30 -0800 (PST) X-Google-Smtp-Source: AGHT+IGosaMJK8C7RxvRGgme79jGMrjHF99XPp2cZoe274aevTfLsx2FKF9oZRxm6Q4z3Gxk5vxu X-Received: by 2002:a05:6870:c7a8:b0:1fb:75b:130a with SMTP id dy40-20020a056870c7a800b001fb075b130amr2223150oab.92.1701583349989; Sat, 02 Dec 2023 22:02:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701583349; cv=none; d=google.com; s=arc-20160816; b=I3b7FIz4pnhk2awTKX9o6QJIisEspddd+Qml/S6xwF3vA76HZvuWveoUMRXY5haX+v 6K3PgQH9oy1bkBXmn+1ANHvx+bC2D3gUryYK1N7XZ7LAAd7sbyVdXiycVCmIr2gg0B+i wpCcNBBrgbJnogmnvXSAjsFfYNnUMd0kHUl/OwtOhdDPdmWAmWl+aapDC3O05bXgT7Hf 7vnyNO3qjPkZcD9D0G/vd+JY1loUiePlD0nz4cB5w7+OwrzGptYG4ZfwcKO9ti9wLhbq ORVh1cKf59DIH834j+lF+FRHxdS99Pw/vV2SjzCpiBdePYKQnpo1rV9VFzX8J0KYOMYK JgBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=75GAc10of+yuuWhZkJ7UEiM6igGIu13so7TnNv3aMVo=; fh=B2BRchoLiKRzsU6ZRslCFAgLHOWTUXqRKfqu4ueRob4=; b=HVhQsR4u5lP0U6U7bevi7K8TY7eAtp64pRBHu7eO54ycYwNiZp0TCsY/Mxe5mQOjlG jMnMy6lPvqgRXr+ukhPJ3/ekqSANW9/xalXPgKOrVZ2qJqKc3Z1OvpeKTKyXJvuhxZV+ jIdXUYGMxEX1ryd4RTnQCJVrjbHXGZ/cvN3hrkcLuZOeER8VunQhc6NOfYIhqw3X/fsX DB5qtm49slsTn7N9t6MKMa7FBpm7qlPreREQljIc3MchbyjPN6n/rphbBYRezMTYikLI Sjha3t7PkzGcsE/CT1CiR7B4yy983HtIvL6I2f+/hhbrv9uprodwC5P5PO7oUNc9t7SZ Oc9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=GSzgX36T; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id q7-20020a634307000000b005c625d44bd5si5735305pga.281.2023.12.02.22.02.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Dec 2023 22:02:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=GSzgX36T; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 0A6ED805F3CF; Sat, 2 Dec 2023 22:02:21 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232926AbjLCGBd (ORCPT + 99 others); Sun, 3 Dec 2023 01:01:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229480AbjLCGBa (ORCPT ); Sun, 3 Dec 2023 01:01:30 -0500 Received: from mail-vk1-xa36.google.com (mail-vk1-xa36.google.com [IPv6:2607:f8b0:4864:20::a36]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C6BFFE for ; Sat, 2 Dec 2023 22:01:37 -0800 (PST) Received: by mail-vk1-xa36.google.com with SMTP id 71dfb90a1353d-4b2881aa3d6so1135927e0c.0 for ; Sat, 02 Dec 2023 22:01:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701583296; x=1702188096; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=75GAc10of+yuuWhZkJ7UEiM6igGIu13so7TnNv3aMVo=; b=GSzgX36THss1mrdmzMx57swX8PpbZR1MxYCDwIG5lYn6LrQTRIbiFO/mAzpStWzkCm jGuKBGY2LMwnnvUz3URHLQF+VVKsGOM7CtQrP6ZaZJ8QGGxdJ+leF58iLwGqmIBkMk3q A/Cw5jEpp5UwZzmSLBofH10EytIxAuWHQSTXf2CVqsGEUjruQw9VMDL8SrwqqY7RaNmr lcR1YdNuMFkUjPUaB20w92/fWbcBYpiRRdYTTGHW0KFvYoMABGUH9ORq/zcCbY/oo82F h1i25rszCbrDp0JVWLtH4bZbthamgmb0PJZ4WzEg8wIU3G9sahRa4p7qHM8gGxDviGgH 8gXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701583296; x=1702188096; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=75GAc10of+yuuWhZkJ7UEiM6igGIu13so7TnNv3aMVo=; b=nq/25i4cEc6UPFuDXBcNkMj49X1MTFJx8nKd9n339TNFHnBXrsP6+Hq2V7Q7maLXdu sQ2rC27jX95V5QNWrJpEfmRdKU8qKu4FOkOwrWfYU72Br1fURa9tlrN8rS+Es4FK4miF oP/651wQV3f1o1MDTgRR6Ncj5P6z2AODDPyPXx0qveH242ajYA5d/KbVZpjBBjW7gXs4 qxTQXvmk9ZZmKQX8Pvjv0Bu3fBLrbGiUg+qjNuGQ3pthInlqtTVE534T2hMb9iVTWwS9 6ZBNEMxSUC5bPrCX4r6KQJsE6W0Q2P+we6Tbgv2YL4tuWh9qXVMTWSSxEMAgVksUYN+L Zhog== X-Gm-Message-State: AOJu0Yyf/tQPdRwXvMG4piMnqyQYqKYaF43qwExO5fPuVcRi/ZykimMO yrneQM3292zsSKU54i1w/FBTq5PNZ5ruSlwVmps= X-Received: by 2002:a67:ec43:0:b0:464:63dc:bcea with SMTP id z3-20020a67ec43000000b0046463dcbceamr718817vso.16.1701583296187; Sat, 02 Dec 2023 22:01:36 -0800 (PST) MIME-Version: 1.0 References: <20231102032330.1036151-1-chengming.zhou@linux.dev> <20231102032330.1036151-5-chengming.zhou@linux.dev> In-Reply-To: <20231102032330.1036151-5-chengming.zhou@linux.dev> From: Hyeonggon Yoo <42.hyeyoo@gmail.com> Date: Sun, 3 Dec 2023 15:01:23 +0900 Message-ID: Subject: Re: [PATCH v5 4/9] slub: Prepare __slab_free() for unfrozen partial slab out of node partial list To: chengming.zhou@linux.dev Cc: vbabka@suse.cz, cl@linux.com, penberg@kernel.org, rientjes@google.com, iamjoonsoo.kim@lge.com, akpm@linux-foundation.org, roman.gushchin@linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Chengming Zhou Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=0.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,HK_RANDOM_FROM,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Sat, 02 Dec 2023 22:02:21 -0800 (PST) On Thu, Nov 2, 2023 at 12:24=E2=80=AFPM wrote: > > From: Chengming Zhou > > Now the partially empty slub will be frozen when taken out of node partia= l > list, so the __slab_free() will know from "was_frozen" that the partially > empty slab is not on node partial list and is a cpu or cpu partial slab > of some cpu. > > But we will change this, make partial slabs leave the node partial list > with unfrozen state, so we need to change __slab_free() to use the new > slab_test_node_partial() we just introduced. > > Signed-off-by: Chengming Zhou > Reviewed-by: Vlastimil Babka > Tested-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> > --- > mm/slub.c | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > diff --git a/mm/slub.c b/mm/slub.c > index eed8ae0dbaf9..1880b483350e 100644 > --- a/mm/slub.c > +++ b/mm/slub.c > @@ -3631,6 +3631,7 @@ static void __slab_free(struct kmem_cache *s, struc= t slab *slab, > unsigned long counters; > struct kmem_cache_node *n =3D NULL; > unsigned long flags; > + bool on_node_partial; > > stat(s, FREE_SLOWPATH); > > @@ -3678,6 +3679,7 @@ static void __slab_free(struct kmem_cache *s, struc= t slab *slab, > */ > spin_lock_irqsave(&n->list_lock, flags); > > + on_node_partial =3D slab_test_node_partia= l(slab); > } > } > > @@ -3706,6 +3708,15 @@ static void __slab_free(struct kmem_cache *s, stru= ct slab *slab, > return; > } > > + /* > + * This slab was partially empty but not on the per-node partial = list, > + * in which case we shouldn't manipulate its list, just return. > + */ > + if (prior && !on_node_partial) { > + spin_unlock_irqrestore(&n->list_lock, flags); > + return; > + } > + > if (unlikely(!new.inuse && n->nr_partial >=3D s->min_partial)) > goto slab_empty; > Looks good to me, Reviewed-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> > -- > 2.20.1 >