From patchwork Wed Feb 21 19:40:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suren Baghdasaryan X-Patchwork-Id: 13566200 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 B9A7DC5478A for ; Wed, 21 Feb 2024 19:41:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7160C6B00AD; Wed, 21 Feb 2024 14:41:43 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 69D2E6B00AE; Wed, 21 Feb 2024 14:41:43 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4AAF36B00AF; Wed, 21 Feb 2024 14:41:43 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 2698F6B00AD for ; Wed, 21 Feb 2024 14:41:43 -0500 (EST) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 00960160B58 for ; Wed, 21 Feb 2024 19:41:42 +0000 (UTC) X-FDA: 81816830886.02.A8C73DF Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) by imf23.hostedemail.com (Postfix) with ESMTP id 6448A140006 for ; Wed, 21 Feb 2024 19:41:41 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=XUfTpFmJ; spf=pass (imf23.hostedemail.com: domain of 39FHWZQYKCCcVXUHQEJRRJOH.FRPOLQXa-PPNYDFN.RUJ@flex--surenb.bounces.google.com designates 209.85.219.201 as permitted sender) smtp.mailfrom=39FHWZQYKCCcVXUHQEJRRJOH.FRPOLQXa-PPNYDFN.RUJ@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=1708544501; 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=tPPJBer4xtwbKjpAS2Ohhk9ejLfkpDLeASf186TPNEc=; b=zA2JfVA+d08fwfwMqaqjTJO804Xoa4WQEwgzWQjv6MWe1N0AnlscLkagUGNm/kxirmwhHu SAyJuzng9EPywYa3/DFA8lG/mpQGS74QcblNZzfDcdQ8ogd95Dos0SkofDTGa7Ndffk9a1 7yOvAgxGM7iH3ES8ODvUc44m9L8bZDs= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708544501; a=rsa-sha256; cv=none; b=NCtwfmaWLSXTMklhBWsNr9PZcCvwn0ZClD1VT/DYXTqCVVNIN4VdRUJE30JUDtRjlNMMk4 NKsOxsd59NhVST9w3r/mqwtyr1eI4gzL3U5SbHg4bbM5ijOWVouajMbTCKEehsphWZFW0q D0YVtzJVveBGdUjMAeemfLD3XfTcPiw= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=XUfTpFmJ; spf=pass (imf23.hostedemail.com: domain of 39FHWZQYKCCcVXUHQEJRRJOH.FRPOLQXa-PPNYDFN.RUJ@flex--surenb.bounces.google.com designates 209.85.219.201 as permitted sender) smtp.mailfrom=39FHWZQYKCCcVXUHQEJRRJOH.FRPOLQXa-PPNYDFN.RUJ@flex--surenb.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-dc6b26783b4so6791556276.0 for ; Wed, 21 Feb 2024 11:41:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1708544500; x=1709149300; 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=tPPJBer4xtwbKjpAS2Ohhk9ejLfkpDLeASf186TPNEc=; b=XUfTpFmJgUpzhcnYnCbU4a/N7sA/A5JX0ylTJMpeGVq3JL4eb7oU6JfM4INUYdERkQ CHZkdQbC6sK+VnHAjq2P3xgSlEE1FnORosiWhxhJV3F/3ppkNS+69uqfME+RzE9n9U0z 0RREWqy5viXnpVtoZtuNsijrGgLCZ5HJJoHM2giO8v/nzOisq64S70ibiD+T1g7x06gh +dDHN1NCceIJYxI8EL15Qj8aTyF8tVyS4Wuu+QjpfWhzCzqGszM/nstUD2jM8PkxWMmO 2MNWe9wwxEGKQQ7TW1sOKD4J6zzuer9FX2GJnwiGWh2V8VksEbNQRXZiQy73NS+8j+Og wgHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708544500; x=1709149300; 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=tPPJBer4xtwbKjpAS2Ohhk9ejLfkpDLeASf186TPNEc=; b=Yh9pkCkCr98kxBoPfJSL2vgZ1PR8eMfRTsXzsZT46S03XZf3aIqMRvsJjeBYbSudKK HcvhZIUMP0aFLl5Vhic7TFQyD1D/ZRL6O576ycg4pRZdWdiM9Z2bK78j2qH02FPjI29Z 0N4GaxmaYIpcc8bYeN3sswSfsNPkTXDH047DmFq3KfUWYSuK1dDyGgIW9guiPpmIBQzz qX8QDN7CR6u6gdGQ1MfqgUXNtnzpxPeNdlZqI8IcuitF2sieQMM0Bg5XlPyDfCBMSSkj XTaxYyxB5aCFjFnVD816quyRBFLkDZzrgmODTbOhkk2iE5oO8Q4fAGhObxrLpBqDmrGo EKnQ== X-Forwarded-Encrypted: i=1; AJvYcCWqRxtP9i/6GpAJ1RJS7VLbS6EZOX4Ayj+KXHcEZ6lNGF41Zf4E8arevTTI8MeW1XCQhj/Ydk93xsGb35+7CWARK4o= X-Gm-Message-State: AOJu0Yz2UGQcdVbhy6eQMe4NhWiHwysrsjKahAiOxXpolT7j6AngUtBo 33sBUk9YaBQGFKXp2HjicSnH4Bjdl1t4PXYEALMRk4O2j2MuXrkb4nzsNy8bmN6Ze6kFBVSx5xr uhw== X-Google-Smtp-Source: AGHT+IFeU9fBllBbqeIlv/z5gUqfuWqisiGNNlq6CXUqUD/DUi+PbsZNeU43mHL5nXzTrIUoTAFCk30SjNk= X-Received: from surenb-desktop.mtv.corp.google.com ([2620:15c:211:201:953b:9a4e:1e10:3f07]) (user=surenb job=sendgmr) by 2002:a05:6902:1008:b0:dbe:387d:a8ef with SMTP id w8-20020a056902100800b00dbe387da8efmr14985ybt.1.1708544500266; Wed, 21 Feb 2024 11:41:40 -0800 (PST) Date: Wed, 21 Feb 2024 11:40:33 -0800 In-Reply-To: <20240221194052.927623-1-surenb@google.com> Mime-Version: 1.0 References: <20240221194052.927623-1-surenb@google.com> X-Mailer: git-send-email 2.44.0.rc0.258.g7320e95886-goog Message-ID: <20240221194052.927623-21-surenb@google.com> Subject: [PATCH v4 20/36] mm/page_ext: enable early_page_ext when CONFIG_MEM_ALLOC_PROFILING_DEBUG=y 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, penguin-kernel@i-love.sakura.ne.jp, 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: 6448A140006 X-Rspam-User: X-Stat-Signature: 7fy3ay35otqxa59p8g4qagojnz7njxho X-Rspamd-Server: rspam03 X-HE-Tag: 1708544501-613161 X-HE-Meta: U2FsdGVkX1/uo6Psgv+4T6ni1sc4lrpdecGqyOywTe96i6pj/joLOrnYzJbnm0mSjevlct1/9tPW27fQmxm1G9YVUacYnmheQIvnaoRiYxmGr2yn0qHQTja7zg9A2oBzxHaXyc2b/0p2hQ2Xnx3TnQIEdpPw3m9mQWzTDrDDfSSdlJmmr2M8Vl03+xKckoTV9MsANODjaUH7BFX7BmJj7NuVwys2+yMMrBM3VXvijQ8q6N64gjMyfTDb97/KWS4ND+1QdFpL0G5xoHqEDU7dCWRtE3bfXA0QdvrLKGfGWOu85u6ohsnRORtnvbhd4YCdfBosgvKr4ngL6xzjFKvSDB2whMJPnwL30yBFhVvS47V7h3/Z24OXvKlPytEEpPr1/pW9i5Gq6TFycEr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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: For all page allocations to be tagged, page_ext has to be initialized before the first page allocation. Early tasks allocate their stacks using page allocator before alloc_node_page_ext() initializes page_ext area, unless early_page_ext is enabled. Therefore these allocations will generate a warning when CONFIG_MEM_ALLOC_PROFILING_DEBUG is enabled. Enable early_page_ext whenever CONFIG_MEM_ALLOC_PROFILING_DEBUG=y to ensure page_ext initialization prior to any page allocation. This will have all the negative effects associated with early_page_ext, such as possible longer boot time, therefore we enable it only when debugging with CONFIG_MEM_ALLOC_PROFILING_DEBUG enabled and not universally for CONFIG_MEM_ALLOC_PROFILING. Signed-off-by: Suren Baghdasaryan Reviewed-by: Vlastimil Babka --- mm/page_ext.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/mm/page_ext.c b/mm/page_ext.c index 3c58fe8a24df..e7d8f1a5589e 100644 --- a/mm/page_ext.c +++ b/mm/page_ext.c @@ -95,7 +95,16 @@ unsigned long page_ext_size; static unsigned long total_usage; +#ifdef CONFIG_MEM_ALLOC_PROFILING_DEBUG +/* + * To ensure correct allocation tagging for pages, page_ext should be available + * before the first page allocation. Otherwise early task stacks will be + * allocated before page_ext initialization and missing tags will be flagged. + */ +bool early_page_ext __meminitdata = true; +#else bool early_page_ext __meminitdata; +#endif static int __init setup_early_page_ext(char *str) { early_page_ext = true;