Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp262541rdh; Thu, 23 Nov 2023 03:26:54 -0800 (PST) X-Google-Smtp-Source: AGHT+IEkfIr6LAhROdQQBYk4HJJtuqfSGuGNJ10E7JDLhqRc4j+sN4Inc97TA7FtwE9MhRsuCWON X-Received: by 2002:a05:6a00:1784:b0:6c3:468c:6caa with SMTP id s4-20020a056a00178400b006c3468c6caamr2997049pfg.6.1700738814314; Thu, 23 Nov 2023 03:26:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700738814; cv=none; d=google.com; s=arc-20160816; b=gDGRcXpLh4KY8FQJJZqhOAqDWiSMNJds1JcKg0hKUtzimZU70FjJ2a8NX8pz1swY0v z/X4YWcVRRqtcyiY6AvsmuEidqmNe90rlMSP1ZfgclB2oCPKjvl4vYtW+Tk+yf38XScx olNX4dVbSac1vrkLBq+9TwdFK79AK8iTqlQc7/FRZZ2BjjUTQMAUYXWcK2K6q0M1+N4U WXeTpnkCCYZfpMgT6o73uITH2PMVq4799xCNemZa3OUsmedIY+hcpu9LfbLfLkN3CNf0 jjPn55u9PjfxDXsE4uQUEIvx39/R1gn9PqG7mKsHClbeJdenLfTnxK3kZBfjNIx3F9Oy 2BEg== 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=bOO7CqfbeqtPu+OvgUpTnWR1nT+4YgvDziG8YR8E+zI=; fh=uiiw/yHpBHlDuojYCXvTTWPM6qzh8+IOzwOVFCw55Ds=; b=vJPmQ/ELr5tGZXdEZUM/rXZ49V0tCuKAygvrNrN3uyjvRT1byUHqAy7sul7IAXIRf9 PuHKfHwDD6bKVkr+vvaGtH21EGqiaPqxIFeZ0BrlxQVOtUlSg20WAa2lZJeuH+oB7+6R 2QThopn+L3YLBADGMc72WHs4+BFkFvSa/jINYl3q5g/uIU0Fb46ETSctUCOMuU20JnS+ baV9PMpo7LRj8Ff/ygGVfSHdPSqC/pH7RmfxH6uUNYVABccILazLtb5xc5cOOpJYdtek AMw3VsWJNewLq9KhzTPkmezl0EIQdead5ZjVq1KgG7rRJhg4IEmiDLvYMCeJB4G2/YOB PZfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@salutedevices.com header.s=mail header.b=cEDyq9OY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id d13-20020a056a00244d00b006bf0f06c31dsi1069988pfj.166.2023.11.23.03.26.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Nov 2023 03:26:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@salutedevices.com header.s=mail header.b=cEDyq9OY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (Postfix) with ESMTP id D775982662D5; Thu, 23 Nov 2023 03:26:51 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345022AbjKWL0e (ORCPT + 99 others); Thu, 23 Nov 2023 06:26:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344916AbjKWL0c (ORCPT ); Thu, 23 Nov 2023 06:26:32 -0500 Received: from mx1.sberdevices.ru (mx1.sberdevices.ru [37.18.73.165]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D335AA3; Thu, 23 Nov 2023 03:26:36 -0800 (PST) Received: from p-infra-ksmg-sc-msk01 (localhost [127.0.0.1]) by mx1.sberdevices.ru (Postfix) with ESMTP id 59A74100008; Thu, 23 Nov 2023 14:26:35 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.sberdevices.ru 59A74100008 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=salutedevices.com; s=mail; t=1700738795; bh=bOO7CqfbeqtPu+OvgUpTnWR1nT+4YgvDziG8YR8E+zI=; h=Date:From:To:Subject:Message-ID:MIME-Version:Content-Type:From; b=cEDyq9OYl745EnFlXfacIqCYjLi1H8hvHNG2CVYAnSZ9OFzEldRj5Glk3hqlJWUlf Gc2repLUHUA8qt5aslnitk9JVq0j+Xm711idaOyICzj7+39w3U1jm+NRvlmztPQ0fk qrX6UKpc9ZdWHUlyWSki1m9RReZgvIq4H8O0vWgcb823End1mA8feWWdyamFr++ndv +5mlbdyauF/g8tYivDT/D9/U4EIpsLbxnwlkZP9jeKrkHLOEcAtc4FQZ7LNpB8jgoE f/xmEAbTA2mhpYf/deqxAMojE1Cum+WEFaootu+PVPROy/5nAU4xaFE3W5eRNbMULP UJVpCLrVAxlLw== 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; Thu, 23 Nov 2023 14:26:35 +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; Thu, 23 Nov 2023 14:26:34 +0300 Date: Thu, 23 Nov 2023 14:26:29 +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: <20231123112629.2rwxr7gtmbyirwua@CAB-WSD-L081021> References: <20231122100156.6568-1-ddrokosov@salutedevices.com> <20231122100156.6568-3-ddrokosov@salutedevices.com> <20231122105836.xhlgbwmwjdwd3g5v@CAB-WSD-L081021> <20231122185727.vcfg56d7sekdfhnm@CAB-WSD-L081021> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20231122185727.vcfg56d7sekdfhnm@CAB-WSD-L081021> User-Agent: NeoMutt/20220415 X-Originating-IP: [100.64.160.123] X-ClientProxiedBy: p-i-exch-sc-m01.sberdevices.ru (172.16.192.107) 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: 181556 [Nov 23 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;127.0.0.199:7.1.2;100.64.160.123:7.1.2;d41d8cd98f00b204e9800998ecf8427e.com:7.1.1;p-i-exch-sc-m01.sberdevices.ru:7.1.1,5.0.1, 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/23 09:18:00 #22508170 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 groat.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 (groat.vger.email [0.0.0.0]); Thu, 23 Nov 2023 03:26:52 -0800 (PST) Michal, Shakeel, Sorry for pinging you here, but I don't quite understand your decision on this patchset. Is it a NAK or not? If it's not, should I consider redesigning something? For instance, introducing stub functions to remove ifdefs from shrink_node_memcgs(). Thank you for taking the time to look into this! On Wed, Nov 22, 2023 at 09:57:27PM +0300, Dmitry Rokosov wrote: > 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 -- Thank you, Dmitry