From patchwork Mon Sep 18 15:32:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Potapenko X-Patchwork-Id: 141494 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp2834596vqi; Mon, 18 Sep 2023 10:39:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE5hmdoquAq0k8ZEQlK33T8PYX13Dw4ZaUOfhT38BDzOojrsrdTW75PFc9RfTF6Ku+nXVqi X-Received: by 2002:a17:90b:23c4:b0:259:466:940f with SMTP id md4-20020a17090b23c400b002590466940fmr7059466pjb.22.1695058748244; Mon, 18 Sep 2023 10:39:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695058748; cv=none; d=google.com; s=arc-20160816; b=bknjPzmSqlqnyeH7RhXkpVHn5No2yA9EG1rDeIWtmZCf6caLh5EHV36hMR/1YZYgAU 0jscQ1YYVuuCNyMGkcnIuEtkvScCOM/+H7uQj9AsAbsOhJS24VJH/ySzPSHVVxAa80Fd BykkOxPZJ4Pk7ruHboF5JABGNHvcqJBZDPCqvTyWx6lQp8+G2wptOBGoGZsRFUDWluBM 3r9lFFt5ITKsLzZNCmudYys5rjnviqoRubVjveoLGuK1x3ulGBE8kxxK7lYA1fdXitUB 4Vn2ZIXE9lX7CjoHcxVodzZP4MTUnU2Twmy17DFIzEImLjC/rOe8FTNsHyICrsAthVJG O0dw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:mime-version:date :dkim-signature; bh=jIAk2l8FHhw3IMNFzU025ohtjmLkXGN9K/jxVvhfHgc=; fh=vyR805lIGMlJ9t/xQlmYYFFqFR6KUl8CN56S682SHGU=; b=b2xMJIzMaKILnPPx6+d4Br6tCor6SP5+IEoUxmJ+m3A+YbViLN6c1E7+CADbyxHUle o8m259v1yPq+M9gQqyTt4jarqF827pbZgVlbyvGdVlXvH1oZHtZws2q/Qn0lUVv2Hdcb 8IqCINJ0kb6P4o7+QtwLSbm2Fnjl0iM+fODOz8tF4BBLtnFQrJAyVRQvkIqoSPQu5Gc8 ha9NRVlnmZe+eN4nISp2AmYfZMuZce3fdYpIt3SA5XzltjryjidaTZhVxU0oXpT9k8QG ncb8g/yzMtd15wMJrYig4Ft9L2IuHTjwtLBUzvM/IbS/+ErZp2TThv5uyFne6st3jwHD TYnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=cVJya7SG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id s8-20020a17090ad48800b0027455c727f5si8409819pju.84.2023.09.18.10.39.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Sep 2023 10:39:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=cVJya7SG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id C2C2080B19DF; Mon, 18 Sep 2023 08:37:46 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229445AbjIRPh2 (ORCPT + 26 others); Mon, 18 Sep 2023 11:37:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229472AbjIRPh1 (ORCPT ); Mon, 18 Sep 2023 11:37:27 -0400 Received: from mail-wm1-x349.google.com (mail-wm1-x349.google.com [IPv6:2a00:1450:4864:20::349]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 905BA1998 for ; Mon, 18 Sep 2023 08:35:20 -0700 (PDT) Received: by mail-wm1-x349.google.com with SMTP id 5b1f17b1804b1-402d63aeea0so36520365e9.2 for ; Mon, 18 Sep 2023 08:35:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1695051165; x=1695655965; darn=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=jIAk2l8FHhw3IMNFzU025ohtjmLkXGN9K/jxVvhfHgc=; b=cVJya7SGwuir6CJhIpajM68/heZe5B+pSsxnBEc/3ocVl2x1z00NtcFlwGF65MTNzh GREJtCRbBVDgQknrfT0Dysbj9I2XlBHQ73jvj/QYEQOKr4T1cdfDhP7iSq91AfO3Mmv5 iOy5Yh6OuJSwJcavN85F3dHnHQt6L3R+ss/7RHiAtn2fENaDgD4+JbwACBklLc6QmKC3 FlmouhDQh4McaiSj1BG7c8SStyckAIUd3XKk6i+0YxQPk0q+yLwbiLVnenxaG3zsAOY2 W/7mZnBDcO/d3ZZVl1WGlrxFcZQc5FSBl+jEdwDW7qjbEtwuB8boyTtYcN+7bSsrN5+e PjBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695051165; x=1695655965; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=jIAk2l8FHhw3IMNFzU025ohtjmLkXGN9K/jxVvhfHgc=; b=D5GR+YVwQGKKJpDhZuOOb/0A0Ei5xYnkLykrruaPtCY7ANHKOXXQnpxSRCN0POUaxj XkarXQ5xW/l9f6Ytqb6doh7j+eiC3DEEv90J81Od4ZRLrrNPT4/QWQHA+lOFsFXheyZx lOTEaMprGVgcrSkB4eikPEC56MdBINpGAWh8pcjXlb70yO/1YRH0v2l0DCmnmhMVEBuf 01YU6WuC+Lhyewbe89I8vWzg072jHTzE4/GuaOiVGsiKIyrAgA6wgcwaT9kJ2rJK9+OM d3NaJnMNOOvNIZ06noLU8Y4sSks+zTaQ28u8dQ6Vnic5+1WhN1SF/kK/jaqZFMSqv/XR sqTg== X-Gm-Message-State: AOJu0YzpCQ0iyzmWVRBZKCt94cgvoxe4lDfcqpeVp4P0vBGwUCZZcF6E yWTot1LFf7peXqpb8ozvLw7HazZLrnM= X-Received: from glider.muc.corp.google.com ([2a00:79e0:9c:201:dffe:ac34:a8e2:f442]) (user=glider job=sendgmr) by 2002:a5d:4b4f:0:b0:317:f046:25e6 with SMTP id w15-20020a5d4b4f000000b00317f04625e6mr101610wrs.2.1695051165285; Mon, 18 Sep 2023 08:32:45 -0700 (PDT) Date: Mon, 18 Sep 2023 17:32:41 +0200 Mime-Version: 1.0 X-Mailer: git-send-email 2.42.0.459.ge4e396fd5e-goog Message-ID: <20230918153241.2942764-1-glider@google.com> Subject: [PATCH v1] mm: make __GFP_BITS_SHIFT independent of CONFIG_LOCKDEP From: Alexander Potapenko To: glider@google.com, dvyukov@google.com, elver@google.com, akpm@linux-foundation.org, mingo@kernel.org, linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.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 (morse.vger.email [0.0.0.0]); Mon, 18 Sep 2023 08:37:46 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777397922021781554 X-GMAIL-MSGID: 1777397922021781554 The list of GFP flags is sparse already (see 0x200u and flags defined based on CONFIG_KASAN_HW_TAGS), so it makes little sense to save one bit at the end of it if CONFIG_LOCKDEP is undefined. The dependence of __GFP_BITS_SHIFT on CONFIG_LOCKDEP also does not let us add new flags after ___GFP_NOLOCKDEP. Signed-off-by: Alexander Potapenko --- An alternative to this patch would be putting all ___GFP_ flags into enum, so that we they occupy as few bits as possible. My understanding is that this is doable, because tools/perf/builtin-kmem.c does not depend on the flag values, but maybe I am missing something? --- include/linux/gfp_types.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/gfp_types.h b/include/linux/gfp_types.h index 6583a58670c57..bb8d3b31e3b6d 100644 --- a/include/linux/gfp_types.h +++ b/include/linux/gfp_types.h @@ -249,7 +249,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) #define __GFP_BITS_MASK ((__force gfp_t)((1 << __GFP_BITS_SHIFT) - 1)) /**