Message ID | 20230501165450.15352-22-surenb@google.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp58093vqo; Mon, 1 May 2023 10:00:40 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ79Corpgcpr7ZcQOgFpYHrI1g1Xan2gGdH9eNcbqSNTVlgDV7LfI+mU+cfIFHEwqZE8lrvc X-Received: by 2002:a17:903:2304:b0:1a1:dd2a:fe6c with SMTP id d4-20020a170903230400b001a1dd2afe6cmr15153831plh.53.1682960440063; Mon, 01 May 2023 10:00:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682960440; cv=none; d=google.com; s=arc-20160816; b=cR8S+Hd9aclWRY7BV9NEtI/TIjLCtoBAC9RSuBtrC/Ctah23tNRf3Jz5eO/y9ZswmN CfoMmlN5QkgpMWbbdVtWJFQShq9piFPhpDJa2ft3Kwt51K7NBeL0Yob2tvjNAlp6xUhG nd+XDR87GEQTpUqfDq4oyy2Kw54DOUeh2CUTjc9Co6AgMwReLjQlrXqKpALpS1R8E0Le b3cVLmWWLlI/kQ2HOoYtiOd4LeDrAQtiMrVBSh1V0ljisKwTj/NWRznIHEz93kAFu5vJ YfNYerSKs9x3zgPB03MpzdQtFv4lO8yhclwOP/FBBwbg3S4W1f8OmEpWgyCNoVTfNhfK /feA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:dkim-signature; bh=ia0f0ycGZD+jM5YS+jW1bQxvUpAwQcUQoxrBuJXYMcE=; b=UND8dLf3gE9HqnZOJ1Og5t0kHN8lY+mUCtJqP/x84Ekv5iGyO4bKNz9OfCz6HUau5K uOTq+xkFmDIs0Sj0ubQp0guapkJ8DeSCNnCOzo2BkOKolYik83UL6G0bV6RwMh4DtApu CxIzF+pGbDiTe6EtUzd53bbg4ZOp6qyWPUt7JICfhY5IxLOET69tKjuMN/eF8bCm0xe8 gBZvvrbTTD1oIJFLqLo3Geu2zSv1lrffF/7FEn++GpTeL4BOfLv7Q9DuM8JEShGfy9mn 6Al6voS3eJbzqCgT9j770CWbElfg+Y3GM4V5Ep6yDyzU4HFqF53dQ6jZ2FeYoekFqjAm 11vQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=5JJhV76m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q14-20020a170902dace00b0019bf9b4b5f1si29734118plx.629.2023.05.01.10.00.23; Mon, 01 May 2023 10:00:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=5JJhV76m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233111AbjEAQ7u (ORCPT <rfc822;rbbytesnap@gmail.com> + 99 others); Mon, 1 May 2023 12:59:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232672AbjEAQ6k (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 1 May 2023 12:58:40 -0400 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E40BA30D2 for <linux-kernel@vger.kernel.org>; Mon, 1 May 2023 09:56:10 -0700 (PDT) Received: by mail-yb1-xb4a.google.com with SMTP id 3f1490d57ef6-b9e2b65f2eeso1390420276.2 for <linux-kernel@vger.kernel.org>; Mon, 01 May 2023 09:56:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1682960156; x=1685552156; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=ia0f0ycGZD+jM5YS+jW1bQxvUpAwQcUQoxrBuJXYMcE=; b=5JJhV76m95/YBoZ/xZu42cKOJXhgJORCHh7GQ1vgchybA9Jz2W8JB87J32lzEHqVAD 5MpwShEQTLsgetTJKB81Ya9oYfauOk73A+wkcp3YnAqkuYR2uGLglMtljDk1oXUFeXUF eg/dqf1WTTeod1mNhPnzcjxqEJmrvwX1WQABkeXqhDWaPCFp/KOIQdT6Kd/lNmNqK8uA jO52yQ6iu7pCgMF+oglZnvEtlqmI75FROfYcJYL0lGgLhZXRGGNj8gM5KHULwpV7DXj0 IQGmZzm/JuCCa0BNo8vc+UrvY2fi7yQcbqUa8T0x4PnakvTfaxlxsiA9vMtpl/EDSZYr 7ZHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682960156; x=1685552156; 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=ia0f0ycGZD+jM5YS+jW1bQxvUpAwQcUQoxrBuJXYMcE=; b=Y33147DBAqIbCetybWe+1ZR9XP1sYm6x4rXx/VjaSGoBTKfr3Yg3SHlrmwJ+xlDkSq G3Brd2kyJaiEeNoSFgYrqdGStonRMWQ462ptuHqE0ZCgVIdP9lrfScW3eu4B16zUPKCr OuDDepJtutonyBRARXFGr0sEz5lBl2y9pPN11XIwO26hLF+JWjH5L4y3wGGfo96ejQ7f lBeZ3pw9wzToV61PR+aLJIoHhYche5IDUzCG/DqqdDvQORFUODJxwRBNLPR2ytk0uWoV fySvDeNLVfICPwBIgxGKci65RapkoydaQg5vDGQ7OMdy9TCnEqMvUMKTR9MaBlzcVf95 q++w== X-Gm-Message-State: AC+VfDwyGnqp9PqJ7saX1QwaP82nOlKJ6nYG0jlRtkBMQ5ICEWnGb/uG OoS/BSpXwgLBIpyRZxEh1NuhCYUlepE= X-Received: from surenb-desktop.mtv.corp.google.com ([2620:15c:211:201:6d24:3efd:facc:7ac4]) (user=surenb job=sendgmr) by 2002:a25:5d1:0:b0:b9d:52cf:4a6b with SMTP id 200-20020a2505d1000000b00b9d52cf4a6bmr4308920ybf.1.1682960156135; Mon, 01 May 2023 09:55:56 -0700 (PDT) Date: Mon, 1 May 2023 09:54:31 -0700 In-Reply-To: <20230501165450.15352-1-surenb@google.com> Mime-Version: 1.0 References: <20230501165450.15352-1-surenb@google.com> X-Mailer: git-send-email 2.40.1.495.gc816e09b53d-goog Message-ID: <20230501165450.15352-22-surenb@google.com> Subject: [PATCH 21/40] mm/page_ext: enable early_page_ext when CONFIG_MEM_ALLOC_PROFILING_DEBUG=y 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, 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-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764711926213554656?= X-GMAIL-MSGID: =?utf-8?q?1764711926213554656?= |
Series |
Memory allocation profiling
|
|
Commit Message
Suren Baghdasaryan
May 1, 2023, 4:54 p.m. UTC
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 <surenb@google.com>
---
mm/page_ext.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/mm/page_ext.c b/mm/page_ext.c index eaf054ec276c..55ba797f8881 100644 --- a/mm/page_ext.c +++ b/mm/page_ext.c @@ -96,7 +96,16 @@ unsigned long page_ext_size; static unsigned long total_usage; struct page_ext *lookup_page_ext(const struct page *page); +#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;