[v4,20/36] mm/page_ext: enable early_page_ext when CONFIG_MEM_ALLOC_PROFILING_DEBUG=y
Message ID | 20240221194052.927623-21-surenb@google.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-75399-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp1260476dyc; Wed, 21 Feb 2024 11:50:28 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWTjn2d24xYWSvkvOAb4P1Sk/gakWzrxBPGfkL2I6dXLpvbg+U5H3GrqQLLZFmSlA6IOt2/Phc+gjlMT5RnoqNV3IujZQ== X-Google-Smtp-Source: AGHT+IH51NZrOZeErlEZ018MSxdrmH8kZnPkYNZdXD/YZpx5hntOHSKFtuw8Y+Z4EWDhocYb9/P9 X-Received: by 2002:a05:6a20:3713:b0:1a0:7197:57f2 with SMTP id t19-20020a056a20371300b001a0719757f2mr13779907pze.26.1708545027836; Wed, 21 Feb 2024 11:50:27 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708545027; cv=pass; d=google.com; s=arc-20160816; b=RaNn9UMflHNJ6Z7+cxI9Rg+Y1X8tfxfd7OhJqg2x5b4UdGsumGqwquSosjI4jbaPmI CfPDoB0E1jDPLgQ9GuVjArVGMhSJfo0nNX8z48fWvNpaA7GjMZ7Z3L//PsfnO/cB4qYl 4wEbsIexo53fP+FsM4nMFbTt0B1YcbhQVeK8JslSAOwkQdp0Iav+jaiSCUDKWiYqA3bO H8C3U77Y5p7gTZ6u3ii9aJ3Z+pSmS6UyVrcnBCYlpNhlpisJVxhEiRtqFTFNzornuEy0 PEiul6m9uc8napteWOZne+75zY+cheIOEXoPeP9I6eCW+QbPkE0CUa58C6QynxBc1R5b QjiQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:message-id:references:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:in-reply-to:date :dkim-signature; bh=tPPJBer4xtwbKjpAS2Ohhk9ejLfkpDLeASf186TPNEc=; fh=gKVe/G+MLGOVLO/KOFXPA3aGSTr8I/St2cLkr1JGMLY=; b=oklkPBJimdlCnHC+u4fue9bnRLsfjAG0krlx8KI+RTTzpnojezzeY3ENWu9499B7X+ KbXH/CkDlgoPztMipc1TKIsfiJbdu3+hRZsc/k7GNgmrOp3OU1Yt5xUI4lF27KwmevbW F0fGnI3iBdc03TI9hNOVhSYmdiQCf9O4VMxfBevjrmdwLHYR8toMdEz0t/pfVZ/xi0i8 C8w9MpGaTNZ/vnjEWHa+ahfASr6GCErRfRoIy/AOYyu6YkHPT17WHtCUMUgvsMyHUtEV lMaHrBxONtE5NbDpXMxMDlBbStNkobgarAHGmMD4o1H7z7nSTjaxxS2o3WGxY27W9CFB trug==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=I60tfXUB; arc=pass (i=1 spf=pass spfdomain=flex--surenb.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-75399-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75399-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id e9-20020aa78c49000000b006e47300e4e7si3251667pfd.370.2024.02.21.11.50.27 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 11:50:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-75399-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=I60tfXUB; arc=pass (i=1 spf=pass spfdomain=flex--surenb.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-75399-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75399-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id A13C828137A for <ouuuleilei@gmail.com>; Wed, 21 Feb 2024 19:50:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A183215099E; Wed, 21 Feb 2024 19:41:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="I60tfXUB" Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 53FE31487E6 for <linux-kernel@vger.kernel.org>; Wed, 21 Feb 2024 19:41:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708544504; cv=none; b=V5Ohj2JpXGF4lgjZ6coUU4Ap73bFpOrErKIMGMuTwI8mXMKjFe4A1B62Wg8Cn81sszc5zfOQ6gCRopSNVQYNqKzl2apKu8uxmdl+BOnp3mj+y2QqA83zsThZiHM6dOvOtkpvJzK81EgcVAylO2baMiOPYU/BHX6ROHCBH5FZkXA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708544504; c=relaxed/simple; bh=tJ3w7T50tuSGE7zeIkRop76WTSZpdbl8TVHGhzHrDHo=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=RTKpxLXxTL49vLgkr/HpJqOBGA9120CqfBKeJVIPHGNr7jLBTkx5IYZgU1JafBJi9uhFRJUeNk9WMS9GZpCxu9zFTGpMVCKcqVUr7AQKMmaw6gzt485bLct9JhxpfL/0PUGbc8N2bAPTStRtuQkMittvmC/OgLzZurBYGUeCgk8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--surenb.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=I60tfXUB; arc=none smtp.client-ip=209.85.219.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--surenb.bounces.google.com Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-dcc05887ee9so8540198276.1 for <linux-kernel@vger.kernel.org>; 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=vger.kernel.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=I60tfXUBQ7h4hK/1lnwmCB9svJL5J/Q95mhSU58YPOQhMpkiOy3JoeaU8LEs+wXIbx 0i1ti2VW+V6uszIxTNSHuregujLmiTznjqIzc4INDeSN42c/JOrNDozj3zNtKXORqHnE Ak6j3n+QIsz2tx85cuFB2KUrLWBQaouw4f1pnuiMjaBvVSEXYOsc0jFtRatrZynt+cSd RAIosOEG/hqzTY/by4ODaFZB1Xi3DXC12q0gliEttJx4/rt771FuJ+OmPzRm8FceQIAx Fi0rTH8YwEJL+NuBBlC8Mc9yvwxX/7H0RiXjGg4h/xkpyHkkWc/mvnRlqz9JBPO0nEu8 WBLQ== 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=p5J4E4HMS7DAkP2BXalVHiKbDHPDrlFzVBgqom7gmy/xv5kAehzZ5KAn2gNbs0LXXQ gdqieGAFXB6kthgwbjH35UY3/kB8KS05muDn1Lvbxx5fJDinMAg3i/9Db4ju2xEO6NUI M3ol9AdMfdK3mL5cO5ZmqT1WKb/kvX76/yuLNcKaITSzwwNybhLg50kd+fabKYRdvT0F aWznJs4sXKTWejQA0Cb1CfB5gtYckUroJN7EfIpGY7EKbilr/BUiO95EUqOkld/utGIM 0qev6MgOLSmMly5Mra1lgkEtrkNxI/FHxeMRWK7sBQddiPV+YugAx4SMnTChSElKNCWh mzXw== X-Forwarded-Encrypted: i=1; AJvYcCWykjo8SBjbeClxmOiEGdFzeSvPlrA4fMnj/ROh1l05NUX7zW7sclljREmr61c/C5B2yzJeAvusI9H0Lev+8PbXdlK3ma87U9Axw0i4 X-Gm-Message-State: AOJu0YxdhMvp0d0gPlgQ8AvgzAqkUY6nsYpQeASTDHEYcBACHquFjexI HdIT4qFSmvK5w4Yj0X1dMvmR36SBAstCCfL9dh4QHTW+c1e6nLgOwsApAhb62S1uWBZIcVXt+eO HSg== 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> 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 <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, 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 Content-Type: text/plain; charset="UTF-8" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791539311163965889 X-GMAIL-MSGID: 1791539311163965889 |
Series |
Memory allocation profiling
|
|
Commit Message
Suren Baghdasaryan
Feb. 21, 2024, 7:40 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(+)
Comments
On 2/21/24 20:40, Suren Baghdasaryan wrote: > 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> Reviewed-by: Vlastimil Babka <vbabka@suse.cz> > --- > 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;
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;