From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 53A8CC61D97 for ; Wed, 22 Nov 2023 13:25:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D714D6B05F7; Wed, 22 Nov 2023 08:25:04 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D21186B05F9; Wed, 22 Nov 2023 08:25:04 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BE9376B05FA; Wed, 22 Nov 2023 08:25:04 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id ACB086B05F7 for ; Wed, 22 Nov 2023 08:25:04 -0500 (EST) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 874DB40B8B for ; Wed, 22 Nov 2023 13:25:04 +0000 (UTC) X-FDA: 81485660928.25.9B04F03 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf05.hostedemail.com (Postfix) with ESMTP id 6F0AA100012 for ; Wed, 22 Nov 2023 13:25:02 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=NviMH3lP; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf05.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.28 as permitted sender) smtp.mailfrom=mhocko@suse.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1700659502; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Mnil+ohrFFTHGaSkTl3Q2cN64Y8ppTuLrZctm6+XJ04=; b=v8FYIGbW5rGjAJ+XLduvWKqab171YiqoVzFmN7ZBdWFhKj/2mFZiX5rmx+HeoG8F83GYdY Ne8XPumTu69q/AnOLK295+/LBSqsECX5bZkWL8eC2y4F58QajzuFRk3Q60g6ipayhRJRui 99issZDDarUlOLWAssUsoUerQ/x/F6w= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=NviMH3lP; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf05.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.28 as permitted sender) smtp.mailfrom=mhocko@suse.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1700659502; a=rsa-sha256; cv=none; b=Nx7YgQwVoWsSjy9gG3fqNxCPvPyP7xH7jwIJZbSwafAQmgLSUwsv3anhbLjt2N083HwNqn sFqN5MGTDR2chCIutf5yr/GQAMknEsfGPVxbMjEDIZi8IgpYns8JHNg08foLSwFTwFcGrX Pora0Scb9V8nj+wUejdnwdGT/O8GZmw= 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> X-Rspamd-Queue-Id: 6F0AA100012 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: aigygyufewopkaepfstap8n5ebwzcij4 X-HE-Tag: 1700659502-204876 X-HE-Meta: U2FsdGVkX1+3kHt+s8OML5fWDqtC2viB008yOvaSX837qJrqt5gBkAfS2PGF16RvrqUCrxt16cq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eQORAEjwO6i7Z9j//hKe3ybRfXc7fp0+qVnqLdBcTrVBbJvcvN5Dql+hLmL13oG/epUCbfg= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: 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