From patchwork Mon Feb 12 21:39:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suren Baghdasaryan X-Patchwork-Id: 13554057 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 DCE1BC4829E for ; Mon, 12 Feb 2024 21:40:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 442896B00A1; Mon, 12 Feb 2024 16:40:17 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3F24D6B00A2; Mon, 12 Feb 2024 16:40:17 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 26ABB6B00A3; Mon, 12 Feb 2024 16:40:17 -0500 (EST) 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 12EAE6B00A1 for ; Mon, 12 Feb 2024 16:40:17 -0500 (EST) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id D8E61401CB for ; Mon, 12 Feb 2024 21:40:16 +0000 (UTC) X-FDA: 81784470432.24.2EEED5F Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.202]) by imf12.hostedemail.com (Postfix) with ESMTP id 44B0740011 for ; Mon, 12 Feb 2024 21:40:15 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=csVAP7LO; spf=pass (imf12.hostedemail.com: domain of 3PpDKZQYKCL0vxuhqejrrjoh.frpolqx0-ppnydfn.ruj@flex--surenb.bounces.google.com designates 209.85.219.202 as permitted sender) smtp.mailfrom=3PpDKZQYKCL0vxuhqejrrjoh.frpolqx0-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=1707774015; 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=q3nAahWS0BuDAP/EiPEY1h7hxq9o0SR1xq9twkhL8Tk=; b=3nUWWWp1cN+rMMUv55rk2xoOx1Utq/pCJLld/6yhcoS5zPkUa07g/rFYEaHoOjLD+eF2EI JrxJN0h3FrDN7HXinXeaaGWWqn+0nyVPbKHGyPu31Rd5r6FdN1aKlFu+/7KaG/tL2CKQXj 4yfukNRRgn2vj0m+ubBA8IYEmRU2QLE= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1707774015; a=rsa-sha256; cv=none; b=wMN2MYS3mLpQEd4rKXhqqBATH9BJ4QXUBmUsJ+KLsP4HIEFR+f1pQTE+mNSNyjA+Zixh2k wIs6G9wg6+HA4vzqLqYYGNIR8N9ZgskQSSChTIWiDncSwqFOE7GXL0TqZmjMWtQPkkLJEn IlcC3/eSJJtv1R7fsS23sZRBbGrw0vU= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=csVAP7LO; spf=pass (imf12.hostedemail.com: domain of 3PpDKZQYKCL0vxuhqejrrjoh.frpolqx0-ppnydfn.ruj@flex--surenb.bounces.google.com designates 209.85.219.202 as permitted sender) smtp.mailfrom=3PpDKZQYKCL0vxuhqejrrjoh.frpolqx0-ppnydfn.ruj@flex--surenb.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com Received: by mail-yb1-f202.google.com with SMTP id 3f1490d57ef6-dc6b2682870so6221582276.0 for ; Mon, 12 Feb 2024 13:40:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1707774014; x=1708378814; 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=q3nAahWS0BuDAP/EiPEY1h7hxq9o0SR1xq9twkhL8Tk=; b=csVAP7LOvUUVichGXUrfa1haKn6p3/pVohR1y7Nv+CovuAf9ovAhajETCpN/gKrwbF IXR5CizZTi7z/6/OCsdyKYE5yUjAswITExdJFA158y7A0e/p/C8hP2lmYx1WIaaZisLM SlnakUFQLKevAlYV2qCGN6RkSyDbwSVyyDsS1FGKS3GaHOx4EF0WGj/c4JBxasNl0j4s 86ctMDtbHpu3RbdHeVgy/BUE8TuHhub+yfatZI2GL/RToAiVMpPEGYebQGAWppU+KN19 gisBGoh6GhHSS+HcP/gpLWM90/8sEFooWZ/iuaXV+M63FpPy3Cmj19q5uiDKp6EQSv8L DBoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707774014; x=1708378814; 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=q3nAahWS0BuDAP/EiPEY1h7hxq9o0SR1xq9twkhL8Tk=; b=hZdSUDVMjOtytdF8d6AIhJAwfWdpnkjhfZVQ+X7I/THumddkCvHETwhAGiMuOKny5n TRoKxwZ+EwvJrM5BVUMVurcqdxJutO2u2BtbUOxCmpW34TRk71fVSE62umL412zi5C4L a5dd5YqBGOEGhlkmXwVIyCY4AT0RVz7zbYyrZ96XXADKbaTrW8/e04viSzKGn+FIE8y6 MuialcwJY6KpdOdKVEnGEbBjK3VVMjH3hC2LlXxLlCKidBi9KtmJ1idXWL2R8QWX6nYX QPV6/xUM65ebzs4eMBCJdr9Ympx1T/FgsZIl4Pf+Z1gjo16CjAM/pzE9XIykAp0vtCz2 cIDg== X-Forwarded-Encrypted: i=1; AJvYcCVfG9V5f7aO5WBnsFpHs4SFzTNDRKXQDvrrU4Le+FHtS7+mPshFgh1kLj6QWwqCAX3qVAK5FiNN0+H3Xsix/YHlpf4= X-Gm-Message-State: AOJu0YzK5oYq+S0hzTqj7uH8nWTv40/yQy5NfbKCPPAZbVanzlXa60Ik T867nScECA0i66cHHL0NjhsQy5+BuZRghpnLraZuBb5y6tdfMg92e9h9rhs0lzI5s7uQ4r1MbG0 6aA== X-Google-Smtp-Source: AGHT+IFjfWZYV/B1TC2tamqn5wnV41GSoY2BgJr6sKI43uRZs97PbAp/sxw1wS58qt9V9k9WwRg1VI3jBIQ= X-Received: from surenb-desktop.mtv.corp.google.com ([2620:15c:211:201:b848:2b3f:be49:9cbc]) (user=surenb job=sendgmr) by 2002:a05:6902:70c:b0:dc6:fec4:1c26 with SMTP id k12-20020a056902070c00b00dc6fec41c26mr2112341ybt.1.1707774014153; Mon, 12 Feb 2024 13:40:14 -0800 (PST) Date: Mon, 12 Feb 2024 13:39:05 -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-20-surenb@google.com> Subject: [PATCH v3 19/35] 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, 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-Stat-Signature: 5dz3j4kx94thkfote86839rq671bza9c X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 44B0740011 X-Rspam-User: X-HE-Tag: 1707774015-222076 X-HE-Meta: U2FsdGVkX195vA18+AgKDDBLhKJF9UOGz2ktGHkwJ3iGeyrURpc0gdxWSMITks0oLADpHah/penE+xe4i3hgRzTvR6dFpzIvLZ7g47N9+kVNIxNXQHKZXfwbbcl2WueLMgqBAhYPGgNtxZYdRe76sRtcae2saNgRXT2l8ET/juEEBN7UHuPBUq8tbnHUHcLUJu3T/3e481OMY0B6ICKNuOkgNGAIRIgNPJxw6ANZVSgZeF29Q9xxeqrY2sWopq0rhS0AXcm949g7niR07fmZizjv6jAI5ThMdn2sAQxPXLdrkkDrxbmX/3xKTzpkc90/vdhXBE8PZ37fa/TnP8hkBqeENz6SNgTzE68K85aFPe+il0MbagEVQww4C0yz3E9pxUKOz3N87rU5sp6+UCgzDBysJWcsXetv8weH6tf4D9ZH8kX3tTcyzgKMvm2YAZGau5JP31a/WKP3YK+h1qKwEUMBpVGV6zvSNgI6H860MV1NG2J0lYItgSi+knTi7H+ZnTpXLV7P69O06RB3XTZcE2AteO/lqN9Kg7/tmqkInWhgBT2iEsAPVA07duP49uh8LW09zgJZWIW1XRIWBqSTzzR4vFIhK2xBoiKz/vfWZjf5BZM/jDa8X9mtm/h0hs54HSZG9B3NnmfSRL6O0ocOCNCCiAoK7SzXUdtXYRQBUhiLAPGzroaHmaJIjvrCo0Pnp0d3ayM02IsOnQKlB0DzQkS1R1dycGdznE868/tXrcASWaYR42gnwn5RpUx/J3fcRnJx2/k1h1iMTQudbRB2QvKicI+ivZaYEEtyO7vfiJFzXoFI/h2GyFlCRp5owiQ2/QyB57uUjQGPFeC/4MhWxwZpcOaZv0nTtTUEG8YCxUkgwBa+KdLkdX6hAxsADoUAT2HkQSewnmzPGiJDfcbbcYP2mIrXu0cJUQAUOHZfPMr23Vc+zU/ESD+l90Zyy3jwHV+ZFFHweeVRbAetXiN pcR5tPIB eA0yMxSARRGrf0X5KPWbKGEgvcoaXWp9/nm7UEiC+JnKaWokwMEYUapsBLN7e85Z1FeewiB8rz2j1K1GSQO4FU6OOWnFQKpoIkC24PaqXj7Hm00NatLUmIrjF+PrDDlzM3nfP/+6qlhrcgwKCHIbDRahbeB/kcxqVTHm9D3ejbmsa43w2FGwNt9Vv5HdNZVA9x98eJPhcjydOVpXjf0alfYJpgH8uTByHYxrTdgygJj44TKf42BOeVXHlvtm0YpENLCVy+COUxIM0BrNu7j+Y8UPEZMNIPh5CNwb9kYgbNAHl6EYWCJyBK6Bm4vJJr/3cskS3PGy7UoVN04SUyBpTZR7RYj9xi+YMpviKX7LuBI2hx9qRlKFLTVvOzigTqhk7BjvVCYXNB0zCmciRSjEF68Wotdz5gUd/U63MN0oAc4vWewDDWTPOagUdNnf54ZvAXkIyCjiJNmHnCpi6yFIJlhPPYA== 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 --- 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;