Received: by 2002:a05:7412:40d:b0:e2:908c:2ebd with SMTP id 13csp763229rdf; Tue, 21 Nov 2023 16:27:58 -0800 (PST) X-Google-Smtp-Source: AGHT+IFw5z9HOucqo0HLQg+HM/gudOWfm5pPKUgbUZS6t+wmkZ6glsmi6GxRjv4Ps98UEMxJ6IsC X-Received: by 2002:a05:6a20:1442:b0:189:b618:1736 with SMTP id a2-20020a056a20144200b00189b6181736mr682844pzi.57.1700612878245; Tue, 21 Nov 2023 16:27:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700612878; cv=none; d=google.com; s=arc-20160816; b=hHoSm3d9IgkbrBKNL7dcxp82C6yTVgLcNrkpbg73wh3lITjG0BnUMosF6qCz04CiW3 9O4clgNANzZpchkmFstUWZl1vkI9AknSOjPkGdPDQpwvTjxU9K0+HhE7ef17rXPovd8w X3k+9XLKOPAMgLjnrajNG8mF5A77mMKTv0yjAfID+wu/SzDBQqer/uozuSmwmdwyjXU2 NMMA9DP2IIZxcCpb3JhYmMlmstHlJJTwinBW8+LfVN5pwUReQpsi956iulMuGiOaXHK4 D/4/J5HxiOI3Vn1kOQ5v9NwuNkC3IqfS/IWPu7x9HLtUZJ+PBQRE+wH0BWXe7xgGKzCA bQ9A== 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=I6SlFQgfAbHnP562FfJkWr5EctvFZHTzloSc2FxzjM0=; fh=B2BRchoLiKRzsU6ZRslCFAgLHOWTUXqRKfqu4ueRob4=; b=NBvCyTBrkxEg/z0xNl5XNQJS0PeSyZ3P/r+ymdxU3fe4gQjJ6XCeT33SH3k38XH8/X piAqNuNovkvp+GXcj5GyXHbnnvsPhkzpHE6y8Upv3DO3rxM2eJk6bRQo5C/gSoaYCBpu CLVNlAgJJYc741czuT+oFdpaY/11Vpwb6zYP4GQqEiH3PYZmvLBoMNi6MUIQ4ZdPf9/O jHfmOyDStlPNyKMH/4L/JZFIV/Lmdtww4wt0XC7tjAH6mKqYT7Q/W7G8eqlvwlsmZmtr Fk6Hi3CkT150S4eIpevJ660r7QkdXUuu+WLF0TpmRx2qVLn6luOlwMTSmTiOtg2V5L3T lj1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=UC6UBsbC; 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 i6-20020a17090a974600b00283942c01e5si242534pjw.183.2023.11.21.16.27.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Nov 2023 16:27:58 -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=UC6UBsbC; 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 015EF807AC61; Tue, 21 Nov 2023 16:26:42 -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 S234898AbjKVA0a (ORCPT + 99 others); Tue, 21 Nov 2023 19:26:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229379AbjKVA03 (ORCPT ); Tue, 21 Nov 2023 19:26:29 -0500 Received: from mail-vk1-xa29.google.com (mail-vk1-xa29.google.com [IPv6:2607:f8b0:4864:20::a29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2DF561A2 for ; Tue, 21 Nov 2023 16:26:25 -0800 (PST) Received: by mail-vk1-xa29.google.com with SMTP id 71dfb90a1353d-4af6a700087so2006139e0c.0 for ; Tue, 21 Nov 2023 16:26:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700612784; x=1701217584; 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=I6SlFQgfAbHnP562FfJkWr5EctvFZHTzloSc2FxzjM0=; b=UC6UBsbCSyLvyhrH64oa/ww0lcYpJhyP7XAcHDce292uAXkLJxq9X8qlebemK22hiH HKd50MBze7AG/vKCXX2ffmdMJ7/DausoyrL03VlKJRSgDnmNqWQHkbagBIk5dRCNe3IS mGoOvtAHnNJYT5DxhoPjt8E99/pSj9iOrHBs3brLrorIHZ1u/ljsm6mzQM2tGcjPvc+6 faAExPbwK9h02AOOTyWbbL58eK0P+2tc3vUVp+RsB4DOy0vhMmTtlx5ak0sipy1Ap3kP WnoyFHN6uPLYqPaKiIudA8TQ6vmXzSxtTSg3/RN0yANyn3bSP2TKdi9tpafCiuzRwvCo Lybw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700612784; x=1701217584; 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=I6SlFQgfAbHnP562FfJkWr5EctvFZHTzloSc2FxzjM0=; b=igr+Y0yHCyJHJt4L3W02PreAXZSirkoueALPB0rU/vElFgjMNwJ1fUCVySqZ6Vk8WW vxh8D4/DTGGT5dBqzUPMk2FCVKYpCf07WQ+q3Dg1aSyxi4aexM44HWZwoNMPt2eShb98 ExMG3pNOQ7mf9nyTDeWfaQGsP35POjLrlcynyb3w5yvI6SER/65g9NNoAVb/fwqL95UG NEgAkh85hf8GBWtMBVjJ4hUuWJiB3+iS/fHvAFg+cvMVtPPZd+5opGu6kZaCXeZ4SpJp Egg/77RfFfBBVZcsRWyWO79NKA0CELX9nX2QfNZgO+ZA+cXZ56fsiuhoY1bHZxmQJxSn dF1Q== X-Gm-Message-State: AOJu0YzlNHzmkJ5Y3aaQ2rZ68BJS6hANj0A4NZO6aaJeSdyvvAx64tJm RWADW5lnbwr9Igj46qR8STpOD4+qBp+4i5wDmFI= X-Received: by 2002:a1f:dfc4:0:b0:49a:1a56:945c with SMTP id w187-20020a1fdfc4000000b0049a1a56945cmr1110334vkg.13.1700612784086; Tue, 21 Nov 2023 16:26:24 -0800 (PST) MIME-Version: 1.0 References: <20231102032330.1036151-1-chengming.zhou@linux.dev> <20231102032330.1036151-2-chengming.zhou@linux.dev> In-Reply-To: <20231102032330.1036151-2-chengming.zhou@linux.dev> From: Hyeonggon Yoo <42.hyeyoo@gmail.com> Date: Wed, 22 Nov 2023 09:26:13 +0900 Message-ID: Subject: Re: [PATCH v5 1/9] slub: Reflow ___slab_alloc() 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 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]); Tue, 21 Nov 2023 16:26:42 -0800 (PST) On Thu, Nov 2, 2023 at 12:24=E2=80=AFPM wrote: > > From: Chengming Zhou > > The get_partial() interface used in ___slab_alloc() may return a single > object in the "kmem_cache_debug(s)" case, in which we will just return > the "freelist" object. > > Move this handling up to prepare for later changes. > > And the "pfmemalloc_match()" part is not needed for node partial slab, > since we already check this in the get_partial_node(). > > Signed-off-by: Chengming Zhou > Reviewed-by: Vlastimil Babka > Tested-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> > --- > mm/slub.c | 31 +++++++++++++++---------------- > 1 file changed, 15 insertions(+), 16 deletions(-) > > diff --git a/mm/slub.c b/mm/slub.c > index 63d281dfacdb..0b0fdc8c189f 100644 > --- a/mm/slub.c > +++ b/mm/slub.c > @@ -3216,8 +3216,21 @@ static void *___slab_alloc(struct kmem_cache *s, g= fp_t gfpflags, int node, > pc.slab =3D &slab; > pc.orig_size =3D orig_size; > freelist =3D get_partial(s, node, &pc); > - if (freelist) > - goto check_new_slab; > + if (freelist) { > + if (kmem_cache_debug(s)) { > + /* > + * For debug caches here we had to go through > + * alloc_single_from_partial() so just store the > + * tracking info and return the object. > + */ > + if (s->flags & SLAB_STORE_USER) > + set_track(s, freelist, TRACK_ALLOC, addr)= ; > + > + return freelist; > + } > + > + goto retry_load_slab; > + } > > slub_put_cpu_ptr(s->cpu_slab); > slab =3D new_slab(s, gfpflags, node); > @@ -3253,20 +3266,6 @@ static void *___slab_alloc(struct kmem_cache *s, g= fp_t gfpflags, int node, > > inc_slabs_node(s, slab_nid(slab), slab->objects); > > -check_new_slab: > - > - if (kmem_cache_debug(s)) { > - /* > - * For debug caches here we had to go through > - * alloc_single_from_partial() so just store the tracking= info > - * and return the object > - */ > - if (s->flags & SLAB_STORE_USER) > - set_track(s, freelist, TRACK_ALLOC, addr); > - > - return freelist; > - } > - > if (unlikely(!pfmemalloc_match(slab, gfpflags))) { > /* > * For !pfmemalloc_match() case we don't load freelist so= that Looks good to me, Reviewed-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> > -- > 2.20.1 >