Message ID | 20231101102837.25205-3-ddrokosov@salutedevices.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:abcd:0:b0:403:3b70:6f57 with SMTP id f13csp314910vqx; Wed, 1 Nov 2023 03:30:02 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFsIm2SK0ds4q3QGMgjX9TxV2dsKnmlgMPHNS14edho9VGI24xD3QvnrPjz/ya2TMRxqi1z X-Received: by 2002:a17:903:41c4:b0:1cc:4a84:27cd with SMTP id u4-20020a17090341c400b001cc4a8427cdmr8565440ple.31.1698834602521; Wed, 01 Nov 2023 03:30:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698834602; cv=none; d=google.com; s=arc-20160816; b=NnHFjCLm+9YikxlIxWoWOr/lZOpt2hDI4GRLdlF7MAM7Oy4JltD3ulIB+93Gw1QgNJ iWdopb3wDzuBuZ69lsueAfZGf4VfIoirSoIoOt6fbPe0XEY4H+sZxgqLDRUxMEiXcZie R27KY1jefUzk3vjDmy8cp2kFN6azfOUqMuJTkXbQkoO33VS95ERcT00AhvftEKCC6kuV cuurclKv0bl8Fh/3wBA5egF0wNk9LPIil8P920GRNtB93pSMR4v+doC9R1/R5g69NLxv ivOdSDaAvrNAP8O0vKqFCL0JxKDLdX7pYBM5KTESYU0tCO+r0jgL0/s39p6WBhDgxqzi Z4/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=pSKI4+L8HJRYn63UrrAYG4N/D56LntFTm89/ZK6IV24=; fh=0+l72ck3kOAs3cMd/mEkI3DSRNpPfi1ydrq5QwtlmRc=; b=m539ThUq5SxgaQxrZ0T6rbzWU39PCXVXeIxFmeQ9SI+sFx/4HgLsxOZTP8PHjG7fox VMTNDXifogtlSSlTNXnuXMFRzdfVASOYgHpgUXRpElIRyv8zcDLexI89Tcy2fdxX6EVN Pk/6SOqYWXeMRYceoaFM8awjy7f+u8jIEAb7wFIZ09SalxvtYFXrPEs+eXMAUwD8CKcY FEXFZc7LxgjmKVzBy/S1xxn21dqazk/dJP5o+ZTxZw9cqLk+ufjWUb8a4Dyy75TSDUF2 6UjFOf1Zuo7fDPkSIz+HHYJts/UcVdT8z9IhJW56Hlc7ckwbmZQljdsnsmubdKNVpyj6 NbNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@salutedevices.com header.s=mail header.b=hQdEufFt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id d1-20020a170903230100b001ca85fddf9esi2764263plh.483.2023.11.01.03.30.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Nov 2023 03:30:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@salutedevices.com header.s=mail header.b=hQdEufFt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (Postfix) with ESMTP id A2FE7809B465; Wed, 1 Nov 2023 03:29:57 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235126AbjKAK3F (ORCPT <rfc822;rbbytesnap@gmail.com> + 35 others); Wed, 1 Nov 2023 06:29:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235110AbjKAK3C (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 1 Nov 2023 06:29:02 -0400 Received: from mx1.sberdevices.ru (mx2.sberdevices.ru [45.89.224.132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88AA4DE; Wed, 1 Nov 2023 03:28:52 -0700 (PDT) Received: from p-infra-ksmg-sc-msk02 (localhost [127.0.0.1]) by mx1.sberdevices.ru (Postfix) with ESMTP id 39397120033; Wed, 1 Nov 2023 13:28:51 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.sberdevices.ru 39397120033 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=salutedevices.com; s=mail; t=1698834531; bh=pSKI4+L8HJRYn63UrrAYG4N/D56LntFTm89/ZK6IV24=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type:From; b=hQdEufFtltMp4tP59pfpQfMZAy5u5HUeSe7wslXZZYG0+RgoZAruI5nqoFqESnayv 8PDojzaOXskd/K7rXMwIx6qNKqm6R5vcNxDJK681HH83Rps5sg7ya2aMBELUJAJ6+k WMIv7jOTRVH3GHf7iukh+HewyvxYIkLSOb9Z4tjRH2k4Kp5IBR1TKZZ0fimlsP4pwF u4noMpFQRni0uYtGrP5RH1EpCivQAkmimxBRQzhD27R6S11XCbOzTNSmO9ePcwujmk QtHTqb1InR6V7SZErR2B8uCuSGeHYqP2v8FxvSROexv5DeZrnYOs7Ohb6iEczA7DlU slqJr1B6XRbag== 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, 1 Nov 2023 13:28:50 +0300 (MSK) Received: from localhost.localdomain (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.37; Wed, 1 Nov 2023 13:28:50 +0300 From: Dmitry Rokosov <ddrokosov@salutedevices.com> To: <rostedt@goodmis.org>, <mhiramat@kernel.org>, <hannes@cmpxchg.org>, <mhocko@kernel.org>, <roman.gushchin@linux.dev>, <shakeelb@google.com>, <muchun.song@linux.dev>, <akpm@linux-foundation.org> CC: <kernel@sberdevices.ru>, <rockosov@gmail.com>, <cgroups@vger.kernel.org>, <linux-mm@kvack.org>, <linux-kernel@vger.kernel.org>, <bpf@vger.kernel.org>, Dmitry Rokosov <ddrokosov@salutedevices.com> Subject: [PATCH v1 2/2] mm: memcg: introduce new event to trace shrink_memcg Date: Wed, 1 Nov 2023 13:28:37 +0300 Message-ID: <20231101102837.25205-3-ddrokosov@salutedevices.com> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20231101102837.25205-1-ddrokosov@salutedevices.com> References: <20231101102837.25205-1-ddrokosov@salutedevices.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain 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: 181040 [Nov 01 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: 543 543 1e3516af5cdd92079dfeb0e292c8747a62cb1ee4, {Tracking_from_domain_doesnt_match_to}, 100.64.160.123:7.1.2;p-i-exch-sc-m01.sberdevices.ru:7.1.1,5.0.1;d41d8cd98f00b204e9800998ecf8427e.com:7.1.1;127.0.0.199:7.1.2;salutedevices.com:7.1.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/01 06:18:00 #22376334 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,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Wed, 01 Nov 2023 03:29:57 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781357192437369517 X-GMAIL-MSGID: 1781357192437369517 |
Series |
mm: memcg: improve vmscan tracepoints
|
|
Commit Message
Dmitry Rokosov
Nov. 1, 2023, 10:28 a.m. UTC
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. However, direct reclaim has its own tracepoint, so there
is no issue there. In certain cases, when debugging memcg pressure,
developers may need to identify all potential requests for memcg
reclamation including kswapd(). The patchset introduces the tracepoints
mm_vmscan_memcg_shrink_{begin|end}() to address this problem.
Example of output in the kswapd context (non-direct reclaim):
kswapd0-39 [001] ..... 240.356378: mm_vmscan_memcg_shrink_begin: memcg=test order=0 gfp_flags=GFP_KERNEL
kswapd0-39 [001] ..... 240.356396: mm_vmscan_memcg_shrink_end: memcg=test nr_reclaimed=0
kswapd0-39 [001] ..... 240.356420: mm_vmscan_memcg_shrink_begin: memcg=test oorder=0 gfp_flags=GFP_KERNEL
kswapd0-39 [001] ..... 240.356454: mm_vmscan_memcg_shrink_end: memcg=test nr_reclaimed=1
kswapd0-39 [001] ..... 240.356479: mm_vmscan_memcg_shrink_begin: memcg=test oorder=0 gfp_flags=GFP_KERNEL
kswapd0-39 [001] ..... 240.356506: mm_vmscan_memcg_shrink_end: memcg=test nr_reclaimed=4
kswapd0-39 [001] ..... 240.356525: mm_vmscan_memcg_shrink_begin: memcg=test oorder=0 gfp_flags=GFP_KERNEL
kswapd0-39 [001] ..... 240.356593: mm_vmscan_memcg_shrink_end: memcg=test nr_reclaimed=11
kswapd0-39 [001] ..... 240.356614: mm_vmscan_memcg_shrink_begin: memcg=test oorder=0 gfp_flags=GFP_KERNEL
kswapd0-39 [001] ..... 240.356738: mm_vmscan_memcg_shrink_end: memcg=test nr_reclaimed=25
kswapd0-39 [001] ..... 240.356790: mm_vmscan_memcg_shrink_begin: memcg=test oorder=0 gfp_flags=GFP_KERNEL
kswapd0-39 [001] ..... 240.357125: mm_vmscan_memcg_shrink_end: memcg=test nr_reclaimed=53
Signed-off-by: Dmitry Rokosov <ddrokosov@salutedevices.com>
---
include/trace/events/vmscan.h | 14 ++++++++++++++
mm/vmscan.c | 7 +++++++
2 files changed, 21 insertions(+)
Comments
Hi Dmitry, kernel test robot noticed the following build errors: [auto build test ERROR on akpm-mm/mm-everything] url: https://github.com/intel-lab-lkp/linux/commits/Dmitry-Rokosov/mm-memcg-print-out-cgroup-name-in-the-memcg-tracepoints/20231101-183040 base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything patch link: https://lore.kernel.org/r/20231101102837.25205-3-ddrokosov%40salutedevices.com patch subject: [PATCH v1 2/2] mm: memcg: introduce new event to trace shrink_memcg config: um-allyesconfig (https://download.01.org/0day-ci/archive/20231101/202311012319.7ULVSdyR-lkp@intel.com/config) compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project.git f28c006a5895fc0e329fe15fead81e37457cb1d1) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231101/202311012319.7ULVSdyR-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202311012319.7ULVSdyR-lkp@intel.com/ All errors (new ones prefixed by >>): In file included from mm/vmscan.c:19: In file included from include/linux/kernel_stat.h:9: In file included from include/linux/interrupt.h:11: In file included from include/linux/hardirq.h:11: In file included from arch/um/include/asm/hardirq.h:5: In file included from include/asm-generic/hardirq.h:17: In file included from include/linux/irq.h:20: In file included from include/linux/io.h:13: In file included from arch/um/include/asm/io.h:24: include/asm-generic/io.h:547:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] val = __raw_readb(PCI_IOBASE + addr); ~~~~~~~~~~ ^ include/asm-generic/io.h:560:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr)); ~~~~~~~~~~ ^ include/uapi/linux/byteorder/little_endian.h:37:51: note: expanded from macro '__le16_to_cpu' #define __le16_to_cpu(x) ((__force __u16)(__le16)(x)) ^ In file included from mm/vmscan.c:19: In file included from include/linux/kernel_stat.h:9: In file included from include/linux/interrupt.h:11: In file included from include/linux/hardirq.h:11: In file included from arch/um/include/asm/hardirq.h:5: In file included from include/asm-generic/hardirq.h:17: In file included from include/linux/irq.h:20: In file included from include/linux/io.h:13: In file included from arch/um/include/asm/io.h:24: include/asm-generic/io.h:573:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr)); ~~~~~~~~~~ ^ include/uapi/linux/byteorder/little_endian.h:35:51: note: expanded from macro '__le32_to_cpu' #define __le32_to_cpu(x) ((__force __u32)(__le32)(x)) ^ In file included from mm/vmscan.c:19: In file included from include/linux/kernel_stat.h:9: In file included from include/linux/interrupt.h:11: In file included from include/linux/hardirq.h:11: In file included from arch/um/include/asm/hardirq.h:5: In file included from include/asm-generic/hardirq.h:17: In file included from include/linux/irq.h:20: In file included from include/linux/io.h:13: In file included from arch/um/include/asm/io.h:24: include/asm-generic/io.h:584:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] __raw_writeb(value, PCI_IOBASE + addr); ~~~~~~~~~~ ^ include/asm-generic/io.h:594:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr); ~~~~~~~~~~ ^ include/asm-generic/io.h:604:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr); ~~~~~~~~~~ ^ include/asm-generic/io.h:692:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] readsb(PCI_IOBASE + addr, buffer, count); ~~~~~~~~~~ ^ include/asm-generic/io.h:700:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] readsw(PCI_IOBASE + addr, buffer, count); ~~~~~~~~~~ ^ include/asm-generic/io.h:708:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] readsl(PCI_IOBASE + addr, buffer, count); ~~~~~~~~~~ ^ include/asm-generic/io.h:717:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] writesb(PCI_IOBASE + addr, buffer, count); ~~~~~~~~~~ ^ include/asm-generic/io.h:726:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] writesw(PCI_IOBASE + addr, buffer, count); ~~~~~~~~~~ ^ include/asm-generic/io.h:735:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] writesl(PCI_IOBASE + addr, buffer, count); ~~~~~~~~~~ ^ >> mm/vmscan.c:5811:3: error: implicit declaration of function 'trace_mm_vmscan_memcg_shrink_begin' is invalid in C99 [-Werror,-Wimplicit-function-declaration] trace_mm_vmscan_memcg_shrink_begin(memcg, ^ mm/vmscan.c:5811:3: note: did you mean 'trace_mm_vmscan_lru_shrink_active'? include/trace/events/vmscan.h:467:1: note: 'trace_mm_vmscan_lru_shrink_active' declared here TRACE_EVENT(mm_vmscan_lru_shrink_active, ^ include/linux/tracepoint.h:566:2: note: expanded from macro 'TRACE_EVENT' DECLARE_TRACE(name, PARAMS(proto), PARAMS(args)) ^ include/linux/tracepoint.h:432:2: note: expanded from macro 'DECLARE_TRACE' __DECLARE_TRACE(name, PARAMS(proto), PARAMS(args), \ ^ include/linux/tracepoint.h:355:21: note: expanded from macro '__DECLARE_TRACE' static inline void trace_##name(proto) \ ^ <scratch space>:33:1: note: expanded from here trace_mm_vmscan_lru_shrink_active ^ >> mm/vmscan.c:5845:3: error: implicit declaration of function 'trace_mm_vmscan_memcg_shrink_end' is invalid in C99 [-Werror,-Wimplicit-function-declaration] trace_mm_vmscan_memcg_shrink_end(memcg, ^ mm/vmscan.c:5845:3: note: did you mean 'trace_mm_vmscan_memcg_shrink_begin'? mm/vmscan.c:5811:3: note: 'trace_mm_vmscan_memcg_shrink_begin' declared here trace_mm_vmscan_memcg_shrink_begin(memcg, ^ 12 warnings and 2 errors generated. vim +/trace_mm_vmscan_memcg_shrink_begin +5811 mm/vmscan.c 5791 5792 static void shrink_node_memcgs(pg_data_t *pgdat, struct scan_control *sc) 5793 { 5794 struct mem_cgroup *target_memcg = sc->target_mem_cgroup; 5795 struct mem_cgroup *memcg; 5796 5797 memcg = mem_cgroup_iter(target_memcg, NULL, NULL); 5798 do { 5799 struct lruvec *lruvec = mem_cgroup_lruvec(memcg, pgdat); 5800 unsigned long reclaimed; 5801 unsigned long scanned; 5802 5803 /* 5804 * This loop can become CPU-bound when target memcgs 5805 * aren't eligible for reclaim - either because they 5806 * don't have any reclaimable pages, or because their 5807 * memory is explicitly protected. Avoid soft lockups. 5808 */ 5809 cond_resched(); 5810 > 5811 trace_mm_vmscan_memcg_shrink_begin(memcg, 5812 sc->order, 5813 sc->gfp_mask); 5814 5815 mem_cgroup_calculate_protection(target_memcg, memcg); 5816 5817 if (mem_cgroup_below_min(target_memcg, memcg)) { 5818 /* 5819 * Hard protection. 5820 * If there is no reclaimable memory, OOM. 5821 */ 5822 continue; 5823 } else if (mem_cgroup_below_low(target_memcg, memcg)) { 5824 /* 5825 * Soft protection. 5826 * Respect the protection only as long as 5827 * there is an unprotected supply 5828 * of reclaimable memory from other cgroups. 5829 */ 5830 if (!sc->memcg_low_reclaim) { 5831 sc->memcg_low_skipped = 1; 5832 continue; 5833 } 5834 memcg_memory_event(memcg, MEMCG_LOW); 5835 } 5836 5837 reclaimed = sc->nr_reclaimed; 5838 scanned = sc->nr_scanned; 5839 5840 shrink_lruvec(lruvec, sc); 5841 5842 shrink_slab(sc->gfp_mask, pgdat->node_id, memcg, 5843 sc->priority); 5844 > 5845 trace_mm_vmscan_memcg_shrink_end(memcg, 5846 sc->nr_reclaimed - reclaimed); 5847 5848 /* Record the group's reclaim efficiency */ 5849 if (!sc->proactive) 5850 vmpressure(sc->gfp_mask, memcg, false, 5851 sc->nr_scanned - scanned, 5852 sc->nr_reclaimed - reclaimed); 5853 5854 } while ((memcg = mem_cgroup_iter(target_memcg, memcg, NULL))); 5855 } 5856
Oh, I apologize for that. It seems that I need to wrap the new tracepoint calls with CONFIG_MEMCG. I will proceed to prepare the new version. On Wed, Nov 01, 2023 at 11:44:10PM +0800, kernel test robot wrote: > Hi Dmitry, > > kernel test robot noticed the following build errors: > > [auto build test ERROR on akpm-mm/mm-everything] > > url: https://github.com/intel-lab-lkp/linux/commits/Dmitry-Rokosov/mm-memcg-print-out-cgroup-name-in-the-memcg-tracepoints/20231101-183040 > base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything > patch link: https://lore.kernel.org/r/20231101102837.25205-3-ddrokosov%40salutedevices.com > patch subject: [PATCH v1 2/2] mm: memcg: introduce new event to trace shrink_memcg > config: um-allyesconfig (https://download.01.org/0day-ci/archive/20231101/202311012319.7ULVSdyR-lkp@intel.com/config) > compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project.git f28c006a5895fc0e329fe15fead81e37457cb1d1) > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231101/202311012319.7ULVSdyR-lkp@intel.com/reproduce) > > If you fix the issue in a separate patch/commit (i.e. not just a new version of > the same patch/commit), kindly add following tags > | Reported-by: kernel test robot <lkp@intel.com> > | Closes: https://lore.kernel.org/oe-kbuild-all/202311012319.7ULVSdyR-lkp@intel.com/ > > All errors (new ones prefixed by >>): > > In file included from mm/vmscan.c:19: > In file included from include/linux/kernel_stat.h:9: > In file included from include/linux/interrupt.h:11: > In file included from include/linux/hardirq.h:11: > In file included from arch/um/include/asm/hardirq.h:5: > In file included from include/asm-generic/hardirq.h:17: > In file included from include/linux/irq.h:20: > In file included from include/linux/io.h:13: > In file included from arch/um/include/asm/io.h:24: > include/asm-generic/io.h:547:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] > val = __raw_readb(PCI_IOBASE + addr); > ~~~~~~~~~~ ^ > include/asm-generic/io.h:560:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] > val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr)); > ~~~~~~~~~~ ^ > include/uapi/linux/byteorder/little_endian.h:37:51: note: expanded from macro '__le16_to_cpu' > #define __le16_to_cpu(x) ((__force __u16)(__le16)(x)) > ^ > In file included from mm/vmscan.c:19: > In file included from include/linux/kernel_stat.h:9: > In file included from include/linux/interrupt.h:11: > In file included from include/linux/hardirq.h:11: > In file included from arch/um/include/asm/hardirq.h:5: > In file included from include/asm-generic/hardirq.h:17: > In file included from include/linux/irq.h:20: > In file included from include/linux/io.h:13: > In file included from arch/um/include/asm/io.h:24: > include/asm-generic/io.h:573:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] > val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr)); > ~~~~~~~~~~ ^ > include/uapi/linux/byteorder/little_endian.h:35:51: note: expanded from macro '__le32_to_cpu' > #define __le32_to_cpu(x) ((__force __u32)(__le32)(x)) > ^ > In file included from mm/vmscan.c:19: > In file included from include/linux/kernel_stat.h:9: > In file included from include/linux/interrupt.h:11: > In file included from include/linux/hardirq.h:11: > In file included from arch/um/include/asm/hardirq.h:5: > In file included from include/asm-generic/hardirq.h:17: > In file included from include/linux/irq.h:20: > In file included from include/linux/io.h:13: > In file included from arch/um/include/asm/io.h:24: > include/asm-generic/io.h:584:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] > __raw_writeb(value, PCI_IOBASE + addr); > ~~~~~~~~~~ ^ > include/asm-generic/io.h:594:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] > __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr); > ~~~~~~~~~~ ^ > include/asm-generic/io.h:604:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] > __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr); > ~~~~~~~~~~ ^ > include/asm-generic/io.h:692:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] > readsb(PCI_IOBASE + addr, buffer, count); > ~~~~~~~~~~ ^ > include/asm-generic/io.h:700:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] > readsw(PCI_IOBASE + addr, buffer, count); > ~~~~~~~~~~ ^ > include/asm-generic/io.h:708:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] > readsl(PCI_IOBASE + addr, buffer, count); > ~~~~~~~~~~ ^ > include/asm-generic/io.h:717:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] > writesb(PCI_IOBASE + addr, buffer, count); > ~~~~~~~~~~ ^ > include/asm-generic/io.h:726:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] > writesw(PCI_IOBASE + addr, buffer, count); > ~~~~~~~~~~ ^ > include/asm-generic/io.h:735:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] > writesl(PCI_IOBASE + addr, buffer, count); > ~~~~~~~~~~ ^ > >> mm/vmscan.c:5811:3: error: implicit declaration of function 'trace_mm_vmscan_memcg_shrink_begin' is invalid in C99 [-Werror,-Wimplicit-function-declaration] > trace_mm_vmscan_memcg_shrink_begin(memcg, > ^ > mm/vmscan.c:5811:3: note: did you mean 'trace_mm_vmscan_lru_shrink_active'? > include/trace/events/vmscan.h:467:1: note: 'trace_mm_vmscan_lru_shrink_active' declared here > TRACE_EVENT(mm_vmscan_lru_shrink_active, > ^ > include/linux/tracepoint.h:566:2: note: expanded from macro 'TRACE_EVENT' > DECLARE_TRACE(name, PARAMS(proto), PARAMS(args)) > ^ > include/linux/tracepoint.h:432:2: note: expanded from macro 'DECLARE_TRACE' > __DECLARE_TRACE(name, PARAMS(proto), PARAMS(args), \ > ^ > include/linux/tracepoint.h:355:21: note: expanded from macro '__DECLARE_TRACE' > static inline void trace_##name(proto) \ > ^ > <scratch space>:33:1: note: expanded from here > trace_mm_vmscan_lru_shrink_active > ^ > >> mm/vmscan.c:5845:3: error: implicit declaration of function 'trace_mm_vmscan_memcg_shrink_end' is invalid in C99 [-Werror,-Wimplicit-function-declaration] > trace_mm_vmscan_memcg_shrink_end(memcg, > ^ > mm/vmscan.c:5845:3: note: did you mean 'trace_mm_vmscan_memcg_shrink_begin'? > mm/vmscan.c:5811:3: note: 'trace_mm_vmscan_memcg_shrink_begin' declared here > trace_mm_vmscan_memcg_shrink_begin(memcg, > ^ > 12 warnings and 2 errors generated. > > > vim +/trace_mm_vmscan_memcg_shrink_begin +5811 mm/vmscan.c > > 5791 > 5792 static void shrink_node_memcgs(pg_data_t *pgdat, struct scan_control *sc) > 5793 { > 5794 struct mem_cgroup *target_memcg = sc->target_mem_cgroup; > 5795 struct mem_cgroup *memcg; > 5796 > 5797 memcg = mem_cgroup_iter(target_memcg, NULL, NULL); > 5798 do { > 5799 struct lruvec *lruvec = mem_cgroup_lruvec(memcg, pgdat); > 5800 unsigned long reclaimed; > 5801 unsigned long scanned; > 5802 > 5803 /* > 5804 * This loop can become CPU-bound when target memcgs > 5805 * aren't eligible for reclaim - either because they > 5806 * don't have any reclaimable pages, or because their > 5807 * memory is explicitly protected. Avoid soft lockups. > 5808 */ > 5809 cond_resched(); > 5810 > > 5811 trace_mm_vmscan_memcg_shrink_begin(memcg, > 5812 sc->order, > 5813 sc->gfp_mask); > 5814 > 5815 mem_cgroup_calculate_protection(target_memcg, memcg); > 5816 > 5817 if (mem_cgroup_below_min(target_memcg, memcg)) { > 5818 /* > 5819 * Hard protection. > 5820 * If there is no reclaimable memory, OOM. > 5821 */ > 5822 continue; > 5823 } else if (mem_cgroup_below_low(target_memcg, memcg)) { > 5824 /* > 5825 * Soft protection. > 5826 * Respect the protection only as long as > 5827 * there is an unprotected supply > 5828 * of reclaimable memory from other cgroups. > 5829 */ > 5830 if (!sc->memcg_low_reclaim) { > 5831 sc->memcg_low_skipped = 1; > 5832 continue; > 5833 } > 5834 memcg_memory_event(memcg, MEMCG_LOW); > 5835 } > 5836 > 5837 reclaimed = sc->nr_reclaimed; > 5838 scanned = sc->nr_scanned; > 5839 > 5840 shrink_lruvec(lruvec, sc); > 5841 > 5842 shrink_slab(sc->gfp_mask, pgdat->node_id, memcg, > 5843 sc->priority); > 5844 > > 5845 trace_mm_vmscan_memcg_shrink_end(memcg, > 5846 sc->nr_reclaimed - reclaimed); > 5847 > 5848 /* Record the group's reclaim efficiency */ > 5849 if (!sc->proactive) > 5850 vmpressure(sc->gfp_mask, memcg, false, > 5851 sc->nr_scanned - scanned, > 5852 sc->nr_reclaimed - reclaimed); > 5853 > 5854 } while ((memcg = mem_cgroup_iter(target_memcg, memcg, NULL))); > 5855 } > 5856 > > -- > 0-DAY CI Kernel Test Service > https://github.com/intel/lkp-tests/wiki
Hi Dmitry, kernel test robot noticed the following build errors: [auto build test ERROR on akpm-mm/mm-everything] url: https://github.com/intel-lab-lkp/linux/commits/Dmitry-Rokosov/mm-memcg-print-out-cgroup-name-in-the-memcg-tracepoints/20231101-183040 base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything patch link: https://lore.kernel.org/r/20231101102837.25205-3-ddrokosov%40salutedevices.com patch subject: [PATCH v1 2/2] mm: memcg: introduce new event to trace shrink_memcg config: sh-allnoconfig (https://download.01.org/0day-ci/archive/20231102/202311021126.DNKIAcbq-lkp@intel.com/config) compiler: sh4-linux-gcc (GCC) 13.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231102/202311021126.DNKIAcbq-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202311021126.DNKIAcbq-lkp@intel.com/ All errors (new ones prefixed by >>): mm/vmscan.c: In function 'shrink_node_memcgs': >> mm/vmscan.c:5811:17: error: implicit declaration of function 'trace_mm_vmscan_memcg_shrink_begin'; did you mean 'trace_mm_vmscan_lru_shrink_active'? [-Werror=implicit-function-declaration] 5811 | trace_mm_vmscan_memcg_shrink_begin(memcg, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | trace_mm_vmscan_lru_shrink_active mm/vmscan.c:5845:17: error: implicit declaration of function 'trace_mm_vmscan_memcg_shrink_end'; did you mean 'trace_mm_vmscan_lru_shrink_active'? [-Werror=implicit-function-declaration] 5845 | trace_mm_vmscan_memcg_shrink_end(memcg, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | trace_mm_vmscan_lru_shrink_active cc1: some warnings being treated as errors vim +5811 mm/vmscan.c 5791 5792 static void shrink_node_memcgs(pg_data_t *pgdat, struct scan_control *sc) 5793 { 5794 struct mem_cgroup *target_memcg = sc->target_mem_cgroup; 5795 struct mem_cgroup *memcg; 5796 5797 memcg = mem_cgroup_iter(target_memcg, NULL, NULL); 5798 do { 5799 struct lruvec *lruvec = mem_cgroup_lruvec(memcg, pgdat); 5800 unsigned long reclaimed; 5801 unsigned long scanned; 5802 5803 /* 5804 * This loop can become CPU-bound when target memcgs 5805 * aren't eligible for reclaim - either because they 5806 * don't have any reclaimable pages, or because their 5807 * memory is explicitly protected. Avoid soft lockups. 5808 */ 5809 cond_resched(); 5810 > 5811 trace_mm_vmscan_memcg_shrink_begin(memcg, 5812 sc->order, 5813 sc->gfp_mask); 5814 5815 mem_cgroup_calculate_protection(target_memcg, memcg); 5816 5817 if (mem_cgroup_below_min(target_memcg, memcg)) { 5818 /* 5819 * Hard protection. 5820 * If there is no reclaimable memory, OOM. 5821 */ 5822 continue; 5823 } else if (mem_cgroup_below_low(target_memcg, memcg)) { 5824 /* 5825 * Soft protection. 5826 * Respect the protection only as long as 5827 * there is an unprotected supply 5828 * of reclaimable memory from other cgroups. 5829 */ 5830 if (!sc->memcg_low_reclaim) { 5831 sc->memcg_low_skipped = 1; 5832 continue; 5833 } 5834 memcg_memory_event(memcg, MEMCG_LOW); 5835 } 5836 5837 reclaimed = sc->nr_reclaimed; 5838 scanned = sc->nr_scanned; 5839 5840 shrink_lruvec(lruvec, sc); 5841 5842 shrink_slab(sc->gfp_mask, pgdat->node_id, memcg, 5843 sc->priority); 5844 5845 trace_mm_vmscan_memcg_shrink_end(memcg, 5846 sc->nr_reclaimed - reclaimed); 5847 5848 /* Record the group's reclaim efficiency */ 5849 if (!sc->proactive) 5850 vmpressure(sc->gfp_mask, memcg, false, 5851 sc->nr_scanned - scanned, 5852 sc->nr_reclaimed - reclaimed); 5853 5854 } while ((memcg = mem_cgroup_iter(target_memcg, memcg, NULL))); 5855 } 5856
diff --git a/include/trace/events/vmscan.h b/include/trace/events/vmscan.h index 124bc22866c8..518e7232c9eb 100644 --- a/include/trace/events/vmscan.h +++ b/include/trace/events/vmscan.h @@ -182,6 +182,13 @@ DEFINE_EVENT(mm_vmscan_memcg_reclaim_begin_template, mm_vmscan_memcg_softlimit_r TP_ARGS(memcg, order, gfp_flags) ); +DEFINE_EVENT(mm_vmscan_memcg_reclaim_begin_template, mm_vmscan_memcg_shrink_begin, + + TP_PROTO(const struct mem_cgroup *memcg, int order, gfp_t gfp_flags), + + TP_ARGS(memcg, order, gfp_flags) +); + #endif /* CONFIG_MEMCG */ DECLARE_EVENT_CLASS(mm_vmscan_direct_reclaim_end_template, @@ -247,6 +254,13 @@ DEFINE_EVENT(mm_vmscan_memcg_reclaim_end_template, mm_vmscan_memcg_softlimit_rec TP_ARGS(memcg, nr_reclaimed) ); +DEFINE_EVENT(mm_vmscan_memcg_reclaim_end_template, mm_vmscan_memcg_shrink_end, + + TP_PROTO(const struct mem_cgroup *memcg, unsigned long nr_reclaimed), + + TP_ARGS(memcg, nr_reclaimed) +); + #endif /* CONFIG_MEMCG */ TRACE_EVENT(mm_shrink_slab_start, diff --git a/mm/vmscan.c b/mm/vmscan.c index 4309eaf188b4..6b9619922dfb 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -6461,6 +6461,10 @@ static void shrink_node_memcgs(pg_data_t *pgdat, struct scan_control *sc) */ cond_resched(); + trace_mm_vmscan_memcg_shrink_begin(memcg, + sc->order, + sc->gfp_mask); + mem_cgroup_calculate_protection(target_memcg, memcg); if (mem_cgroup_below_min(target_memcg, memcg)) { @@ -6491,6 +6495,9 @@ static void shrink_node_memcgs(pg_data_t *pgdat, struct scan_control *sc) shrink_slab(sc->gfp_mask, pgdat->node_id, memcg, sc->priority); + trace_mm_vmscan_memcg_shrink_end(memcg, + sc->nr_reclaimed - reclaimed); + /* Record the group's reclaim efficiency */ if (!sc->proactive) vmpressure(sc->gfp_mask, memcg, false,