From patchwork Mon Feb 12 21:38:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suren Baghdasaryan X-Patchwork-Id: 13554044 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1EE20C4829D for ; Mon, 12 Feb 2024 21:39:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 83AF16B0082; Mon, 12 Feb 2024 16:39:48 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7747A6B0083; Mon, 12 Feb 2024 16:39:48 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5CAD26B0085; Mon, 12 Feb 2024 16:39:48 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 442026B0082 for ; Mon, 12 Feb 2024 16:39:48 -0500 (EST) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 19AE240B16 for ; Mon, 12 Feb 2024 21:39:48 +0000 (UTC) X-FDA: 81784469256.09.ADB1309 Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.202]) by imf24.hostedemail.com (Postfix) with ESMTP id 5FBF5180005 for ; Mon, 12 Feb 2024 21:39:46 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=drlIHIKJ; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf24.hostedemail.com: domain of 3IZDKZQYKCKASURENBGOOGLE.COMLINUX-MMKVACK.ORG@flex--surenb.bounces.google.com designates 209.85.128.202 as permitted sender) smtp.mailfrom=3IZDKZQYKCKASURENBGOOGLE.COMLINUX-MMKVACK.ORG@flex--surenb.bounces.google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1707773986; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=NFEoAydGNCIakLM+oYHcpcvSKcGKjy30qzf4+mOY1ag=; b=57HwhQyffsjjg9Z6p2UbRywwwSOoYyjyY4N7jtrJa6/a8CpzJYnWXEG/H6rkKRXZ1qjbTW 5xFOpdV9lqZ3bqNZNmLNFFZ5YChbpdUf1aUUCSQNTtBn5LRhMD/FqrplbmzomvLCMDpbnO 64YmfBU0R57rk1EVxR0bOBSKWIi8niM= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=drlIHIKJ; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf24.hostedemail.com: domain of 3IZDKZQYKCKASURENBGOOGLE.COMLINUX-MMKVACK.ORG@flex--surenb.bounces.google.com designates 209.85.128.202 as permitted sender) smtp.mailfrom=3IZDKZQYKCKASURENBGOOGLE.COMLINUX-MMKVACK.ORG@flex--surenb.bounces.google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1707773986; a=rsa-sha256; cv=none; b=RPh1Z+z7fInwxb4qbhaG8J0UYw3DtY/i3zMYynbJqDYY4VHNkSf/QEyPCfolhJYSmVS1ND Wdp8mGoBQM6080C3TfxASfTQG49Br+OslHA/Qg9glBuZV/cE6eAcAJxEo8ewL3dWUbQbr/ mocWjIlMpDQyeCJaTaUfSYlyx8yILEs= Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-6077ca6e1e1so4673997b3.2 for ; Mon, 12 Feb 2024 13:39:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1707773985; x=1708378785; darn=kvack.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=NFEoAydGNCIakLM+oYHcpcvSKcGKjy30qzf4+mOY1ag=; b=drlIHIKJ1KlCE4phsUHegso0p4FEd4mqaDC/GCFnk1ZIXrWYUEU9919BJue6Xs5V+F WosgaQytDyE7o9WTBWYmxeZjAVjXoqSSF/SRm++qaCQShsmIkhv6WZTrj/No3cfNQw9E aFSAdJYzQTDe5aUEhcsNnW5huC+kkNGyWIJCxEZH4pCzF8v4waEeirQexnXShpw328S8 z/W9S59RljjbYgdWvChDarzdi/5Fm7gKqc1k1GxFFwEFoErz/68o7sfqDjdlF619xOF6 u0FS7ybsyjtBQqoWM3g4ElUVFRGHu9Uwkahp1KSWtw0jFtHQk3eb9dFYVOOi5k4Q46qR PTaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707773985; x=1708378785; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=NFEoAydGNCIakLM+oYHcpcvSKcGKjy30qzf4+mOY1ag=; b=hGXjlHqnygyAksUQGP1gTaslzapn4XbsUIav7RHYP1tgDO429EBPCK//T3rAUL67ms rWTL6jkAwJ3hBVypMj/N4F+7v3Nj0cqFavr5T52+CIjIFjlxsW8xFMD+UIdseHqDEJLO x+cRPMmkRrIWXFVIW7ygu3Yf2sRbrL0WceIyQKk1DJngvyPfyAdUoRN0GxEOTj2JIrqs dhp1puQoz1OuKHn5X8SZ/AawQqHvYzfll/YEwtlyqv0VFFnaFQLP1ocbKwcfpEjhlV/U tWbtxBJcnvm1V+6JLXXw+bw6FI9zTPaj7N0NzHI/cHrbQmsWeY0APmGk8LmXytBWSmkV 1MZg== X-Gm-Message-State: AOJu0YzCcGwBDYdqjr7tJaoCElKn/6mV4UzPTHKKBwfTIslInPDnkwQ4 vG0qsltL7TZjBN12J/m7cU+QM7abG5p3Hu3q4J+XzgkscOoV+oLTI5/e0gKfTqrid3hVRrGBL+r chg== X-Google-Smtp-Source: AGHT+IHWeYeSfs9VSWCME9Zm5O2fUep/uRibBNlRqA9VaQU1CvkyHMwI5g7LZivFcfiaDsVBzBtyLk+b/OQ= X-Received: from surenb-desktop.mtv.corp.google.com ([2620:15c:211:201:b848:2b3f:be49:9cbc]) (user=surenb job=sendgmr) by 2002:a81:a003:0:b0:607:8294:7631 with SMTP id x3-20020a81a003000000b0060782947631mr42744ywg.10.1707773985395; Mon, 12 Feb 2024 13:39:45 -0800 (PST) Date: Mon, 12 Feb 2024 13:38:52 -0800 In-Reply-To: <20240212213922.783301-1-surenb@google.com> Mime-Version: 1.0 References: <20240212213922.783301-1-surenb@google.com> X-Mailer: git-send-email 2.43.0.687.g38aa6559b0-goog Message-ID: <20240212213922.783301-7-surenb@google.com> Subject: [PATCH v3 06/35] mm: introduce __GFP_NO_OBJ_EXT flag to selectively prevent slabobj_ext creation From: Suren Baghdasaryan To: akpm@linux-foundation.org Cc: 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, 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, vvvvvv@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, surenb@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 X-Rspamd-Queue-Id: 5FBF5180005 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: swzckcw3nsfh6u8d4cbpof9k3nd3cpph X-HE-Tag: 1707773986-50095 X-HE-Meta: U2FsdGVkX1+DwJ9V/up9QHu3aGulSesaaTGFWVU3bipPXoB4slEyt4krrVmZUlFtj0/50DwzjPGqnFXVRl+9wuRc5IpxLHFX7/rn/05rRb5NSM2GPl42XH3I2/V5nrlsd1StdFfxZ95BjEM6+z5kC+fxzuSgOetLr3NE6CNhvacYigwnqKQammyuL/4DVpz3PvbMHxln6t4H+JdTPGkiAM9drgi9JgS6pxEhZhJRFNmQdFORCjWd0p5uuT98CRatyRhd1eyk30/VDjyn/f+CXWyvqeOX8d1dl7jsXQ9eTt8sQIVmICChthJ7aVYmK6zPwX6HCes3k9qPxf0VmRG7Rzm0m5trUl2Ge8HXsWDgavx80Z87jWv2Qpu2EciVI2t9nxZtLTS0kdIN5BSgd5MjlouCvqEcdoO5sCy7muzglGhU27/sFMAznQlEnJxE7ER3bGhhXrHAujE/5iZLcpYPblRJgsvoHBHP76VOU96e42uGfKzhUarS7ITi5WSIebyZT7CajUG5T5QFqvbIN89bKs/ZJHjKteDHWIRG4gUJkElDpxJ7j3chf8hblGgXVoZ0G8tton5HiYxdRblWOaefQx4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NDUZryaUywEdk2wNZo4iXI1A7psW4+7qUT0zNzTBdV2+JtGDb+DNK1Bp X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Introduce __GFP_NO_OBJ_EXT flag in order to prevent recursive allocations when allocating slabobj_ext on a slab. Signed-off-by: Suren Baghdasaryan Reviewed-by: Kees Cook --- include/linux/gfp_types.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/include/linux/gfp_types.h b/include/linux/gfp_types.h index 868c8fb1bbc1..e36e168d8cfd 100644 --- a/include/linux/gfp_types.h +++ b/include/linux/gfp_types.h @@ -52,6 +52,9 @@ enum { #endif #ifdef CONFIG_LOCKDEP ___GFP_NOLOCKDEP_BIT, +#endif +#ifdef CONFIG_SLAB_OBJ_EXT + ___GFP_NO_OBJ_EXT_BIT, #endif ___GFP_LAST_BIT }; @@ -93,6 +96,11 @@ enum { #else #define ___GFP_NOLOCKDEP 0 #endif +#ifdef CONFIG_SLAB_OBJ_EXT +#define ___GFP_NO_OBJ_EXT BIT(___GFP_NO_OBJ_EXT_BIT) +#else +#define ___GFP_NO_OBJ_EXT 0 +#endif /* * Physical address zone modifiers (see linux/mmzone.h - low four bits) @@ -133,12 +141,15 @@ enum { * 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