Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp1845612rdb; Tue, 20 Feb 2024 08:36:13 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVYDDWZZzU3VUJ5PmQpsmpUnr6jMTP7V9K7an2dsy33Vc0rhNCUgIZI/7fn/my/uTJH5JQ361eefi4RaweeI8AMyqfJu0wEQU9dzg0Jng== X-Google-Smtp-Source: AGHT+IEpiVF16RvrN7qyERfT4Z3d1WLfkWk7BET7eFXQwESIHlA+MF8Eh1hnjPwPtZX4qEKeBX+0 X-Received: by 2002:a05:6358:5925:b0:17a:b810:aacf with SMTP id g37-20020a056358592500b0017ab810aacfmr17035187rwf.18.1708446973403; Tue, 20 Feb 2024 08:36:13 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708446973; cv=pass; d=google.com; s=arc-20160816; b=Bia5o7u0s0yEG1HBsSAsh65vGWbFbYgs+QQhfK0L37s5/uIl+jUZtwKnmODpvybRxE +sC3EZDIVMEjyh3IT/tAKRIkyjr8TIB2iwMWPbJLGKGkfivzQwwoiFByUKNpt/8GicRq hIv56/6REgdCQFK6K6yppPlMn7Ac67ampcDXZRJ/KQAnxV4cenw3vWB77MLWVaTSCzVV zl1ExHJucqYcX9ssFxURPBP7AdQEGhCVFDMAey+eSJgS8PYZNQijghvio9AJ355wJH8V AAHlbA1G+OcF344l3LEnI5F0f5A6A5UshtOuTb5nN/Msdh8W259ckiKeAlkwbV0NhGfd CMDg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature:dkim-signature; bh=h8kDAAJVm9DuuVWWpgF8KUfDBqc/AfjUKVkybEu9ZjA=; fh=Irc8DyVFXUpBi1TsipuPTtujWedji5g0RAzplo/y83g=; b=0flnZg4kVg3T6DNT8A6cX6V/ReHZip17fzwiRU8ELvj7q6Bm56bJ8e86EIq9PC2+4p voIc4KPmkuKyMrFYyINsNEzmrOzLH0kyL8KdAvblS8YUrJhUIhJLxaeB6iiz0cbLVfbZ MdsAxriCbiaqj/n0rR8MKJ+cvaG6uDktW7qp8cpQKVtg/UqvdfFqnwDtISBVEe5Mvup6 peNVt7/me4xA2wZ2HXL/eDzjhieuG5x3mGm0FZqDhDe4F/taTZcu6wGO4dXAg58KooQb 4tw5LZBwtYNxVbOI6MAcx8+HK3WgBAj6wkHklU05m6RmYgdj9S01w6sqJA3+iPSM83aS fSrg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=ZFzfIWnc; dkim=pass header.i=@suse.com header.s=susede1 header.b=ZFzfIWnc; arc=pass (i=1 spf=pass spfdomain=suse.com dkim=pass dkdomain=suse.com dkim=pass dkdomain=suse.com dmarc=pass fromdomain=suse.com); spf=pass (google.com: domain of linux-kernel+bounces-73346-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-73346-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id m25-20020a637d59000000b005dc41265c15si6594968pgn.658.2024.02.20.08.36.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Feb 2024 08:36:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-73346-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=ZFzfIWnc; dkim=pass header.i=@suse.com header.s=susede1 header.b=ZFzfIWnc; arc=pass (i=1 spf=pass spfdomain=suse.com dkim=pass dkdomain=suse.com dkim=pass dkdomain=suse.com dmarc=pass fromdomain=suse.com); spf=pass (google.com: domain of linux-kernel+bounces-73346-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-73346-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 60F41B25146 for ; Tue, 20 Feb 2024 16:26:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7AF807866A; Tue, 20 Feb 2024 16:23:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="ZFzfIWnc"; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="ZFzfIWnc" Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (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 A2AC676914; Tue, 20 Feb 2024 16:23:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708446218; cv=none; b=BGW02W/338PGBGbqhT12UaARqeVpuQrnfn6o7lWUffiUM2AdNAvMTF9B+3gvGgc9uw/yM/7uPnVe2Be+sE1rSLL32FWVs+tDdUZW9Wops4rA/kIZ7KcIBLx4Eooa6VlozG96BI6nlLMGDeWRkUnqr0VUebHAhs5U7waXs0m8t80= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708446218; c=relaxed/simple; bh=g82dr/T1DAEl/vLBVbupqmB7edkNUjxgz7d9kHxYKs8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=TUxREODYhHOkUDzrq4eZiT7vxINB9rsaIkNTJ8f2K5WPmOP3dYVAD0zFWmJavPiJv6/wvTd0mELnz8oF++RpHAltWeFQ2bWT8gPmJFKWtD/2yD8vJ+hTa410zc0qBJGty1Hmtd38caat95t6eG1DeGIQqhoxThe8K8BdGDqnON0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b=ZFzfIWnc; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b=ZFzfIWnc; arc=none smtp.client-ip=195.135.223.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id ABB6921EFF; Tue, 20 Feb 2024 16:23:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1708446214; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=h8kDAAJVm9DuuVWWpgF8KUfDBqc/AfjUKVkybEu9ZjA=; b=ZFzfIWnckCCIdzh/XxcA8I6i/Abl4myhPRohiC29Y1zma2EAik3pIboVw8rsuI2Fk/hf1f X460EYZMpb0V7T5YuVeLML+iBfORaE9Sv7Lkf1cmVnxbV+Gjv5P9Ql1DFoPrxePSCl7R1K RpsOZjPJ1F9Bjd8vgU0BDeIDc4Yw+Ac= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1708446214; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=h8kDAAJVm9DuuVWWpgF8KUfDBqc/AfjUKVkybEu9ZjA=; b=ZFzfIWnckCCIdzh/XxcA8I6i/Abl4myhPRohiC29Y1zma2EAik3pIboVw8rsuI2Fk/hf1f X460EYZMpb0V7T5YuVeLML+iBfORaE9Sv7Lkf1cmVnxbV+Gjv5P9Ql1DFoPrxePSCl7R1K RpsOZjPJ1F9Bjd8vgU0BDeIDc4Yw+Ac= Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 77DA3139D0; Tue, 20 Feb 2024 16:23:34 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id Dr6rHAbS1GVrVAAAD6G6ig (envelope-from ); Tue, 20 Feb 2024 16:23:34 +0000 Date: Tue, 20 Feb 2024 17:23:29 +0100 From: Michal Hocko To: Suren Baghdasaryan Cc: Kent Overstreet , Steven Rostedt , Vlastimil Babka , 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 Subject: Re: [PATCH v3 31/35] lib: add memory allocations report in show_mem() Message-ID: References: <320cd134-b767-4f29-869b-d219793ba8a1@suse.cz> <20240215180742.34470209@gandalf.local.home> <20240215181648.67170ed5@gandalf.local.home> <20240215182729.659f3f1c@gandalf.local.home> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.com header.s=susede1 header.b=ZFzfIWnc X-Spamd-Result: default: False [1.68 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[suse.com:s=susede1]; BAYES_HAM(-0.01)[47.30%]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TAGGED_RCPT(0.00)[]; MIME_GOOD(-0.10)[text/plain]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_SIGNED(0.00)[suse.com:s=susede1]; DKIM_TRACE(0.00)[suse.com:+]; MX_GOOD(-0.01)[]; RCPT_COUNT_GT_50(0.00)[73]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.com:dkim]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; MID_RHS_NOT_FQDN(0.50)[]; FREEMAIL_CC(0.00)[linux.dev,goodmis.org,suse.cz,linux-foundation.org,cmpxchg.org,suse.de,stgolabs.net,infradead.org,oracle.com,lwn.net,manifault.com,redhat.com,arm.com,kernel.org,arndb.de,linutronix.de,linux.intel.com,kernel.dk,soleen.com,google.com,gmail.com,chromium.org,linuxfoundation.org,linaro.org,linux.com,lge.com,bytedance.com,akamai.com,android.com,vger.kernel.org,lists.linux.dev,kvack.org,googlegroups.com]; RCVD_TLS_ALL(0.00)[]; SUSPICIOUS_RECIPS(1.50)[] X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Spam-Score: 1.68 X-Rspamd-Queue-Id: ABB6921EFF X-Spam-Level: * X-Spam-Flag: NO X-Spamd-Bar: + On Mon 19-02-24 09:17:36, Suren Baghdasaryan wrote: [...] > 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. This is not just about missing part of the oom report. This is annoying but not earth shattering. Eating into very small reserves (that might be the only usable memory while the system is struggling in OOM situation) could cause functional problems that would be non trivial to test for. All that for debugging purposes is just lame. If you want to reuse the code for a different purpose then abstract it and allocate the buffer when you can afford that and use preallocated on when in OOM situation. We have always went extra mile to avoid potentially disruptive operations from the oom handling code and I do not see any good reason to diverge from that principle. -- Michal Hocko SUSE Labs