Received: by 2002:a05:7412:40d:b0:e2:908c:2ebd with SMTP id 13csp1087261rdf; Wed, 22 Nov 2023 05:26:30 -0800 (PST) X-Google-Smtp-Source: AGHT+IHnskNbZllxlL/xlOp7HV4h+K3GJuI9sPv4wCcyoZYLPAVdqqQiiHjP+GoWY1bxevhFYcDn X-Received: by 2002:a05:6a21:a59b:b0:187:962d:746b with SMTP id gd27-20020a056a21a59b00b00187962d746bmr4044461pzc.9.1700659590537; Wed, 22 Nov 2023 05:26:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700659590; cv=none; d=google.com; s=arc-20160816; b=NOMichSqWiwavrqgwfwNHfLc8AjXvMfnA9CeqJu7dwpHm7ZHfAcJT41iUIJFdDLJf4 IJ6e2P09vEMzrdBpTD+tEbEC49ltfsXwvY4hTSMu2pq+nMNws9/jipRKQCMxX2wM++nQ K6Vb/Xm2RELDkUa0gS6wUKAqwiS/xJunRsF8OLev/7itXYhrE3LEtmgCWyXW3vxxWMk7 TpDypR7hm1E/TSqiWqosRI+mUmZDju6Rbq+LBaE2eCRIQtYs8evvfo9XxsenTpljiJE1 st4y+3soo/sOVsBXCp48ANPVKQESiHIwrxKO45YzP3i/Jt/jyBDTDZWvz0DlnjNZgDnw +gUg== 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=Mnil+ohrFFTHGaSkTl3Q2cN64Y8ppTuLrZctm6+XJ04=; fh=S3rTvNFYrEPZ5wy+/UvIexQf0DCo/Icfs4h53fVUJ/E=; b=MGRF+DHePDmq6mCxaaN2jBzqrbKN+obIrtCZBS4YbJwPZa/A6haqd5sgk/O6shS/I9 47dsOUYj+KJitP6jnToBiwo4LRyhWv1t2V4y7NSgDb1fB1/Gt4PklCVMv7mdz6N7zyZz Sd6UPlDIYXzr3duQk6jKsndh1xEG/c2hO3r0DLFfS9GrwgdFa3UP5ioOBZ26qFN0v0Dk A2nef54kYnnlvpGKh5cnsMaAS3qd9YdpClJk2e0L35vdLurkF6SCy5Ef0iajOUPnWFmP 3nxzLG61UaI7aYimBVsAhNbfiJE6VPnuEsjabz5D+Vzdvrj4lGUNSLMYTzbMJEJ4W8jh 2dUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=NviMH3lP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id c22-20020a056a000ad600b006c0e3332534si13114312pfl.42.2023.11.22.05.26.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Nov 2023 05:26:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=NviMH3lP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (Postfix) with ESMTP id 047E28074052; Wed, 22 Nov 2023 05:25:32 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344133AbjKVNZI (ORCPT + 99 others); Wed, 22 Nov 2023 08:25:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40450 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343919AbjKVNZH (ORCPT ); Wed, 22 Nov 2023 08:25:07 -0500 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 69CE5199; Wed, 22 Nov 2023 05:25:02 -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 BA6D421963; Wed, 22 Nov 2023 13:25:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1700659500; 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=Mnil+ohrFFTHGaSkTl3Q2cN64Y8ppTuLrZctm6+XJ04=; b=NviMH3lPaz796NW0GanNc2oVdUjsEpgwAS1bgTsNOE1S3r1SeXrEcclqbbdKOyx1fnusqF VyWcZqiqbbNuU49VvWRezdfO5MjuI0+1oqkznB4vxRlgRNMntMZKAUfkjkm9GLCW0qUDxI WXKB+sr5IyNeb+NoCv5cHyJGnYLg6GU= 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 8628C13467; Wed, 22 Nov 2023 13:25:00 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id ajEaHSwBXmVjaQAAMHmgww (envelope-from ); Wed, 22 Nov 2023 13:25:00 +0000 Date: Wed, 22 Nov 2023 14:24:59 +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> <20231122105836.xhlgbwmwjdwd3g5v@CAB-WSD-L081021> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231122105836.xhlgbwmwjdwd3g5v@CAB-WSD-L081021> Authentication-Results: smtp-out1.suse.de; none X-Spam-Level: X-Spam-Score: -7.80 X-Spamd-Result: default: False [-7.80 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; BAYES_HAM(-3.00)[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]; 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=-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 fry.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 (fry.vger.email [0.0.0.0]); Wed, 22 Nov 2023 05:25:32 -0800 (PST) On Wed 22-11-23 13:58:36, Dmitry Rokosov wrote: > Hello Michal, > > Thank you for the quick review! > > On Wed, Nov 22, 2023 at 11:23:24AM +0100, Michal Hocko wrote: > > 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. > > Sure, you are absolutely right. In the usual scenario, the memcg > shrinker utilizes two sub-shrinkers: slab and LRU. We can enable the > tracepoints you mentioned and analyze them. However, there is one > potential issue. Enabling these tracepoints will trigger the reclaim > events show for all pages. Although we can filter them per pid, we > cannot filter them per cgroup. Nevertheless, there are times when it > would be extremely beneficial to comprehend the effectiveness of the > reclaim process within the relevant cgroup. For this reason, I am adding > the cgroup name to the memcg tracepoints and implementing a cumulative > tracepoint for memcg shrink (LRU + slab)." I can see how printing memcg in mm_vmscan_memcg_reclaim_begin makes it easier to postprocess per memcg reclaim. But you could do that just by adding that to mm_vmscan_memcg_reclaim_{begin, end}, no? Why exactly does this matter for kswapd and other global reclaim contexts? -- Michal Hocko SUSE Labs