Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp7250866rwr; Tue, 2 May 2023 11:39:20 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4z8wm62k1gi/NJI/Rj1F3tpafXqrWPu9DlrqgKmlTTYVAeUQKKCXoFJt99lGdkCNq2McSr X-Received: by 2002:a17:90b:1b50:b0:24d:f95f:cff1 with SMTP id nv16-20020a17090b1b5000b0024df95fcff1mr8001662pjb.0.1683052760359; Tue, 02 May 2023 11:39:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683052760; cv=none; d=google.com; s=arc-20160816; b=FHMSX7zKAD3e3cncpWa4UrwHMELMb/xXejDU2y/kAOld/7Suu47Z+TlrPjAh6wBby5 BwgGtHReQj5PG+eSyqolSkt/ftHQCt1X1EJWnONF8/aC6afgo9wAxevLk83ZnacHlrPy lSg+MK8jtBITRJQFewaNCj+VFUjRR0IaS0hNLSu8BhP7rGz5QxMd39pFYTcKv/TvHWUn 0p+1PqXPCfuFFLecTmf4U4FOcOwp/n7Sf2y05CAnyY0oTousiplMXcBDxDOnMjnODVh1 wNxSRitM5RToe/B/H11eS1NJ4fdAIY0cPucAl+SlOVyfpzdwzXULf4+gJIXkCaeGa9Ed VPTQ== 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=1HVL3xDTGrQVKytv3307oE4wI2qXt6O5pXdSbfIsmfw=; b=PQG29hS/U/LSqi7gZ6mNVU0PkhDS5/eenC1O5FuG43qpa8DRoZnSm62y9Q5Jj+IZ0X qQ/Y1IFA9qNlnJUI1M2/iS74TaxKIFZWh0VPm4FUOs6Rb1/5prJusAOUsqVkFB57IPVe b9BJ5kDklUoXNWJ5r8UBnnNOhuVguO5x7b5xx22Zfn2tsM3xoXSjVs/1MYiJ9NgAp4fg LZz8BAMzwIXs0zu9zDWVrz2+KqjB6ZTko1cdtHF2AuuYQpQgppcS8tGqZBP+zNeYckwP Kj3wE2vIff0S8IkZbdwXKKuXpEzGYdD610zraMy7M8VVPx3pSemxPI46RybWPL7uauVP g7rw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=1qOKHMcI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ck13-20020a17090afe0d00b00246973aef88si26343649pjb.29.2023.05.02.11.39.06; Tue, 02 May 2023 11:39:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=1qOKHMcI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233959AbjEBSdd (ORCPT + 99 others); Tue, 2 May 2023 14:33:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229703AbjEBSdb (ORCPT ); Tue, 2 May 2023 14:33:31 -0400 Received: from mail-yb1-xb2c.google.com (mail-yb1-xb2c.google.com [IPv6:2607:f8b0:4864:20::b2c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 57F2E9B for ; Tue, 2 May 2023 11:33:27 -0700 (PDT) Received: by mail-yb1-xb2c.google.com with SMTP id 3f1490d57ef6-b99f0a0052fso5863983276.3 for ; Tue, 02 May 2023 11:33:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1683052406; x=1685644406; 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=1HVL3xDTGrQVKytv3307oE4wI2qXt6O5pXdSbfIsmfw=; b=1qOKHMcI8DulkSfoRMvX8Pr+Zk5uyPKcuzTjDblLNP1XefPQJkSAxIcSan4hxrkYmM mijXYJDbwYfBriku1yo2jZFFkuGOQV27nGEoociEa+x4EBkt6xdc8TTdBr8ExPJqJxj3 I+cfPJCKCtCybq2dUPwiVCF4ankuJVJJAVwM7AetAdBoRpl61AdRNAdTS18dObY9arIk e9qSsTvg8C0oNmcsYUHHNiUOhvlpSnEvLmwlJBc13gXCsXeR7WXU4bYyLgUPMLC/5oWj 1vsg/b1NFVc8TUatQihkDpPMckBOmQMwujeGiTah+4Xw72cOHRDooXz8s6AG9qHHNqgj yg7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683052406; x=1685644406; 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=1HVL3xDTGrQVKytv3307oE4wI2qXt6O5pXdSbfIsmfw=; b=A0Mc+2M8NwaltaCSPyk+VwTrNPD4+gM3jRTa/qM8PGQ8opqd1Iysv7Foez3r9xIC1B cxfGKPf8jWs+ExaUqjeKamqxibwpYX36kxAf8RmXTZho3canA8GV6T9ckEfjZzd0ZsXt Rk5JXGs66LskDtAT3G1asWUpG3G4rml9RcRwKY2VkVvifPnUgD0oqZAfY/ZBrymbbhq2 kagskYZc5b6wqPW/Mvx4rli1Tw25OL3/I642ya1oFRfVqTrXb6zuwbCZG6pGZsg1C+nY G5vaU25TjubiG8Fi/bhPLM3fMkd3l9OmebUNFzXChk60SEnFIuSX+/RspO3ANvR7r0NE rJAQ== X-Gm-Message-State: AC+VfDzz3/wQs063QgNY17FNsiOAwN9XU+aC77rSF5QMtBhZ7bhRU+SO P7cuLBKKFElwfhdK62bh1t7uiubtIV2Fe/sdEqh1XQ== X-Received: by 2002:a25:4115:0:b0:b9e:9159:6a0c with SMTP id o21-20020a254115000000b00b9e91596a0cmr1235704yba.6.1683052406321; Tue, 02 May 2023 11:33:26 -0700 (PDT) MIME-Version: 1.0 References: <20230501165450.15352-1-surenb@google.com> <20230501165450.15352-10-surenb@google.com> <20230502145014.24b28e64@meshulam.tesarici.cz> In-Reply-To: <20230502145014.24b28e64@meshulam.tesarici.cz> From: Suren Baghdasaryan Date: Tue, 2 May 2023 11:33:15 -0700 Message-ID: Subject: Re: [PATCH 09/40] mm: introduce __GFP_NO_OBJ_EXT flag to selectively prevent slabobj_ext creation To: =?UTF-8?B?UGV0ciBUZXNhxZnDrWs=?= Cc: akpm@linux-foundation.org, kent.overstreet@linux.dev, mhocko@suse.com, vbabka@suse.cz, hannes@cmpxchg.org, roman.gushchin@linux.dev, mgorman@suse.de, dave@stgolabs.net, willy@infradead.org, liam.howlett@oracle.com, corbet@lwn.net, void@manifault.com, peterz@infradead.org, juri.lelli@redhat.com, ldufour@linux.ibm.com, catalin.marinas@arm.com, will@kernel.org, arnd@arndb.de, tglx@linutronix.de, mingo@redhat.com, dave.hansen@linux.intel.com, x86@kernel.org, peterx@redhat.com, david@redhat.com, axboe@kernel.dk, mcgrof@kernel.org, masahiroy@kernel.org, nathan@kernel.org, dennis@kernel.org, tj@kernel.org, muchun.song@linux.dev, rppt@kernel.org, paulmck@kernel.org, pasha.tatashin@soleen.com, yosryahmed@google.com, yuzhao@google.com, dhowells@redhat.com, hughd@google.com, andreyknvl@gmail.com, keescook@chromium.org, ndesaulniers@google.com, gregkh@linuxfoundation.org, ebiggers@google.com, ytcoode@gmail.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, bristot@redhat.com, vschneid@redhat.com, cl@linux.com, penberg@kernel.org, iamjoonsoo.kim@lge.com, 42.hyeyoo@gmail.com, glider@google.com, elver@google.com, dvyukov@google.com, shakeelb@google.com, songmuchun@bytedance.com, jbaron@akamai.com, rientjes@google.com, minchan@google.com, kaleshsingh@google.com, kernel-team@android.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, iommu@lists.linux.dev, linux-arch@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-modules@vger.kernel.org, kasan-dev@googlegroups.com, cgroups@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 2, 2023 at 5:50=E2=80=AFAM Petr Tesa=C5=99=C3=ADk wrote: > > On Mon, 1 May 2023 09:54:19 -0700 > Suren Baghdasaryan wrote: > > > Introduce __GFP_NO_OBJ_EXT flag in order to prevent recursive allocatio= ns > > when allocating slabobj_ext on a slab. > > > > Signed-off-by: Suren Baghdasaryan > > --- > > include/linux/gfp_types.h | 12 ++++++++++-- > > 1 file changed, 10 insertions(+), 2 deletions(-) > > > > diff --git a/include/linux/gfp_types.h b/include/linux/gfp_types.h > > index 6583a58670c5..aab1959130f9 100644 > > --- a/include/linux/gfp_types.h > > +++ b/include/linux/gfp_types.h > > @@ -53,8 +53,13 @@ typedef unsigned int __bitwise gfp_t; > > #define ___GFP_SKIP_ZERO 0 > > #define ___GFP_SKIP_KASAN 0 > > #endif > > +#ifdef CONFIG_SLAB_OBJ_EXT > > +#define ___GFP_NO_OBJ_EXT 0x4000000u > > +#else > > +#define ___GFP_NO_OBJ_EXT 0 > > +#endif > > #ifdef CONFIG_LOCKDEP > > -#define ___GFP_NOLOCKDEP 0x4000000u > > +#define ___GFP_NOLOCKDEP 0x8000000u > > So now we have two flags that depend on config options, but the first > one is always allocated in fact. I wonder if you could use an enum to > let the compiler allocate bits. Something similar to what Muchun Song > did with section flags. > > See commit ed7802dd48f7a507213cbb95bb4c6f1fe134eb5d for reference. Thanks for the reference. I'll take a closer look and will try to clean it = up. > > > #else > > #define ___GFP_NOLOCKDEP 0 > > #endif > > @@ -99,12 +104,15 @@ typedef unsigned int __bitwise gfp_t; > > * node with no fallbacks or placement policy enforcements. > > * > > * %__GFP_ACCOUNT causes the allocation to be accounted to kmemcg. > > + * > > + * %__GFP_NO_OBJ_EXT causes slab allocation to have no object > > extension. */ > > #define __GFP_RECLAIMABLE ((__force gfp_t)___GFP_RECLAIMABLE) > > #define __GFP_WRITE ((__force gfp_t)___GFP_WRITE) > > #define __GFP_HARDWALL ((__force gfp_t)___GFP_HARDWALL) > > #define __GFP_THISNODE ((__force gfp_t)___GFP_THISNODE) > > #define __GFP_ACCOUNT ((__force gfp_t)___GFP_ACCOUNT) > > +#define __GFP_NO_OBJ_EXT ((__force gfp_t)___GFP_NO_OBJ_EXT) > > > > /** > > * DOC: Watermark modifiers > > @@ -249,7 +257,7 @@ typedef unsigned int __bitwise gfp_t; > > #define __GFP_NOLOCKDEP ((__force gfp_t)___GFP_NOLOCKDEP) > > > > /* Room for N __GFP_FOO bits */ > > -#define __GFP_BITS_SHIFT (26 + IS_ENABLED(CONFIG_LOCKDEP)) > > +#define __GFP_BITS_SHIFT (27 + IS_ENABLED(CONFIG_LOCKDEP)) > > If the above suggestion is implemented, this could be changed to > something like __GFP_LAST_BIT (the enum's last identifier). Ack. Thanks for reviewing! Suren. > > Petr T