Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp1267706rdb; Mon, 19 Feb 2024 09:18:05 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUIqQffa57KQKWP7hIkbbHyYvH3LYzBcDSzE4+m4lyj0qkf9mCrPEo1LFV3oEftih+FVFycz0KmOVCk543nb46hgw1McbmZCf71Lr79eg== X-Google-Smtp-Source: AGHT+IEJDzYPTihE5b0HHAxClIRx5rBLMqNAOPQOsMqLuVONZnSsA6H9uYFE1W9e8gWB6sqVJ8hP X-Received: by 2002:a17:906:3485:b0:a3e:b4af:def5 with SMTP id g5-20020a170906348500b00a3eb4afdef5mr1687268ejb.31.1708363085019; Mon, 19 Feb 2024 09:18:05 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708363085; cv=pass; d=google.com; s=arc-20160816; b=nrUxXrKRPHkY5KBBUK/Uv4pG2Jcg4zkE+vFxg58zpq2LRN1eGAWWbo0iRwj7muBB91 2LFfBaO2rcj6ojbMkggJY9hSWKVRO/T4V3DDaEmWOJk+yMjNKijgKFmpi/4/KYPCjxcL CMYgpLxxXZi/EKKIUpziZxitwG57qtZ7PMonnIo03x+1nqLpTBiScvNAqx+4ynWVfuWP k/f6LpZRW/08FceF5jsD4Z067cPZQEepZ5YZOPjdrKJIq3uyIcfKO5MF7e9J50MmF9v0 JC8C1BLhNulkiDGeZMGxpA2mfHnoUScHnHRRS8em96V+LLbK7zBM8iOTabsgXpU9kr13 U1xg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=WTUgtDUhgLo3w13qAUwpQFiIiTT2/XDD2PV7WnKy99s=; fh=WVjOmFtQt9irV7H8nqzZ7Bl85Zc2zhp8lbiXF+0ELdQ=; b=i1RGMO79Ewh2N6KCuOB3fAXN6o8wAGLIf9KGEGRaLr7GxpaZuGES94VNHWSqS+LmY1 Zf/w7DmEglpmtEajOeeBNalDxsBkim62JFihn+i64fIMK0q23XvRcuDd/TmMusNn7QSv eiqjnQzRI9BRz2ylylhC9Fe+Q5GpL4XeVeJheJGRMUh18XzcUSLRVeJD+NS2R7W78S4q IqrT8tnB0SFbU6h4nLBARqkNq7z1ioicZUjkNBWM1On0+82CjeMC0273KfHAF+QJprA4 f/lhPKBCTrND4r7U7T/VsAi2oEp2l7ktUsqKM6Y9xloqjn87NwYyR0bIi44sB6s+Gt00 XOuQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=norgVx53; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-71742-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71742-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id mp11-20020a1709071b0b00b00a3e7b5a0a33si1373069ejc.713.2024.02.19.09.18.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Feb 2024 09:18:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-71742-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=norgVx53; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-71742-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71742-linux.lists.archive=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 am.mirrors.kernel.org (Postfix) with ESMTPS id 8F0F61F21941 for ; Mon, 19 Feb 2024 17:18:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AFE3244C8E; Mon, 19 Feb 2024 17:17:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="norgVx53" Received: from mail-yw1-f172.google.com (mail-yw1-f172.google.com [209.85.128.172]) (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 131B7446AE for ; Mon, 19 Feb 2024 17:17:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708363070; cv=none; b=UbfgLl6Y688N55Am8myQUFVM2X4hWJ8f9kvM2ryJZdpxJN8BA2MMm43Sd3J3MBwFCMtWifBVBYxJHkq3e/y9AvjMcycp7Ja0naNBwLjj4pE1a11xowh7BpktYYzwD91S1eXRKFELItKSmbGnhMfiMlpeqGKw8B43J3EoWwIXvgw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708363070; c=relaxed/simple; bh=WTUgtDUhgLo3w13qAUwpQFiIiTT2/XDD2PV7WnKy99s=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=HUP5cl5jbo1U/ZqmDdAKnIH1aOMQ739j15x0KjM38Cdld8yW4A9wZ7ycwGyMSR7+lMHOMXWOXJV7m+x1h6ArmQyQGjMtBv3CVFhOuUb0UQ7F856q+VYTbnVoz5GXVUyS0q5EUGXf2367ATwY9OlDo97GzogXZgxrylzLeVJsqtc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=norgVx53; arc=none smtp.client-ip=209.85.128.172 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=google.com Received: by mail-yw1-f172.google.com with SMTP id 00721157ae682-60821136c5aso9579107b3.1 for ; Mon, 19 Feb 2024 09:17:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1708363068; x=1708967868; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=WTUgtDUhgLo3w13qAUwpQFiIiTT2/XDD2PV7WnKy99s=; b=norgVx53gDG4kXkhfxad0gWRNtKF1aWfbm2vIPVSmisOFTbyC/gcFaADEANMzR1qFU HXkDCrNuHPo0wu44wABPHWOuiITZUNYAvs9xk6gIsckTeapOZA0KY3I/z7ykwfhMYazs ke4GYoqqvwp30iorNaRtaNq0zORTjo3fnyTsRmWUm0T9dN8UcZX+dW+5ViRnAXd161Sn hucaqv9FZl+0oDMdFViG5PoVfQqWVMZNsOwVFGQUZsEXgB673sKKHFtmNfq+QbHJTDQ2 V2HB0/90ENPI7qWUQ1HVo8/O3AXCPis61ANIBWPjMmBHCSyJpG1X4mNP5uGprLnxxAgI 2dDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708363068; x=1708967868; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WTUgtDUhgLo3w13qAUwpQFiIiTT2/XDD2PV7WnKy99s=; b=gMgCQMY+VPyDmw/jWdLI5r3IFfjjAagwK3Q1txNW3p3XixEZNVkY0TuGSNgTf7grOC 8KYdxVATVq4NYyV2BqX2G13bepklDNpOjrzqEMhJYOz95n1/R4SVa4TCpacXSE82odCr UahZQ4RPjoWnOpKDFSq/HqN8hRl/dzp+dKfmzZETa7ZjpWOxiL7w4zdIzhvIaA3izIwq EjM1dZCRw35v5Qdl45grTrIH06Akow0GM1OPsHg+M1WTVf6RUJS6lsSqg5rXz4nVYXLZ Hlc3x058zLFkMVGoWjD2BZRS8SW3C2w/vfkOYidpLXt6ysvTSFRG9so+YzE9dN7n448B QYyQ== X-Forwarded-Encrypted: i=1; AJvYcCWTdMTJukfh5k1GCT5MuWdSKFp82H47s0LLlRV6A7NsiJ1VoUJCJNjLLDEuym8Yz4s71EAB+admgmFLHCgp4CR6L3mWHrdV+4MSfYKR X-Gm-Message-State: AOJu0Yzoqwv5rbz/pTnmlPvLPlvWKx0Y2llZUvZdxVnz4IDS8xZBRTnQ KO+SBPEEvomrd8+/gwPFlVsnFtAVcQYGhWKUvu69baPIr9FO9XE4v7cyc6iUX74xN6ILyLw/qsi zWw8Ox2IKqY59fEfiqdzNC64SfFgn80J3W9DG X-Received: by 2002:a81:9b02:0:b0:607:9613:2afa with SMTP id s2-20020a819b02000000b0060796132afamr11401400ywg.0.1708363067747; Mon, 19 Feb 2024 09:17:47 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <320cd134-b767-4f29-869b-d219793ba8a1@suse.cz> <20240215180742.34470209@gandalf.local.home> <20240215181648.67170ed5@gandalf.local.home> <20240215182729.659f3f1c@gandalf.local.home> In-Reply-To: From: Suren Baghdasaryan Date: Mon, 19 Feb 2024 09:17:36 -0800 Message-ID: Subject: Re: [PATCH v3 31/35] lib: add memory allocations report in show_mem() To: Kent Overstreet Cc: Steven Rostedt , Vlastimil Babka , Michal Hocko , akpm@linux-foundation.org, 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, 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, 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" Content-Transfer-Encoding: quoted-printable On Thu, Feb 15, 2024 at 3:56=E2=80=AFPM Kent Overstreet wrote: > > On Thu, Feb 15, 2024 at 06:27:29PM -0500, Steven Rostedt wrote: > > All this, and we are still worried about 4k for useful debugging :-/ I was planning to refactor this function to print one record at a time with a smaller buffer but after discussing with Kent, he has plans to reuse this function and having the report in one buffer is needed for that. > Every additional 4k still needs justification. And whether we burn a > reserve on this will have no observable effect on user output in > remotely normal situations; if this allocation ever fails, we've already > been in an OOM situation for awhile and we've already printed out this > report many times, with less memory pressure where the allocation would > have succeeded. I'm not sure this claim will always be true, specifically in the case of low-end devices with relatively low amounts of reserves and in the presence of a possible quick memory usage spike. We should also consider a case when panic_on_oom is set. All we get is one OOM report, so we get only one chance to capture this report. In any case, I don't yet have data to prove or disprove this claim but it will be interesting to test it with data from the field once the feature is deployed. For now I think with Vlastimil's __GFP_NOWARN suggestion the code becomes safe and the only risk is to lose this report. If we get cases with reports missing this data, we can easily change to reserved memory.