Received: by 2002:a05:7412:e79e:b0:f3:1519:9f41 with SMTP id o30csp121336rdd; Wed, 22 Nov 2023 10:58:26 -0800 (PST) X-Google-Smtp-Source: AGHT+IHJwLxsyiFnDnteTYcEZ9/KbJrTrQsi1VYv/Ygrcy7o/VjHZARja9TtbQ4zFnKaSlJ682Pr X-Received: by 2002:a17:902:d511:b0:1cf:59c0:7e05 with SMTP id b17-20020a170902d51100b001cf59c07e05mr3881900plg.17.1700679506390; Wed, 22 Nov 2023 10:58:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700679506; cv=none; d=google.com; s=arc-20160816; b=M1uB3relljNP0m0pnWDVz7sHSBfORz6qBzM8RLEiyFc+LDkA2/mrEY00S2TlIRJ8Re TkIZhSm1v+kkxrDGaxU52sBRMNU3lZCtd7xTNaVIOgdG6doyJVLRL3iYa/CeaGJL2wCV LFCjYtCYCDpDxB04x0xgXraw2rYESKp1XWG219I1eJmhvADh50RRtxPECNUD+mWiiaTT 0z98tX1vTuqqtnz1vRIhEAzs9GX3GuQ8XOb8wMYXUYjEDs/XDoTwmv/xDkle0DdmURp4 N0taSdj+rl3Ido395wnNpkn10J8lIykPgdMo7iDTEzPTOvJiT0V3XsQ9rBX12Y5RifWq amrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature:dkim-filter; bh=5pEAGVMHc8CTrD7GrkHh/WKsgucxfvk3kjp7oHifpy8=; fh=T67tHxwLgIN4zQPbh5hihQ69FP8Tr+riKiecwZK97GE=; b=lVxYXCX5BsVFAyjftJ1Doaqil8jkItXc1SEyPhVb9ey7E2FAMUxVIdKR+3L0dA/PNC TJdJfNRo/uWKBJZBgLXTTq1Wr5P1a49HKCxwJV0xluuDLNvWTO37zOaRzwsvtE2cO/Uu rljdf1EbvC0tbdZJX5V8fgJ/aOA2hcl0VTxNkIAkPniG1swal0RQFIlSd410dRRQ95ws XBm/D033htnEViHcOMirJkWt77qi1qRRVbbrgxhxn56AoAxD0pyPTk8hdT14u4a4WxNe pgPRi6Z0ziPazRsNGKniY6J/wNptrfAph9vimO0z8+1C9yK9ZTPtSFuJArDXUM8O7FMT 8rlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@salutedevices.com header.s=mail header.b=Ps7gMGLY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=salutedevices.com Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id y5-20020a170902700500b001cc0e37524bsi20669plk.212.2023.11.22.10.58.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Nov 2023 10:58:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@salutedevices.com header.s=mail header.b=Ps7gMGLY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=salutedevices.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 908DF839A90B; Wed, 22 Nov 2023 10:58:13 -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 S1344379AbjKVS5f (ORCPT + 99 others); Wed, 22 Nov 2023 13:57:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40444 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235124AbjKVS5e (ORCPT ); Wed, 22 Nov 2023 13:57:34 -0500 Received: from mx1.sberdevices.ru (mx2.sberdevices.ru [45.89.224.132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F193510C3; Wed, 22 Nov 2023 10:57:28 -0800 (PST) Received: from p-infra-ksmg-sc-msk02 (localhost [127.0.0.1]) by mx1.sberdevices.ru (Postfix) with ESMTP id 8C408120059; Wed, 22 Nov 2023 21:57:27 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.sberdevices.ru 8C408120059 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=salutedevices.com; s=mail; t=1700679447; bh=5pEAGVMHc8CTrD7GrkHh/WKsgucxfvk3kjp7oHifpy8=; h=Date:From:To:Subject:Message-ID:MIME-Version:Content-Type:From; b=Ps7gMGLYUda/9sTqLehU9RfZaHRhwpKP074r5tSVuqiqu5M3p5IygHC5alGBu98kM 1UPJIXL6zr7Hjbw+Mi4UMM25mrRoIVf6OiumGiyk/6wAoxfjvvJUh+gUbmVTXsW7uh inw145BYrR7+QxUmOYJzPLt3kpVS3Zi6FjBRJBsrzGuXSE5fIENCODJ8jPj/T9R3/b MKJ1YJKZ0LHfGWQVMTMrb6qjhro3y5odZILgATUmslcgzs4TW/kH/JUoyovIwZOTXe WppijZA4S7wLB7Ed8AocJXmY+HEXOceK+odJhx8ScX5FspCF8l+pdh6yCsRBFTXZOx C6zzgmO2L9QBw== Received: from p-i-exch-sc-m01.sberdevices.ru (p-i-exch-sc-m01.sberdevices.ru [172.16.192.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.sberdevices.ru (Postfix) with ESMTPS; Wed, 22 Nov 2023 21:57:27 +0300 (MSK) Received: from localhost (100.64.160.123) by p-i-exch-sc-m01.sberdevices.ru (172.16.192.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Wed, 22 Nov 2023 21:57:27 +0300 Date: Wed, 22 Nov 2023 21:57:27 +0300 From: Dmitry Rokosov To: Michal Hocko CC: , , , , , , , , , , , , Subject: Re: [PATCH v2 2/2] mm: memcg: introduce new event to trace shrink_memcg Message-ID: <20231122185727.vcfg56d7sekdfhnm@CAB-WSD-L081021> 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: User-Agent: NeoMutt/20220415 X-Originating-IP: [100.64.160.123] X-ClientProxiedBy: p-i-exch-sc-m02.sberdevices.ru (172.16.192.103) To p-i-exch-sc-m01.sberdevices.ru (172.16.192.107) X-KSMG-Rule-ID: 10 X-KSMG-Message-Action: clean X-KSMG-AntiSpam-Lua-Profiles: 181545 [Nov 22 2023] X-KSMG-AntiSpam-Version: 6.0.0.2 X-KSMG-AntiSpam-Envelope-From: ddrokosov@salutedevices.com X-KSMG-AntiSpam-Rate: 0 X-KSMG-AntiSpam-Status: not_detected X-KSMG-AntiSpam-Method: none X-KSMG-AntiSpam-Auth: dkim=none X-KSMG-AntiSpam-Info: LuaCore: 3 0.3.3 e5c6a18a9a9bff0226d530c5b790210c0bd117c8, {Track_E25351}, {Tracking_from_domain_doesnt_match_to}, salutedevices.com:7.1.1;100.64.160.123:7.1.2;p-i-exch-sc-m01.sberdevices.ru:5.0.1,7.1.1;d41d8cd98f00b204e9800998ecf8427e.com:7.1.1;127.0.0.199:7.1.2, FromAlignment: s, ApMailHostAddress: 100.64.160.123 X-MS-Exchange-Organization-SCL: -1 X-KSMG-AntiSpam-Interceptor-Info: scan successful X-KSMG-AntiPhishing: Clean X-KSMG-LinksScanning: Clean X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 2.0.1.6960, bases: 2023/11/22 11:24:00 #22501433 X-KSMG-AntiVirus-Status: Clean, skipped 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 10:58:14 -0800 (PST) On Wed, Nov 22, 2023 at 02:24:59PM +0100, Michal Hocko wrote: > 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? From my point of view, kswapd and other non-direct reclaim paths are important for memcg analysis because they also influence the memcg reclaim statistics. The tracepoint mm_vmscan_memcg_reclaim_{begin, end} is called from the direct memcg reclaim flow, such as: - a direct write to the 'reclaim' node - changing 'max' and 'high' thresholds - raising the 'force_empty' mechanism - the charge path - etc. However, it doesn't cover global reclaim contexts, so it doesn't provide us with the full memcg reclaim statistics. -- Thank you, Dmitry