Message ID | 20231123071945.25811-1-ddrokosov@salutedevices.com |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce62:0:b0:403:3b70:6f57 with SMTP id o2csp271045vqx; Wed, 22 Nov 2023 23:20:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IHqrrnFnufVsajzeF+f4oVbeftDP+/m/3rB0S6mUri5bkh+JlgjgvaAm1oXOrhyyyauXO8B X-Received: by 2002:a05:6808:2099:b0:3b8:3bbc:6b6a with SMTP id s25-20020a056808209900b003b83bbc6b6amr6162432oiw.24.1700724013377; Wed, 22 Nov 2023 23:20:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700724013; cv=none; d=google.com; s=arc-20160816; b=WetfwGLUj4pmkTPYcbsPTw/cU/APzUbQEEIc6WUk+WtGDSu8O2XL23e0yyB32P65qL J+MBr9zGHZ2uCOUn5CMV7tDlqAZuwkFnTNeesVFqFAHQdGOmwqIo+l5RPM+bNcCAKolF RHJy+k/945WKcqX05U6r03bX5iwGzi1wb0CnoC/BqdYBagXVMvj3MqfTm56z9bqK4WDA mLMF9Z/AIaPAynB+xKBOsMXxXYjuEcsdstq5Syvv2Av/RihJeiLeJDJhbgeqd5Jzuj+Z CbN52YOc3ZE2ypKW9xcU/SGf/xXB91qTU716Ix1sxRv2SZdmNn0HxsUft0FVCsz6jxq3 8lMw== 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 :message-id:date:subject:cc:to:from:dkim-signature:dkim-filter; bh=lZF9371oFwWHYclBtgIos+B4yi9eiNAnR9wB8hzCp2Y=; fh=57iOmzb97eDQ5PTpE5/AeJmSah+c6lbNMY1SDlw7sww=; b=s2YteObNOlHC2i3MCS/SiL2SATLTOrKsJSGgW6acbKziZkDZa5JEWRQOIRxfJDNRL5 4C2bWZAs5Tu4KBJIb1JbTYuvsGUXs1McSsB1+NsSsYr4tyuM5J5GamXPK94YdMSn1jxy zZPAgZ0+RdGbSLxOuKQB6CJa/ACxaV1H4IR5Bpl13odOwxGXF0nxSR1qD0u/k//+tySO 6c+mmPRrL5NcXAnomTOTBdTDfqKzqIfE45m3N51GrvN5V4TFQjRkYrDnHmL/FG4fTt9a xt+mOeOfKGLZUulToqXqdwLy+zOBR5WL6VdbOTr+If1hKLB7kFFCwzFTIZxTLhMCJ+Kr FxuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@salutedevices.com header.s=mail header.b=j0R1+coT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id k2-20020a634b42000000b005641315d956si797361pgl.147.2023.11.22.23.20.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Nov 2023 23:20:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@salutedevices.com header.s=mail header.b=j0R1+coT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (Postfix) with ESMTP id 87B918263777; Wed, 22 Nov 2023 23:20:07 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343693AbjKWHT6 (ORCPT <rfc822;ouuuleilei@gmail.com> + 99 others); Thu, 23 Nov 2023 02:19:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60116 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231316AbjKWHT5 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 23 Nov 2023 02:19:57 -0500 Received: from mx1.sberdevices.ru (mx2.sberdevices.ru [45.89.224.132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44865E7; Wed, 22 Nov 2023 23:20:01 -0800 (PST) Received: from p-infra-ksmg-sc-msk02 (localhost [127.0.0.1]) by mx1.sberdevices.ru (Postfix) with ESMTP id F3C7D120069; Thu, 23 Nov 2023 10:19:57 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.sberdevices.ru F3C7D120069 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=salutedevices.com; s=mail; t=1700723998; bh=lZF9371oFwWHYclBtgIos+B4yi9eiNAnR9wB8hzCp2Y=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type:From; b=j0R1+coT6RwtVmEQ3JuUoAtNtwg94Qu3dV9y4OhXC3gmCvOVxw6UaFeLEIqQ/xUOB uoxORQsiuW8AQgq4iOaDwm4wqU8QgEepDzmKxq9lE9DROtAKFiwSZH7jMBjwV++dR0 3rBhQLXRJSAhxgUDba7Of6C1P0O/V97/Zssezj4vtXMR/zObBEEF1jcf4WIgnMGpKO d8jXsS/DXNisgI46uxFPL/IBmp/NqdQaw1nYTImFocDpmQUpU9gu3mUjpeYT1mqu9A GMCOtHivhxEeXZj4a387ghj/ef+mtnSIAdXH6XNzCOkFe7OLZvJ//zk7cYvsWS/6jV r+Hb0WJuX/RXg== 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 10:19:57 +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.40; Thu, 23 Nov 2023 10:19:56 +0300 From: Dmitry Rokosov <ddrokosov@salutedevices.com> To: <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 v3 0/3] samples: introduce cgroup events listeners Date: Thu, 23 Nov 2023 10:19:42 +0300 Message-ID: <20231123071945.25811-1-ddrokosov@salutedevices.com> X-Mailer: git-send-email 2.36.0 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: 181550 [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, {Tracking_uf_ne_domains}, {Tracking_from_domain_doesnt_match_to}, d41d8cd98f00b204e9800998ecf8427e.com:7.1.1;salutedevices.com:7.1.1;127.0.0.199:7.1.2;100.64.160.123:7.1.2;p-i-exch-sc-m01.sberdevices.ru:5.0.1,7.1.1;lore.kernel.org: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, bases: 2023/11/23 06:48:00 X-KSMG-LinksScanning: Clean, bases: 2023/11/23 06:48:00 X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 2.0.1.6960, bases: 2023/11/23 04:50:00 #22507336 X-KSMG-AntiVirus-Status: Clean, skipped X-Spam-Status: No, score=0.8 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_BLACK autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.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 (lipwig.vger.email [0.0.0.0]); Wed, 22 Nov 2023 23:20:07 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783338383071684107 X-GMAIL-MSGID: 1783338383071684107 |
Series |
samples: introduce cgroup events listeners
|
|
Message
Dmitry Rokosov
Nov. 23, 2023, 7:19 a.m. UTC
To begin with, this patch series relocates the cgroup example code to the samples/cgroup directory, which is the appropriate location for such code snippets. Furthermore, a new memcg events listener is introduced. This listener is a simple yet effective tool for monitoring memory events and managing counter changes during runtime. Additionally, as per Andrew Morton's suggestion, a helpful reminder comment is included in the memcontrol implementation. This comment serves to ensure that the samples code is updated whenever new events are added. Changes v3 since v2 at [2]: - rename cgroup_v2_event_listener to memcg_event_listener per Andrew's suggestion Changes v2 since v1 at [1]: - create new samples subdir - cgroup - move cgroup_event_listener for cgroup v1 to samples/cgroup - add a reminder comment to memcontrol implementation Links: [1] - https://lore.kernel.org/all/20231013184107.28734-1-ddrokosov@salutedevices.com/ [2] - https://lore.kernel.org/all/20231110082045.19407-1-ddrokosov@salutedevices.com/ Dmitry Rokosov (3): samples: introduce new samples subdir for cgroup samples/cgroup: introduce memcg memory.events listener mm: memcg: add reminder comment for the memcg v2 events MAINTAINERS | 1 + mm/memcontrol.c | 4 + samples/Kconfig | 6 + samples/Makefile | 1 + samples/cgroup/Makefile | 5 + .../cgroup/cgroup_event_listener.c | 0 samples/cgroup/memcg_event_listener.c | 330 ++++++++++++++++++ tools/cgroup/Makefile | 11 - 8 files changed, 347 insertions(+), 11 deletions(-) create mode 100644 samples/cgroup/Makefile rename {tools => samples}/cgroup/cgroup_event_listener.c (100%) create mode 100644 samples/cgroup/memcg_event_listener.c delete mode 100644 tools/cgroup/Makefile
Comments
On Thu, 23 Nov 2023 10:19:42 +0300 Dmitry Rokosov <ddrokosov@salutedevices.com> wrote: > To begin with, this patch series relocates the cgroup example code to > the samples/cgroup directory, which is the appropriate location for such > code snippets. butbut. Didn't we decide to do s/cgroup/memcg/ throughout?
On Fri, Nov 24, 2023 at 11:42:30AM -0800, Andrew Morton wrote: > On Thu, 23 Nov 2023 10:19:42 +0300 Dmitry Rokosov <ddrokosov@salutedevices.com> wrote: > > > To begin with, this patch series relocates the cgroup example code to > > the samples/cgroup directory, which is the appropriate location for such > > code snippets. > > butbut. Didn't we decide to do s/cgroup/memcg/ throughout? I believe the samples directory should be named "samples/cgroup" instead of "memcg" because the cgroup v1 event listener cannot be renamed to "memcg" due to the common naming of cgroup v1 event_control (this sample uses that control to access eventfd). Additionally, I think it would be a good idea to add the new samples for cgroup helpers in that directory. That's why I have only renamed the new memcg listener.
Andrew, On Fri, Nov 24, 2023 at 11:06:33PM +0300, Dmitry Rokosov wrote: > On Fri, Nov 24, 2023 at 11:42:30AM -0800, Andrew Morton wrote: > > On Thu, 23 Nov 2023 10:19:42 +0300 Dmitry Rokosov <ddrokosov@salutedevices.com> wrote: > > > > > To begin with, this patch series relocates the cgroup example code to > > > the samples/cgroup directory, which is the appropriate location for such > > > code snippets. > > > > butbut. Didn't we decide to do s/cgroup/memcg/ throughout? > > I believe the samples directory should be named "samples/cgroup" instead > of "memcg" because the cgroup v1 event listener cannot be renamed to > "memcg" due to the common naming of cgroup v1 event_control (this sample > uses that control to access eventfd). > > Additionally, I think it would be a good idea to add the new samples for > cgroup helpers in that directory. > > That's why I have only renamed the new memcg listener. I looked into this more deeply. And yes, the old cgroup.event_control has the common name, but it's used in the memcg implementation only. So, if we plan to introduce new samples for cgroup, I suggest we use the following naming convention: 1) Directory: samples/cgroup 2) V1 sample: memcg_v1_event_listener 3) V2 sample: memcg_v2_event_listener Please let me know what you think about this. If it's okay with you, I will prepare the v4 version with the above changes. I would appreciate any feedback on that!"