Message ID | 20231024134637.3120277-11-surenb@google.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> 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 18CAEC00A8F for <linux-mm@archiver.kernel.org>; Tue, 24 Oct 2023 13:47:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 223196B026B; Tue, 24 Oct 2023 09:47:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 186546B026C; Tue, 24 Oct 2023 09:47:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EA18C6B026D; Tue, 24 Oct 2023 09:47:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id CE1EB6B026B for <linux-mm@kvack.org>; Tue, 24 Oct 2023 09:47:06 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id A96D21201F6 for <linux-mm@kvack.org>; Tue, 24 Oct 2023 13:47:06 +0000 (UTC) X-FDA: 81380481252.28.DD047C9 Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) by imf04.hostedemail.com (Postfix) with ESMTP id DBD5C4000D for <linux-mm@kvack.org>; Tue, 24 Oct 2023 13:47:04 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=1lPdMVO2; spf=pass (imf04.hostedemail.com: domain of 318o3ZQYKCHwxzwjsglttlqj.htrqnsz2-rrp0fhp.twl@flex--surenb.bounces.google.com designates 209.85.219.201 as permitted sender) smtp.mailfrom=318o3ZQYKCHwxzwjsglttlqj.htrqnsz2-rrp0fhp.twl@flex--surenb.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1698155224; 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=YHgfLVMScT5H/FxRnxJh+3xP9v/l17ghYQJMJklbWxc=; b=WS0/hVDpfR2rrQej0jer/pLt2pb36/kKVHEUQLK45Ha0neDl6xUbPXGMY1kKQiPc9hdJCS 8pEZvaO3msdGbin0XZ6N2gJf/oCpqduZB4w7r0TIRrmrmmf2RsrWKJAwbglBIinKFNtTCz p5hZYuVkppjwRzkE5jerjTkJO4Ys0UY= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1698155224; a=rsa-sha256; cv=none; b=n+ISNYKs4vX8BJ9uOIpJP/Ctw/xDlUIqYss9VruBcwNb0Q3h4+FEqdK68epWJRKMpYTpS6 n0Lbs6KKCnmtvS28Irq1nqqwWffdfZwe9NEps+gQC2+Jf+iKLiFnFapAMuojefhb4Bi+hn 08By+GfrJVwQBJ9cXd03/6jrmTSoYPA= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=1lPdMVO2; spf=pass (imf04.hostedemail.com: domain of 318o3ZQYKCHwxzwjsglttlqj.htrqnsz2-rrp0fhp.twl@flex--surenb.bounces.google.com designates 209.85.219.201 as permitted sender) smtp.mailfrom=318o3ZQYKCHwxzwjsglttlqj.htrqnsz2-rrp0fhp.twl@flex--surenb.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-d9cb4de3bf0so5405249276.0 for <linux-mm@kvack.org>; Tue, 24 Oct 2023 06:47:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1698155224; x=1698760024; 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=YHgfLVMScT5H/FxRnxJh+3xP9v/l17ghYQJMJklbWxc=; b=1lPdMVO24l9dsRE8+ytJXFTZOIUTDEgsr2EvbyprNiE87UFPFJQkl6OpgEBVmPrn1U rhf2Xv2pF0Yu78XXkQ0O5+P3TgMxJNRAchT0ODrtGruuTnel6SNEhQYu1IIXwQSk0RM4 QwRLn28Bcgp4Du5myBGli5G2bOj3JxQbF6XAsYqYJu2o+Dg3wfzXAsUKL4ENgWZDeHdk gxjUfO/+wW83LQDQC0nLdabr1qgfsXeW37MbtP6Vi1g6MJbYTCKtNJZ1otWo6VScg9jX eecOCcN8x1bXQ2h6QAdLQ/U9ZWNDvFcmYQsBkvQWXJfMYm5nA2pdvEMbJhEZO6gRkLWy AZ1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698155224; x=1698760024; 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=YHgfLVMScT5H/FxRnxJh+3xP9v/l17ghYQJMJklbWxc=; b=WMfBaP6oEEwrJ6u4aIm+sWQIai0W0ICtc7HY6V62gpqQuV0p3FWl2aIPy8Zd8P8iCP SRhaMAQy10LboExiWev0vL/5vUjxzXIe5ChRgXODjrKpdsQrO1eES03iAhwgJtosVAz/ St4KxffBqAQ3pgpbzZwCgJ5acbWxinQrzvpzBHG9hgLypO+ufqsenq+MBe1CO/8XPmCR qGqw78lgktoB0WRqAkd2s7f0ra3SxBS2vBwjqt7Xo4+woB9kmkQtlyKNNJRiOqyC7h4N +ocTT3jYYgzW3Lm5yrnya8ksmha49dpDwcPFuE/Pkct/oFiw2cOHqxnvxvHQYY3fA5NJ GkzA== X-Gm-Message-State: AOJu0Yw5vI4LDsqMqEsT3Dn1lE8WNuiXOR6fj54eF31TkpdfAOGqooXp HRdAwoAZmfITErnF8dw4VCXZiybXca4= X-Google-Smtp-Source: AGHT+IHeBKvEZxCc8z4s40S7ha5hgPZX8U0NGngnhsFR9kbksVyPLDfdSNwpUqF/X+vAqjdciG/7nvEnCYM= X-Received: from surenb-desktop.mtv.corp.google.com ([2620:15c:211:201:45ba:3318:d7a5:336a]) (user=surenb job=sendgmr) by 2002:a25:297:0:b0:d9a:4c45:cfd0 with SMTP id 145-20020a250297000000b00d9a4c45cfd0mr213074ybc.2.1698155223878; Tue, 24 Oct 2023 06:47:03 -0700 (PDT) Date: Tue, 24 Oct 2023 06:46:07 -0700 In-Reply-To: <20231024134637.3120277-1-surenb@google.com> Mime-Version: 1.0 References: <20231024134637.3120277-1-surenb@google.com> X-Mailer: git-send-email 2.42.0.758.gaed0368e0e-goog Message-ID: <20231024134637.3120277-11-surenb@google.com> Subject: [PATCH v2 10/39] mm: prevent slabobj_ext allocations for slabobj_ext and kmem_cache objects From: Suren Baghdasaryan <surenb@google.com> 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, 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, 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 Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: DBD5C4000D X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: wu5wremdzuf9qsp1piofgu8snb1mw4z9 X-HE-Tag: 1698155224-123761 X-HE-Meta: U2FsdGVkX1+UQqb17MlUV+QZQYzMQddBKD1PnQL0lVhB+g7lEOlRE9W8WwY9D3PgsR+gSmfq8Akt9VXcWqA6j1AJECDNcet/FbcoioZ5OdNqQI6qhNj/uwDI5y2PYZox3OF01owjHRGzZ/x+0Fb4hxBs60UrRmI2IuBQR4hJDJ+GhoaPKBF1b1AG1sWlsv1jodGTD7tQ6J/Bjj0dMHYgle26vVZg3lQNiJ8Id2PmYODVqDHCrhW1JmzxI3wPRSGOHogKAP3f3iZyFQj8kLQ5UKVwTIrOyn4H0i9zVURXtDbTUfL8oFk+FFk3XOqH75lTxWXvnD+5DfgHLTqb0bG0iZBiJliMT6+NkXPj8RXbLFk8Yl7FIiMD4c740XJHbYDChdTJ2qRwza1uES9ELrRuTnrpMsmSCT2MRW4+0RLI9a+skWSYvHe9AOcpBnkJkANJnemF44nZ0XasmByN+YEFOoM1vWvRYwfqZAvDZtgzXWhUH2oT8D/OaVcBFTgko1S5kzCHKYJxW6MmBMhAT2a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xk5mSXM4v89eigoMhYZsxROcxYgZXi9kPxRH73/6enjHXhUQH9Xmb2zIfqTN7LvVTHln8HfO5m6Oje2BGaMg0PQIH7hVvuyXpy5SDmhtEpo59ZPfPI34eC59rdh 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: <linux-mm.kvack.org> List-Subscribe: <mailto:majordomo@kvack.org> List-Unsubscribe: <mailto:majordomo@kvack.org> |
Series |
Memory allocation profiling
|
expand
|
diff --git a/mm/slab.h b/mm/slab.h index 5a47125469f1..187acc593397 100644 --- a/mm/slab.h +++ b/mm/slab.h @@ -489,6 +489,12 @@ prepare_slab_obj_exts_hook(struct kmem_cache *s, gfp_t flags, void *p) if (!need_slab_obj_ext()) return NULL; + if (s->flags & SLAB_NO_OBJ_EXT) + return NULL; + + if (flags & __GFP_NO_OBJ_EXT) + return NULL; + slab = virt_to_slab(p); if (!slab_obj_exts(slab) && WARN(alloc_slab_obj_exts(slab, s, flags, false), diff --git a/mm/slab_common.c b/mm/slab_common.c index 2b42a9d2c11c..446f406d2703 100644 --- a/mm/slab_common.c +++ b/mm/slab_common.c @@ -222,6 +222,8 @@ int alloc_slab_obj_exts(struct slab *slab, struct kmem_cache *s, void *vec; gfp &= ~OBJCGS_CLEAR_MASK; + /* Prevent recursive extension vector allocation */ + gfp |= __GFP_NO_OBJ_EXT; vec = kcalloc_node(objects, sizeof(struct slabobj_ext), gfp, slab_nid(slab)); if (!vec)
Use __GFP_NO_OBJ_EXT to prevent recursions when allocating slabobj_ext objects. Also prevent slabobj_ext allocations for kmem_cache objects. Signed-off-by: Suren Baghdasaryan <surenb@google.com> --- mm/slab.h | 6 ++++++ mm/slab_common.c | 2 ++ 2 files changed, 8 insertions(+)