From patchwork Tue Oct 24 13:46:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suren Baghdasaryan X-Patchwork-Id: 13434590 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 808D1C25B48 for ; Tue, 24 Oct 2023 13:47:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BBC696B027E; Tue, 24 Oct 2023 09:47:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AF6CA6B027F; Tue, 24 Oct 2023 09:47:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 948786B0280; Tue, 24 Oct 2023 09:47:31 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 7612F6B027E for ; Tue, 24 Oct 2023 09:47:31 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 3A8EB80603 for ; Tue, 24 Oct 2023 13:47:31 +0000 (UTC) X-FDA: 81380482302.02.2ADE1D7 Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) by imf23.hostedemail.com (Postfix) with ESMTP id 5B8A614002C for ; Tue, 24 Oct 2023 13:47:29 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=F0dI+BjF; spf=pass (imf23.hostedemail.com: domain of 38Mo3ZQYKCJUHJG3C05DD5A3.1DBA7CJM-BB9Kz19.DG5@flex--surenb.bounces.google.com designates 209.85.219.201 as permitted sender) smtp.mailfrom=38Mo3ZQYKCJUHJG3C05DD5A3.1DBA7CJM-BB9Kz19.DG5@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=1698155249; 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=zC2/AjWbzXkwFGJu5UOviuzr4L4X1GYNGPTyCuvFw8o=; b=WiidZPwaJZ8jvXDqn41gi4b0qfbH2Qr+MaCiSJ6b1sxNhF41zKbrqzt33AtWJL9/3XVDu6 YfYOkKtsPQNkMyuJnxeazNLNZoTqNaA8E/BfnxpFbgcLbAyaUzPhOOPfEiawcGyAdgbW0/ DTTfufGNea2cyKSdK+AAIz4V1AsHrWE= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1698155249; a=rsa-sha256; cv=none; b=iIbvgfo5RFElSqbYrldghP0NQU/uMFU6sXkow/t1F8z6t9+qpLwXwy1Vcpl5JtDd8kBmIX kUDmiQV2POl7LlPWHimp1lonNmSBPbzJ8qeDTX7/I2Q4wXXQaJuvxVIHHRN3SGt5UjGJtG g7+KpjB3LK5J2KLY8YFkH7BVmhZ6DcU= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=F0dI+BjF; spf=pass (imf23.hostedemail.com: domain of 38Mo3ZQYKCJUHJG3C05DD5A3.1DBA7CJM-BB9Kz19.DG5@flex--surenb.bounces.google.com designates 209.85.219.201 as permitted sender) smtp.mailfrom=38Mo3ZQYKCJUHJG3C05DD5A3.1DBA7CJM-BB9Kz19.DG5@flex--surenb.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-d9a3a38b96cso5080913276.0 for ; Tue, 24 Oct 2023 06:47:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1698155248; x=1698760048; 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=zC2/AjWbzXkwFGJu5UOviuzr4L4X1GYNGPTyCuvFw8o=; b=F0dI+BjFTExqjmOrUSduaMR8Mzxv5IBrWWQuPzY3ObvdKtbSeBQDpbV84Q7L8j5wnT 9582ZRJjaHcAzv1fu2y1P+l7mOBaBZLgrMkU7lPJ1usY2yMyWxz9dIM2B/XPmNpcsBAa QHXYCdMwD0bv5cF/wvf97U0lG2qSzKrFMvNKY15S6e5IjUt4r813rXsHyktLuRQniBJm cYwo1tGzVNCApfzqKEaZe2BPRCyWVvwamOzD0zCJDWrX6hfEdwhYEDLzsmdc/RolQVJh wTubUeR+JamE5qTF+QfulfC8Efg0LGwchUJ2UyB3eGJI61KdRtfS3rnwm6ksj7fSXraV JKSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698155248; x=1698760048; 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=zC2/AjWbzXkwFGJu5UOviuzr4L4X1GYNGPTyCuvFw8o=; b=blqX+9ww9zHaHCAVddlMmfaMlw/xhzB+qnl29NeiB436DjMlSYJMmjHEKQWn2JSOBp 8Fvdk6pLf6OzttzJ1RsLUPeYdyEz3pYdmvO5XdfXi68uSETvYEjEI7lKr62GxCgEfoYp I3P/i8hcGtls5su/65L8hxobohrPlYvxs82EwMuPbP8APGjc6DNUW0ozfrt4gkQKdUgf GIBKf55IZZxJ+El66EuRdwqsjGe3ZKo6KliXGhDrqzidIcfvbcRPHb7hlbMPiiR3jvx6 blHsCQf/2HxP/vS6NGZA+tYnn+J7lBuZF+OASLc3hTi5KbcFTxCd2hmm53aWcbmorDLe I/YA== X-Gm-Message-State: AOJu0YyQuuLIxIp0+O/32m2B+Ei1PZbcNrTipyrJK0QryUjTjfYLZW+s sy9op5XDRiX20R4Bh7IcdrShw9ckfbc= X-Google-Smtp-Source: AGHT+IFtIla7jN3qQCOM5jBjQINYCYH8n10kTFpUDwIK13I4RwREYyTVERaiA7ZHusZIP5/hSujmrJfw8JM= X-Received: from surenb-desktop.mtv.corp.google.com ([2620:15c:211:201:45ba:3318:d7a5:336a]) (user=surenb job=sendgmr) by 2002:a25:40c7:0:b0:da0:289e:c056 with SMTP id n190-20020a2540c7000000b00da0289ec056mr61156yba.8.1698155248287; Tue, 24 Oct 2023 06:47:28 -0700 (PDT) Date: Tue, 24 Oct 2023 06:46:18 -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-22-surenb@google.com> Subject: [PATCH v2 21/39] 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, 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 X-Stat-Signature: i4pey3tqrqkbyougam4xpdke7qez1eui X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 5B8A614002C X-Rspam-User: X-HE-Tag: 1698155249-810480 X-HE-Meta: U2FsdGVkX1/O8yNJWQCKdgPk4duX/ggzy6Y+7TH010IKGe9z/LK2hqBlU1SIp26I8aCPW8eFEtmYvtYyaV3ZKdvyWUAcywJRVV7igYnaTXETBwb2zgnXzVSMrpMPqBzrueIz5u8qo776XBkzD8F0zX0MyuHv4eviErV7oE+BnhW49YBbecBpk0vEpjxwIKhVVbm5SxrcVLc3bcZbulJJw2RYl5fQ6ZBGfFORqsoE3ZNGF+ghN371HLf7asBbzbVuk8BJTBLGvBAx+DzaUlqmLY/ot4raqhcG8zAXkDg9qYKcOju+40BLeCmur8I67rZgwWeH8bVfB2IPSNBqn0e+JASTAufJVayeGmNkRmskZcNQeFGMR6iZqOBQVb2Bj5V96/SFDvvkh4ijc+0wt1l/innEpDacBT3Vfvi/DdIO85f+JqyuqXL98fqBUd1DNotGlqw7ZdL78QoZ0EfjTz0Aw0DpjRMwTi5op3RawmiedEIRmLW3wUNJaydxcERg9FBkFtWC88oVhHceQxUOMJGWnH+dfo4E2Gdh+nHW6++3EPLWCc17owGFxGRRPK0GeXy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LC9MEQ3IT0ZUFn48KkybLGluHPsUf0PkrAdN0WYVJgBFbUJoJp0jkK81um+Ghe3Qxx4gN87zeIATXX 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;