From patchwork Wed Mar 6 18:24:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suren Baghdasaryan X-Patchwork-Id: 13584431 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 24599C54E49 for ; Wed, 6 Mar 2024 18:25:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 054BE6B00AD; Wed, 6 Mar 2024 13:25:33 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id EA5DC6B00AF; Wed, 6 Mar 2024 13:25:32 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CD3E86B00AE; Wed, 6 Mar 2024 13:25:32 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id B457A6B00AC for ; Wed, 6 Mar 2024 13:25:32 -0500 (EST) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 8E3F0803CA for ; Wed, 6 Mar 2024 18:25:32 +0000 (UTC) X-FDA: 81867442104.19.77BB383 Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.202]) by imf23.hostedemail.com (Postfix) with ESMTP id DC2CF140006 for ; Wed, 6 Mar 2024 18:25:30 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=QP8VrmB1; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf23.hostedemail.com: domain of 3GbXoZQYKCFwMOL8H5AIIAF8.6IGFCHOR-GGEP46E.ILA@flex--surenb.bounces.google.com designates 209.85.128.202 as permitted sender) smtp.mailfrom=3GbXoZQYKCFwMOL8H5AIIAF8.6IGFCHOR-GGEP46E.ILA@flex--surenb.bounces.google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1709749530; 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=r962bvR5LCwoMgFXL0pngYYUaEUVgmlMd//tXW54EfM=; b=QoWTR6Ct5qeYbIzkLLEgJKyiSd6SYOdbYKl5Ucxp+A6mLGJwnK3zEtCVT2REFz9UoQ+zgR anL6L5MiVOfabHtYWzPOP1MUiqZjjG/sIfi0VRMToqTIb9L1qJoaMMD163mBsPnyV0Ycbm IU0UnNouJXhcdX/GAigJd5101WanrvE= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=QP8VrmB1; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf23.hostedemail.com: domain of 3GbXoZQYKCFwMOL8H5AIIAF8.6IGFCHOR-GGEP46E.ILA@flex--surenb.bounces.google.com designates 209.85.128.202 as permitted sender) smtp.mailfrom=3GbXoZQYKCFwMOL8H5AIIAF8.6IGFCHOR-GGEP46E.ILA@flex--surenb.bounces.google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1709749530; a=rsa-sha256; cv=none; b=fJOkza8f6+652wJ9Zrp/6cazmwFFYW92+A7R4JCb6xm5+6/67CKh2gk9La6hSjFScxRbiZ cVf9ZChPdTc+zFtiZW2QvfvJW+nDAageNBD5f/SLIQ3EsUzY4jkUIUhsPPBxuFovjod5w5 QuyDgGrjUQ6a4qQOhbgOVQdMI20ILcs= Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-60996cdc37cso163167b3.2 for ; Wed, 06 Mar 2024 10:25:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1709749530; x=1710354330; 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=r962bvR5LCwoMgFXL0pngYYUaEUVgmlMd//tXW54EfM=; b=QP8VrmB1Zufw29Onkv3WirzTMPdwn6ABWys1E/Bd1UoPe9iyIwox0SFk09bbwKCAKt oRv/3nDjqJMFwRHFNHL32a1Mh7X1tzNqLpgVInxYJ89dxbEJc6Zt/fKHu0hIH/+CJrHi MI9IOR6aPuGVSMB/7Dt/zMv52WlYWMHBfgzpxVLYRnjqt9cmFGPrSpgQwu/YN6YU5Vm3 HhCmq8aHnGS5nT0i8ivRqAfzFULVxJJKCU9Ka3/d7yT+BRo//LxcyaMF2wZjF8/K8z+1 OMhi4yGSmy7rPGl/Xe1e678xQt2Xh8g5o78bTUdpnu9GgYRqJlu+zKlYCKcqxwMl4zFQ Qg6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709749530; x=1710354330; 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=r962bvR5LCwoMgFXL0pngYYUaEUVgmlMd//tXW54EfM=; b=Z3SjcejBnJfPzU/iXRBRvPFKzVRHTTpVSeQOvwunsQzYkrEQ1+iTbzER9xYF+mQs35 kuZDA0h9T2sRtHTI2CmNQJp78hKsdfWVl1tEp3jSJv4Vdyh5o5VMI157SHKqwvNMZaDR VGrZqiZvLDFWI521WHmf5Rj+6DRs0XKrTOutDOLPTR/FG7RnmVYGlGbUuGk+ODkuyVnd cPpOQ6/GQkRNesHC5oQu7gyCFZ3yqTjB8e6HPR724/m2UOdyF5Yhpd6g8GNBANV7WP08 SYScMtE3gY85gT2MJnT/gMRRLKQ/bwZokk/bnul6mDR9rQUKYMp1/MSWaJ2LJ4ZYfzRj BcZQ== X-Forwarded-Encrypted: i=1; AJvYcCWEP2SPeHdlarQ/dkCGDHXvLQzpqg8vEVIWsW7GmZruDaq3AXYvuBvE5zHzSzyHneGjUed3faX8Kklm8mc2SBiMS7k= X-Gm-Message-State: AOJu0Yw1K62JIQZb2l7r2hpatqW2K2TMRBbS9QCYBmolYBAlPRMjk0xd EO69ol+f8wUdYddMS0L5N8JHE+Y6inodegWuqEcnx4xip60TK8p9OcmYC+mlZ+L7vk1YmxV9Wqe K4A== X-Google-Smtp-Source: AGHT+IGe7t6LCx7ntWuuN0pG3BUD23g3ZHCgKcqafT1luEHOL8Lf4ydoGId/CWh1jbpa65530MO9Fdk68K8= X-Received: from surenb-desktop.mtv.corp.google.com ([2620:15c:211:201:85f0:e3db:db05:85e2]) (user=surenb job=sendgmr) by 2002:a05:690c:82:b0:5e6:1e40:e2e3 with SMTP id be2-20020a05690c008200b005e61e40e2e3mr3383691ywb.5.1709749529862; Wed, 06 Mar 2024 10:25:29 -0800 (PST) Date: Wed, 6 Mar 2024 10:24:19 -0800 In-Reply-To: <20240306182440.2003814-1-surenb@google.com> Mime-Version: 1.0 References: <20240306182440.2003814-1-surenb@google.com> X-Mailer: git-send-email 2.44.0.278.ge034bb2e1d-goog Message-ID: <20240306182440.2003814-22-surenb@google.com> Subject: [PATCH v5 21/37] 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, jhubbard@nvidia.com, 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, aliceryhl@google.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-Server: rspam09 X-Rspamd-Queue-Id: DC2CF140006 X-Stat-Signature: 4rex5hfkeiee5ki9e4s9r5thmy7j3sno X-Rspam-User: X-HE-Tag: 1709749530-273058 X-HE-Meta: U2FsdGVkX1+zqhIIYtOG8785d+ybwhRHocDyIIqBdcz3fkBp/8B2tmWJZT/cr11AhtuMF12eI0T849d7b0vAcC2Pbg/MkamZ3BakA3l5V0ZmolTKCkkMyKGYM5V+T0hycTzDZwYsVnpFz/s8whDDiak6Fx30m6OfZZu+Rk1eOiHWPQHiWf75MWzuRZtTj7i8wXyc4N4+B7EietXUHHn+VYX3TjTnc3cEgAyEWhjdHCVR8bpH1zbyslSXnMs7otGlR6UbuYurYMm4qOAgVnU6dPh4Jeq27PLs0mzhEO81aV0S3enXLPu+fQ1735Yfjv+ItQpH29ybHlHnqKb5LMBFC6TUaPrDR3I4yDPjLwH1fi1d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HJ8+wIXtLsFYfLRxm6RNMhlw== 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: 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;