From patchwork Tue Jul 2 12:57:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiu Jianfeng X-Patchwork-Id: 13719609 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 39ED7C3064D for ; Tue, 2 Jul 2024 13:05:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 847E76B007B; Tue, 2 Jul 2024 09:05:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7F8516B0088; Tue, 2 Jul 2024 09:05:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6C03D6B0089; Tue, 2 Jul 2024 09:05:57 -0400 (EDT) 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 4E1FF6B007B for ; Tue, 2 Jul 2024 09:05:57 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id DEB4AC217B for ; Tue, 2 Jul 2024 13:05:56 +0000 (UTC) X-FDA: 82294835112.03.FDA4F51 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf16.hostedemail.com (Postfix) with ESMTP id 99A90180020 for ; Tue, 2 Jul 2024 13:05:53 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf16.hostedemail.com: domain of xiujianfeng@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=xiujianfeng@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1719925529; 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:content-transfer-encoding:in-reply-to: references; bh=kmo+1bpm+5JNBvGlx8KhDEuttOoEB0pRZ6ClNLg8oaE=; b=g7TjBY3EGP8dD3szp3L6mzrimcGG07g0ADN2RrwsGBIsxhAFbxQ7Zvmi9KqR08hoGHVauK GrfwdPD5zzkPwD9O3KTmJdS3K9Pj0Kq55nBruQF0ZwUYgqUzmrbZVOl/hbthTFQrrc0EbC S7H1XZSMKtJ5p9JOAcxALoJbqXp9mZY= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1719925529; a=rsa-sha256; cv=none; b=tXd5F+w6m1XX5Kw9i0JouRTJPhPj7Gqel9vW9cFiMBZ3lcpUz5c3e/RnthRHFZRLeEDOBd vhZGQ9sgOxLSzL1ixCqSc2FqJ7BLbz8EOH9inTw9j/j7nhL6UP47GwdZNzF6MWy7Kbr+zY H8Oh/LPfTsBQjcAzceyCI2hWN9ZL9Qg= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf16.hostedemail.com: domain of xiujianfeng@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=xiujianfeng@huawei.com Received: from mail.maildlp.com (unknown [172.19.163.252]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4WD3245mcJzZh3K; Tue, 2 Jul 2024 21:01:16 +0800 (CST) Received: from dggpeml500023.china.huawei.com (unknown [7.185.36.114]) by mail.maildlp.com (Postfix) with ESMTPS id 2449E18007E; Tue, 2 Jul 2024 21:05:49 +0800 (CST) Received: from hulk-vt.huawei.com (10.67.174.26) by dggpeml500023.china.huawei.com (7.185.36.114) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Tue, 2 Jul 2024 21:05:48 +0800 From: Xiu Jianfeng To: , , , , CC: , , , Subject: [PATCH -next] mm/hugetlb_cgroup: introduce peak and rsvd.peak to v2 Date: Tue, 2 Jul 2024 12:57:28 +0000 Message-ID: <20240702125728.2743143-1-xiujianfeng@huawei.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Originating-IP: [10.67.174.26] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpeml500023.china.huawei.com (7.185.36.114) X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 99A90180020 X-Stat-Signature: 8yf58umtj34zjop71ziisiprtpz55f6m X-Rspam-User: X-HE-Tag: 1719925553-244243 X-HE-Meta: U2FsdGVkX1+rK9b7H7dhoudU37SvKhGWfYU4L4jwWUHtuSX3mUgv+uiJi2nt/1FeLRK5GlxBXLu8zqQTBZx/ga0U0EPFJQpnvnpwHc+hZgwQ/oopuLacQqtaBCX8SkRR2jMwSYRc3L+sJnLdVazgtPJzs+z6nZsWL22njgnm2sSoQm5Weej4khhH5jUuUc0laKzU7h5Ei2h61KrxzWvIwEWetxyfIbpuk6b3wvoXxpcUwIs08LdX3Pl+8HOpGSA0nEqRWTrL+NEm4z7PyBmaGOFNXIBWZqu8F1SNCELCrieh6dMTqZ1g1hW+zfJePSyrngn4J/sf3gLbz2mIOx44hbNWrciz7hrqsUAPB4Q2tlBzvTmeC5sXnTZEtwQmIy7M7TCFWU6HhGnCRj8mSNIh+0TshmB2ghWkP97qdt88Dhe6JIls4v6rYdz8Thxqc3ImeG5R6HAu/AtYG4f+p7oL2xI97gqCTEhUeTRG2bsSzq6b6pvBfDsCdSB5lB5slebFEDY0p+h0GXTPzXVdBybP1NTB0G0O91/Q0jTkr4n2K8QWqUEkkNha+TEIX/Tkg3tmBrljYrGWRicvSZRzD6U1a97LFudR6MnCRqJK04TssvdJegaGA0MQWTAEhW/bfwnQ5yeWhXOY0wzV6/8xs/YficTLH4AmdQKWs5+Ks5BJWOsFKJ1xgOJupDG6FIytPg8v0N14IAFZWObmlum6YyB4ASwj455/c4OaDFBXEBADkAClXPfG1faxKcISnkazTDHtZL2tP5XSbSiY0R+9zoPzij05iOKLuYKQNxhhmpnt0pxGCwicU/gg+YEfgAH1q2QseAKEanInl53rXZTW4IlosLrZtNCFzav4hRdjHhYJXqzuhhbXhYmoY87yoWUsADjsjiGkNwEwK8tvdt1PG03QuZa63NH+dJSrVmsgcYvCliQFHC4oZrY3+URkHJSed0XLo3aZvz1lCGRTEvgtI1V /+fGU1p2 U8rfHVD5OLdG0HLx1Pij0tGSrUcxyPnkm3KZtfoJdwL8gvecx5tQrkNqLxyJqZ8C2oFOpdTwlbQLt2vfFW93ddB3NmU68mCogfTnrOh+H+4jsbWN3xQVcabwOHRkLgBfeQJgF5M95485zW8Sg9FSW1OXuNFmnqBkQWtTW7akDP6Xv9sctUY9rKJ/XxRSq+f6wG3HX 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: Introduce peak and rsvd.peak to v2 to show the historical maximum usage of resources, as in some scenarios it is necessary to configure the value of max/rsvd.max based on the peak usage of resources. Signed-off-by: Xiu Jianfeng --- Documentation/admin-guide/cgroup-v2.rst | 8 ++++++++ mm/hugetlb_cgroup.c | 19 +++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/Documentation/admin-guide/cgroup-v2.rst b/Documentation/admin-guide/cgroup-v2.rst index ae0fdb6fc618..97d19968230a 100644 --- a/Documentation/admin-guide/cgroup-v2.rst +++ b/Documentation/admin-guide/cgroup-v2.rst @@ -2607,6 +2607,14 @@ HugeTLB Interface Files hugetlb pages of in this cgroup. Only active in use hugetlb pages are included. The per-node values are in bytes. + hugetlb..peak + Show historical maximum usage for "hugepagesize" hugetlb. It exists + for all the cgroup except root. + + hugetlb..rsvd.peak + Show historical maximum usage for "hugepagesize" hugetlb reservations. + It exists for all the cgroup except root. + Misc ---- diff --git a/mm/hugetlb_cgroup.c b/mm/hugetlb_cgroup.c index 4ff238ba1250..f443a56409a9 100644 --- a/mm/hugetlb_cgroup.c +++ b/mm/hugetlb_cgroup.c @@ -583,6 +583,13 @@ static int hugetlb_cgroup_read_u64_max(struct seq_file *seq, void *v) else seq_printf(seq, "%llu\n", val * PAGE_SIZE); break; + case RES_RSVD_MAX_USAGE: + counter = &h_cg->rsvd_hugepage[idx]; + fallthrough; + case RES_MAX_USAGE: + val = (u64)counter->watermark; + seq_printf(seq, "%llu\n", val * PAGE_SIZE); + break; default: BUG(); } @@ -739,6 +746,18 @@ static struct cftype hugetlb_dfl_tmpl[] = { .seq_show = hugetlb_cgroup_read_u64_max, .flags = CFTYPE_NOT_ON_ROOT, }, + { + .name = "peak", + .private = RES_MAX_USAGE, + .seq_show = hugetlb_cgroup_read_u64_max, + .flags = CFTYPE_NOT_ON_ROOT, + }, + { + .name = "rsvd.peak", + .private = RES_RSVD_MAX_USAGE, + .seq_show = hugetlb_cgroup_read_u64_max, + .flags = CFTYPE_NOT_ON_ROOT, + }, { .name = "events", .seq_show = hugetlb_events_show,