Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp2024783rdb; Sat, 2 Dec 2023 22:09:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IFPQT6CNmNA7UzSWZ8NPYeplCaE3mUbo1UbCg9YnC963Q3FhHA5M++Ing4sak8U5nbMyTdV X-Received: by 2002:a17:902:dacb:b0:1d0:4802:3b6c with SMTP id q11-20020a170902dacb00b001d048023b6cmr2254059plx.4.1701583763567; Sat, 02 Dec 2023 22:09:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701583763; cv=none; d=google.com; s=arc-20160816; b=rARXdni6ySVok2sf0TvAGqvnwioXIuiIcJwvXOInPRcI6d8b3MMevD/I7A6tl8t+E1 ZFYfp5fRfQUn9QY3IrBQnoSOxILMJryL8fbATI+/uWShbcsabfqSwQeLwgk9O3vXQkYI rSbTJpqoAN50yixPizk6oYXiMH0vYGvV/XVcyc95qtI7oDTxKbsWOEFK6sNMJzUfi2RI jkOmc+yxdK1pF1ZLI40vW0i4C+0mVe5BhQRpQbT8Ec4ow/2NBH9EaHbkjHoHQHLEYo3o RAdRq0neWgr8hiGjpe8ruPbBJS8sL8dd24pNHeG1Od96fDub+5U3PYxFE+ZZvSuqbmiW F0UA== 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=M7fevemxkHPKkn8De2PN0uPPbfcs4ANeofm/VTixKps=; fh=jsJwwuw6nvP2qF9egPWt2UoLnpVZcF8sx1kIuFBzJSk=; b=0+pS+fydL1NGSH9p1Cg6XR/j4VvnHWc0CXsez9vTFe1oOM3cZfiaS4UYL136J5ElVP mR5GGRf37G0KtcvphxOBxqa1hdpavwgpa2NybrieUTjBg/+B+j1CnR7sEOzMF4SiwYol AIpL8iJzknVGyNZS/ZL3yTUKFhHGjgWn1CcASlXwHLivVXc4Rv1EzrmlYtcoBgWKm7TA 5LEm+V1gvCDMxAFA2cpyi9iFXDUIbkrmscsbO3yCs0B+/PQCJ2GytHwf0EHIkiPzZP+9 pNeiMYloKk6Cpgw2WnPsSM4JDUN8v8Sq02X0vDVMvYdsJlkUvAlmzoggMIaapiJtJpLD wsug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=L+5yy+gF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id z2-20020a170902d54200b001d00a866032si3170285plf.223.2023.12.02.22.09.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Dec 2023 22:09:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=L+5yy+gF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 groat.vger.email (Postfix) with ESMTP id 422F38087FF4; Sat, 2 Dec 2023 22:09:21 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229551AbjLCGJG (ORCPT + 99 others); Sun, 3 Dec 2023 01:09:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232985AbjLCGJE (ORCPT ); Sun, 3 Dec 2023 01:09:04 -0500 Received: from mail-vs1-xe2b.google.com (mail-vs1-xe2b.google.com [IPv6:2607:f8b0:4864:20::e2b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 816B31FE4 for ; Sat, 2 Dec 2023 22:08:29 -0800 (PST) Received: by mail-vs1-xe2b.google.com with SMTP id ada2fe7eead31-4648b191ce6so95992137.0 for ; Sat, 02 Dec 2023 22:08:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701583702; x=1702188502; 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=M7fevemxkHPKkn8De2PN0uPPbfcs4ANeofm/VTixKps=; b=L+5yy+gFluR+6N1HCbYSzYRDEsQ1ASoQEneK6FO/dQ90s7R1JgM2qWyBVsEe5B+d+N eEjvG4gx3zfxPlgiieUynGHukdHE8GxF5n7U1Ie6DVWAzYbcjjukZbgDw2syMHmyLWBH /D9JfGSrRq+/fA2oPT6S2NeHT55AhLwItR54amSWWgwwnKDxkWw0rE023algkAwKdvdS 5X5YMIqjvp0j8FdXXunhL4f/tjZ3QTuSOvcEk8xsI/tuqpxAELaGYHIozFrNEeKDDUEO Ra+ONCEQvRalTK9YAd8ATfj/NYmN6FfykMeFeOgAzJTdIkNvrgO+g8yJ717cJRf+YlO2 nw8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701583702; x=1702188502; 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=M7fevemxkHPKkn8De2PN0uPPbfcs4ANeofm/VTixKps=; b=igEkaQ2epGLwuZW8rrgg0KkeP7mDGa2uxkOPF8L99FSp1lfLf55BZ5KJDykWzAkHMd OFpi6Qr6FM2tp3+IpxtJtO6WZoFgf/IlaGagGMbYClk9SysYzl1pMPlzkE98LT6xc7xz qUSG0ZTJ7Hl7+nPtqRBK/DygqjCK2w76Y+EojeVTjsEsdiBdJv/D1mnODp38PpHI7WFz iIu2ztyXmaTQKpRF0SavFRwL9+s5I6z+jH3wIrB91Ib4Ur/IE0EG8bOjt80S0YOQvF1r CH6N/K02UfowEzAkExzOrwEa/5hQ7T87wGF/+FAo21z9zmzObPlwIlsK2QvVAXXVCRJA +P+g== X-Gm-Message-State: AOJu0YxMvOkI51DfEirNWZUO1WUmFMUthGErVrbq9EPeue61/78jpWP4 jTks5f0PPPVj9cnnoD+beaN3cex/4lFaWu4kMtA= X-Received: by 2002:a05:6102:b0b:b0:464:77f1:f349 with SMTP id b11-20020a0561020b0b00b0046477f1f349mr1216372vst.23.1701583701624; Sat, 02 Dec 2023 22:08:21 -0800 (PST) MIME-Version: 1.0 References: <20231031140741.79387-1-chengming.zhou@linux.dev> <20231031140741.79387-6-chengming.zhou@linux.dev> In-Reply-To: <20231031140741.79387-6-chengming.zhou@linux.dev> From: Hyeonggon Yoo <42.hyeyoo@gmail.com> Date: Sun, 3 Dec 2023 15:08:10 +0900 Message-ID: Subject: Re: [RFC PATCH v4 5/9] slub: Introduce freeze_slab() To: chengming.zhou@linux.dev Cc: vbabka@suse.cz, cl@linux.com, penberg@kernel.org, willy@infradead.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 groat.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 (groat.vger.email [0.0.0.0]); Sat, 02 Dec 2023 22:09:21 -0800 (PST) On Tue, Oct 31, 2023 at 11:09=E2=80=AFPM wrote: > > From: Chengming Zhou > > We will have unfrozen slabs out of the node partial list later, so we > need a freeze_slab() function to freeze the partial slab and get its > freelist. > > Signed-off-by: Chengming Zhou > Reviewed-by: Vlastimil Babka > --- > mm/slub.c | 27 +++++++++++++++++++++++++++ > 1 file changed, 27 insertions(+) > > diff --git a/mm/slub.c b/mm/slub.c > index 1880b483350e..edf567971679 100644 > --- a/mm/slub.c > +++ b/mm/slub.c > @@ -3098,6 +3098,33 @@ static inline void *get_freelist(struct kmem_cache= *s, struct slab *slab) > return freelist; > } > > +/* > + * Freeze the partial slab and return the pointer to the freelist. > + */ > +static inline void *freeze_slab(struct kmem_cache *s, struct slab *slab) > +{ > + struct slab new; > + unsigned long counters; > + void *freelist; > + > + do { > + freelist =3D slab->freelist; > + counters =3D slab->counters; > + > + new.counters =3D counters; > + VM_BUG_ON(new.frozen); > + > + new.inuse =3D slab->objects; > + new.frozen =3D 1; > + > + } while (!slab_update_freelist(s, slab, > + freelist, counters, > + NULL, new.counters, > + "freeze_slab")); > + > + return freelist; > +} > + Looks good to me, Reviewed-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> Thanks! > /* > * Slow path. The lockless freelist is empty or we need to perform > * debugging duties. > -- > 2.20.1 >