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 5299DC5AD4C for ; Thu, 23 Nov 2023 11:26:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CC4C56B048A; Thu, 23 Nov 2023 06:26:40 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C4DA06B048B; Thu, 23 Nov 2023 06:26:40 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AC9CF6B048E; Thu, 23 Nov 2023 06:26:40 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 969586B048A for ; Thu, 23 Nov 2023 06:26:40 -0500 (EST) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 53982C0784 for ; Thu, 23 Nov 2023 11:26:40 +0000 (UTC) X-FDA: 81488991360.24.FB2F5E2 Received: from mx1.sberdevices.ru (mx1.sberdevices.ru [37.18.73.165]) by imf21.hostedemail.com (Postfix) with ESMTP id 33B2D1C0003 for ; Thu, 23 Nov 2023 11:26:36 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=salutedevices.com header.s=mail header.b=cEDyq9OY; dmarc=pass (policy=quarantine) header.from=salutedevices.com; spf=pass (imf21.hostedemail.com: domain of ddrokosov@salutedevices.com designates 37.18.73.165 as permitted sender) smtp.mailfrom=ddrokosov@salutedevices.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1700738797; 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=bOO7CqfbeqtPu+OvgUpTnWR1nT+4YgvDziG8YR8E+zI=; b=XBmruEiaDtqRkN+ujHXpFvldBOgEnBoQAKiczd7K2TeDcdum2oAHSpqBg9HXAupZZYWdoO qjA+GvdBi7zBL5lHqJpvkaqGKGDnEnPEm35tmghlCso4GRagn3XiApG0pdBwfddeUrf8We zaEyifejlzsN/NfrPdGWs0OGADKzp44= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=salutedevices.com header.s=mail header.b=cEDyq9OY; dmarc=pass (policy=quarantine) header.from=salutedevices.com; spf=pass (imf21.hostedemail.com: domain of ddrokosov@salutedevices.com designates 37.18.73.165 as permitted sender) smtp.mailfrom=ddrokosov@salutedevices.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1700738797; a=rsa-sha256; cv=none; b=UuVGNPNu3OLUZyUATRqZqSLT5866lbE5VixWVVbfl+eh/NZTBJul115chIArLDiYG6A2lB Wm8LMVm7/800zCfIRg5xc2p5+ZpaUrbWbmHNwTvFe9OTsoRZ4oz6ZVg0T0SMuShnBQYpT+ W/79JSH8OfC5EKJsvmpVns0x+29XRIA= 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-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 33B2D1C0003 X-Stat-Signature: zwzj8r5jmjwaoxwuwd5x5e5yqfxpyz3d X-HE-Tag: 1700738796-518513 X-HE-Meta: U2FsdGVkX19d9Rk4wOQ+uEc2CzhgB1dnihk5jMVvl/5vND40MWQyonwRwpjmTpDpShqiCRDiIY5LsZI2kdNT7Kx4Qwq1lfEcHdkJWjyHY7/HD9KEnQjTwfeMoSKjOEcKOQ10h9HWf1Oy0WHHGsJ/yQdZlTre4U4JC4XBU7WtdtvCEZq2AxY7mGiMlT7P+ZpFdJhVCUDfVW87LN+9AOq+jxvfW0JEHLj+itCjKlLEwiTyGiTs0rh8aA4MmiLQzdNCHq7JzBFSJS77ktRtmysdncdTRrya9h/lphsveR8k57JDYcUglqghodROGxU7FZpKnGmctzfXxBkKxvzO6v7NPDWU+e6xj2Tyg3PgQKued8D6QYt9hGXzn2XEIFk/rHCLLXYeXtcHsB2pyI+3TJuMI84cG3p+C+zHPrhyebaM+8TgkXCWdIDI2prEO7cFYB9R6UWxth58JjDmdLJHXYOe71d0vWjtFJltCfUYHUWrye6qkhq6DJEOFBNv74E8idvMk5GnbsColHDZaiyclJmNuTjljd6ILMBQapXspaS+3g0yqxHKIY3y8kqcum53S5/l2j5SrvXr3s3QmqWQy0yqH/sTLtrqBUUYqYWd5B15cdaFaTgpTCC/pQBIIUAYhxtlV5JiKzZCO3obmX71uUlvJHaKOpK4g1I5t44imnllyQbIy2pMpOLsjFz5tyozqk70oOiSHbwT/ua+HpS6h8YK/1q3Ol1qNKrazTF71jI0XYgrZcBW0/caN956jN+NL2HIie2/cnu6HS+LU8wKXcsOaNL7aA/TwSrCWw6wCRowIkZQTN+RwUEAv0OJJzcDpdSLm9TuK448qLOuDERUVGyQgifrSnIm/nFTw11cbsbpJIFW7dUAMzMxoomf4WCzFkOBSIoSKDeFVw0VMGVtZJPNSE5PX8pxLUdsQwRAzy5cQMNOI4CCrtlV5AbELHDnTnRbVP0VifrsQkxi31TgRZF ySPmGLN6 bQrpeD/AJ8gqY5ZNEg83iceZKnBteYN2lRfteEoXQCJoyy1GubFpO0aILHHNIT7WqVF6HLddYl5mfh8wgPfyXft7x234t2AzQKkI0byc+mKKQqOBNdTUwsdyZ2U1RcSfxrfSsxCHkILQB1830S7uacDo6L50dLnEFjXj43LLF0xAhrCGP+p1WHi9laQtjA72RggC7yBZOQ55h9j++Oso1z1OQ8KpgxRTYvvMuXYg5TsKu1kHnlhM6e/jKBGrgpI4HaM+zIL4KtK/iESm2CkcIv2sig0hQ+6MiYCo5xAR+PnZ2iMX59SscPittYZb5PzUY3LFzlabqOCy0qdKg3CiUls+Ocr4cgD8TumeXYJVELmmgeA0AyhJ4ABlqgAMg6W28DjMWmZCDz9WMK7M= 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: 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