Received: by 2002:a05:7412:40d:b0:e2:908c:2ebd with SMTP id 13csp986621rdf; Wed, 22 Nov 2023 02:26:48 -0800 (PST) X-Google-Smtp-Source: AGHT+IHdgOUlt96LenOdG92FeASDHArNUBf0sotHQtJTlnMNcPEcmT1aNQeogrUFPH/nRSzi7F1n X-Received: by 2002:a05:6a21:9706:b0:18a:d4e6:ce20 with SMTP id ub6-20020a056a21970600b0018ad4e6ce20mr1381248pzb.23.1700648807992; Wed, 22 Nov 2023 02:26:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700648807; cv=none; d=google.com; s=arc-20160816; b=M7S1AgUHEorTh2zAiKUjOWqpsCTbZZlH/KK/OMD4ptB0jwh5koS9XR1yM/4tDVQVgU /ZPSvpLpPcghAkIy6DWUR905kDojsl++OfilQpwaB3Ed2iLv88p8rkv0Q20l/bbF2xbO Dkyx+aZXDGbvRnKTgUhZSqBOgJG8NYO75Y5dtHLP1MLVyDieLpKMp18No5U1on7HjaAz uWSqtU8o6LNWGrr7niO5uLLn8uO7F5eoF3jixEwIHT5FPtZNjPQ6mZ5NMELeGH/avnqw g4vRr4+33ev+pIZ7q8eDnP8mFiQf2UCXeR1sPE33BwuDHGAhCOLSg9Y1q/Yys2rp7apy NzjQ== 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=PlrtFUbphp1xKwmhddTZK3avXJcT+X0HqDrgDSKr+Yk=; fh=S3rTvNFYrEPZ5wy+/UvIexQf0DCo/Icfs4h53fVUJ/E=; b=uXkP2mKaog6ReQ75RstaLgB1C66yfwOlmr2cawLrRJ7k0/HBOWT4J/qM+8z9Tj+IC5 /pPzxlJYqGwhjJqgVOc6WtRyKB3IFrIiP+EbWUeJYGf7SacUcPTeCKAWY3CtAs8gdPcc SkRA25C1dQ/im+MibzIiP6Zh9iBiGfYrYCwBQw1vMqjx8AO2TeW6hcktu2rN56di7MDd z07ThEqqRJQEvy/jvlSCVCU5SYS25FDJ8COSfn1OJoJYcMyQr8rtxASaqeRLS1aXc4y2 NUT+pO0WqymxQxrDjaweokhzotTN53HF4/wY7Y9HD4u9pP/QAS5sJah5aJJiWD9cmuuF cTng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=P77qLai8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id u1-20020a170902bf4100b001c6182d9fdasi11762617pls.326.2023.11.22.02.26.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Nov 2023 02:26:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=P77qLai8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (Postfix) with ESMTP id 9788C8030BA1; Wed, 22 Nov 2023 02:24:16 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343864AbjKVKXh (ORCPT + 99 others); Wed, 22 Nov 2023 05:23:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343842AbjKVKXb (ORCPT ); Wed, 22 Nov 2023 05:23:31 -0500 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86F231A2; Wed, 22 Nov 2023 02:23:27 -0800 (PST) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 3BCE021963; Wed, 22 Nov 2023 10:23:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1700648606; 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=PlrtFUbphp1xKwmhddTZK3avXJcT+X0HqDrgDSKr+Yk=; b=P77qLai85rWBMrGTsafkxgHKUUvxfCmTbGAwFiMJZ+lmIITCQ0veHfNqJoA4Mvs6DsTxck FhDypOKa7BVuH7clX/MsfXpCbzBXtgePjuY8c4tNM9NR6u8ESVjAg8MWSd5+IVCRSDoBMk FBD2PFW7rhHGuHVgUv5bfatiAmN9kCk= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 0909113461; Wed, 22 Nov 2023 10:23:25 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id qLLKOp3WXWVEEwAAMHmgww (envelope-from ); Wed, 22 Nov 2023 10:23:25 +0000 Date: Wed, 22 Nov 2023 11:23:24 +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 v2 2/2] mm: memcg: introduce new event to trace shrink_memcg Message-ID: References: <20231122100156.6568-1-ddrokosov@salutedevices.com> <20231122100156.6568-3-ddrokosov@salutedevices.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231122100156.6568-3-ddrokosov@salutedevices.com> Authentication-Results: smtp-out1.suse.de; none X-Spam-Level: X-Spam-Score: -5.41 X-Spamd-Result: default: False [-5.41 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; BAYES_HAM(-0.61)[81.89%]; 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]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; DKIM_SIGNED(0.00)[suse.com:s=susede1]; NEURAL_HAM_SHORT(-0.20)[-1.000]; 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_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Wed, 22 Nov 2023 02:24:16 -0800 (PST) On Wed 22-11-23 13:01:56, 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. Is this really true? AFAICS we have mm_vmscan_lru_isolate mm_vmscan_lru_shrink_active mm_vmscan_lru_shrink_inactive which are in the vry core of the memory reclaim. Sure post processing those is some work. [...] > diff --git a/mm/vmscan.c b/mm/vmscan.c > index 45780952f4b5..6d89b39d9a91 100644 > --- a/mm/vmscan.c > +++ b/mm/vmscan.c > @@ -6461,6 +6461,12 @@ static void shrink_node_memcgs(pg_data_t *pgdat, struct scan_control *sc) > */ > cond_resched(); > > +#ifdef CONFIG_MEMCG > + trace_mm_vmscan_memcg_shrink_begin(sc->order, > + sc->gfp_mask, > + memcg); > +#endif this is a common code path for node and direct reclaim which means that we will have multiple begin/end tracepoints covering similar operations. To me that sounds excessive. If you are missing a cumulative kswapd alternative to mm_vmscan_direct_reclaim_begin mm_vmscan_direct_reclaim_end mm_vmscan_memcg_reclaim_begin mm_vmscan_memcg_reclaim_end mm_vmscan_memcg_softlimit_reclaim_begin mm_vmscan_memcg_softlimit_reclaim_end mm_vmscan_node_reclaim_begin mm_vmscan_node_reclaim_end then place it into kswapd path. But it would be really great to elaborate some more why this is really needed. Cannot you simply aggregate stats for kswapd from existing tracepoints? -- Michal Hocko SUSE Labs