Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp2902458rdh; Mon, 27 Nov 2023 01:34:03 -0800 (PST) X-Google-Smtp-Source: AGHT+IHO1cAQiPhh9f6YBGTSvbT+OwYHlFfn6WXnAOa3qyVC+d9+rwiJk5OypXq2tkIWpT8Pl/or X-Received: by 2002:a05:6358:724f:b0:16b:4b12:1842 with SMTP id i15-20020a056358724f00b0016b4b121842mr10350415rwa.6.1701077642887; Mon, 27 Nov 2023 01:34:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701077642; cv=none; d=google.com; s=arc-20160816; b=jKJONyNZWWEdPp/EbboCife0mv7ewq3h7jFSHE0tdUzb0FOdfJYP7oiSm9L/Rw8uvg BOHmeNq32sIz1Xpenbsa4IDShYQ7YezDTv2UseI2PrvyT9aToF+YboqQ5zWCq8Ln9/ug 5sXtIaLtFy3N32OjWhsKnMkEPJ0oxovZZ6D5/ZEkdEU26qJvWB0rEwri1Ti4jZUYVzZI HfPSjD+mhqwYaGCloFpMjWOWMuW9el2Aa42/89KlCSPSmOox4HjyfmJAZV2KrfdTalJi kxIHr1eRPsQ4qT0s8IX9qKmZiL2vJ9z5hDCSVRWsHQFcn/E98emK3BkfNlu/sFr2qxv0 tEOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=wT+MufMGEB0ufjSt00Zd8HTGo5TcuBRHX37P346pxcM=; fh=S3rTvNFYrEPZ5wy+/UvIexQf0DCo/Icfs4h53fVUJ/E=; b=l+AQ8KY3jnQ9aqrtNW3I07yceEQEgB6K4vSu4P0MSAF4flpN/1os3C+SYq8pB+RL57 BPO5MrMIpcxf+DzTPREE1BHJ8SimDqGhH7SKBQPLBUFEBxob9NSMC/trM5o9/n+ZLY4t UctwtnDddWoa1Lxdd5I9fPozuprjfuxJDeiWWjkgm48zUampYaQbQ5sm6BhRCIR61MeX V5/scIDveq7a6csmSsZi+2y3JblH9iYTe9azWgXBzMRgLC+8TQPSLw5uA2E4dEihUrHq KWqKfFWDUJnKRbWevCFB1/F/8rZIrEvc/l1zut3eTZVO8pUMASUc4S7wv55ErAJF+PE3 L/8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=ZnzujSEb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id y68-20020a636447000000b005898699b2afsi9516818pgb.176.2023.11.27.01.34.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Nov 2023 01:34:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=ZnzujSEb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 1AA398065803; Mon, 27 Nov 2023 01:34:00 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232807AbjK0Jdq (ORCPT + 99 others); Mon, 27 Nov 2023 04:33:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232797AbjK0Jdp (ORCPT ); Mon, 27 Nov 2023 04:33:45 -0500 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2a07:de40:b251:101:10:150:64:1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 643E110F; Mon, 27 Nov 2023 01:33:51 -0800 (PST) Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [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 0652B21B08; Mon, 27 Nov 2023 09:33:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1701077630; 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=wT+MufMGEB0ufjSt00Zd8HTGo5TcuBRHX37P346pxcM=; b=ZnzujSEbax23GqstRnJMfugfRQIVcnioLid6dLybj07wx9hjP/41wInCr4eFCaA0ysgQ2u 2+m4YnrwfxksKjvo8a/WrfxC+BfgIIHHf8qZ00cON1a9Wr9jnRxDYseMou3Vy+3CjQhEoS J7kFa8LNWBSIXVkHPqSh0ulE+SrFXak= 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 E7ED51379A; Mon, 27 Nov 2023 09:33:49 +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 7kaON31iZGX6QgAAD6G6ig (envelope-from ); Mon, 27 Nov 2023 09:33:49 +0000 Date: Mon, 27 Nov 2023 10:33:49 +0100 From: Michal Hocko To: Dmitry Rokosov Cc: rostedt@goodmis.org, mhiramat@kernel.org, hannes@cmpxchg.org, roman.gushchin@linux.dev, shakeelb@google.com, muchun.song@linux.dev, akpm@linux-foundation.org, kernel@sberdevices.ru, rockosov@gmail.com, cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org Subject: Re: [PATCH v3 2/2] mm: memcg: introduce new event to trace shrink_memcg Message-ID: References: <20231123193937.11628-1-ddrokosov@salutedevices.com> <20231123193937.11628-3-ddrokosov@salutedevices.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231123193937.11628-3-ddrokosov@salutedevices.com> Authentication-Results: smtp-out1.suse.de; none X-Spam-Score: 4.32 X-Spamd-Result: default: False [4.32 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; BAYES_SPAM(5.10)[100.00%]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; NEURAL_HAM_LONG(-1.00)[-1.000]; RCVD_COUNT_THREE(0.00)[3]; DKIM_SIGNED(0.00)[suse.com:s=susede1]; NEURAL_HAM_SHORT(-0.18)[-0.925]; RCPT_COUNT_TWELVE(0.00)[14]; 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)[goodmis.org,kernel.org,cmpxchg.org,linux.dev,google.com,linux-foundation.org,sberdevices.ru,gmail.com,vger.kernel.org,kvack.org]; RCVD_TLS_ALL(0.00)[] X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Mon, 27 Nov 2023 01:34:00 -0800 (PST) On Thu 23-11-23 22:39:37, Dmitry Rokosov wrote: > The shrink_memcg flow plays a crucial role in memcg reclamation. > Currently, it is not possible to trace this point from non-direct > reclaim paths. However, direct reclaim has its own tracepoint, so there > is no issue there. In certain cases, when debugging memcg pressure, > developers may need to identify all potential requests for memcg > reclamation including kswapd(). The patchset introduces the tracepoints > mm_vmscan_memcg_shrink_{begin|end}() to address this problem. > > Example of output in the kswapd context (non-direct reclaim): > kswapd0-39 [001] ..... 240.356378: mm_vmscan_memcg_shrink_begin: order=0 gfp_flags=GFP_KERNEL memcg=16 > kswapd0-39 [001] ..... 240.356396: mm_vmscan_memcg_shrink_end: nr_reclaimed=0 memcg=16 > kswapd0-39 [001] ..... 240.356420: mm_vmscan_memcg_shrink_begin: order=0 gfp_flags=GFP_KERNEL memcg=16 > kswapd0-39 [001] ..... 240.356454: mm_vmscan_memcg_shrink_end: nr_reclaimed=1 memcg=16 > kswapd0-39 [001] ..... 240.356479: mm_vmscan_memcg_shrink_begin: order=0 gfp_flags=GFP_KERNEL memcg=16 > kswapd0-39 [001] ..... 240.356506: mm_vmscan_memcg_shrink_end: nr_reclaimed=4 memcg=16 > kswapd0-39 [001] ..... 240.356525: mm_vmscan_memcg_shrink_begin: order=0 gfp_flags=GFP_KERNEL memcg=16 > kswapd0-39 [001] ..... 240.356593: mm_vmscan_memcg_shrink_end: nr_reclaimed=11 memcg=16 > kswapd0-39 [001] ..... 240.356614: mm_vmscan_memcg_shrink_begin: order=0 gfp_flags=GFP_KERNEL memcg=16 > kswapd0-39 [001] ..... 240.356738: mm_vmscan_memcg_shrink_end: nr_reclaimed=25 memcg=16 > kswapd0-39 [001] ..... 240.356790: mm_vmscan_memcg_shrink_begin: order=0 gfp_flags=GFP_KERNEL memcg=16 > kswapd0-39 [001] ..... 240.357125: mm_vmscan_memcg_shrink_end: nr_reclaimed=53 memcg=16 In the previous version I have asked why do we need this specific tracepoint when we already do have trace_mm_vmscan_lru_shrink_{in}active which already give you a very good insight. That includes the number of reclaimed pages but also more. I do see that we do not include memcg id of the reclaimed LRU, but that shouldn't be a big problem to add, no? -- Michal Hocko SUSE Labs