Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp159819rdh; Wed, 22 Nov 2023 23:24:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IE/XSwpb823CbOZuCBuavUEwiPvjDuPL8V5iGIPkmpyIuhaOjC1YCmk2Pybjym6yIbEBMcF X-Received: by 2002:a05:6a21:398c:b0:152:be08:b013 with SMTP id ad12-20020a056a21398c00b00152be08b013mr4847128pzc.42.1700724283340; Wed, 22 Nov 2023 23:24:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700724283; cv=none; d=google.com; s=arc-20160816; b=Z3JoGIXBAt10tfsJiszcHiTLN3bDlgqJ2sdJ/1pdvb55Ej+UWVVt8Swj3kkZBWr4zc hvPZOTMjSqowPcuDkmp2l1t0/nmFWGL0doX+jeHcEPvhNcuBtgqklB/O1525UAY4WKyC /FPPT4ZEOmIQLD0Ux3BLS2g9p199j8eeXImrjjU0Jq7L16bioo6/GTzg3Zdymxzrpj+a BCuzOVmcg8SW6ATvWepGL7wE+vxSGIAGoTiQsIohs/L74v7z8ljK18d7KRWS+J9PzlNG JwQypBMb7uPamOMhDaxfr0DQLXmfD3lJdCLkTgliuH2g55ZjMqhrnr0pGIbPRuP8KQVi 7a+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 :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 2620:137:e000::3:3 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 lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id o14-20020a17090a4b4e00b0027cf6bb27dfsi1241373pjl.39.2023.11.22.23.24.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Nov 2023 23:24:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; 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 2620:137:e000::3:3 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 E927E807EB8D; Wed, 22 Nov 2023 23:20:18 -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 + 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 ); 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 To: , , , , , CC: , , , , , , Dmitry Rokosov 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: 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:19 -0800 (PST) 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 -- 2.36.0