From patchwork Wed Jun 5 07:01:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiu Jianfeng X-Patchwork-Id: 13686246 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 D5275C25B76 for ; Wed, 5 Jun 2024 07:09:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 50EBB6B008C; Wed, 5 Jun 2024 03:09:15 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 49D316B0093; Wed, 5 Jun 2024 03:09:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1F94F6B0092; Wed, 5 Jun 2024 03:09:15 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id F16DA6B008A for ; Wed, 5 Jun 2024 03:09:14 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 79CCB1C10DE for ; Wed, 5 Jun 2024 07:09:14 +0000 (UTC) X-FDA: 82195958628.10.341AF47 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf02.hostedemail.com (Postfix) with ESMTP id 48A5980008 for ; Wed, 5 Jun 2024 07:09:10 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf02.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=1717571352; 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:in-reply-to:references:references; bh=ZLm+g6YurgVM/SWhQxLU91h2Iant6voNfOH9F7zZvJc=; b=VseT8rHk4NIckY3z5e2mI3u9eIhYIbPlOY3SfQlB3VOQOkgmKqPSRporUnQgx63xU6P2fG AA6s1iqghyt0tvLU8YybVJvg9S/menHOkYFFZYJwsFWf9klXjC4IOIH4/HsbxmlbE8W+kM U4XGoqPJs55chjGmWVOChtu/xeNIOj8= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf02.hostedemail.com: domain of xiujianfeng@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=xiujianfeng@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1717571352; a=rsa-sha256; cv=none; b=Z1nn7TYxezsc/0YsjlMvua38NiIvflDQQS0CU2ste3VuBR6PK8jTnR4DAa3YepbOf6LvCs EoJf2V5tMFgdzLqXdPIge77wFE85ItYuPv5s2NdHJBe7ATRJ7VmVA6ehxCEqK/5Y9H1MSK cmDW4TcxeNc9PLMqhHdpUJoCFpIwKdw= Received: from mail.maildlp.com (unknown [172.19.163.252]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4VvJPg5KyHzsRVD; Wed, 5 Jun 2024 15:05:11 +0800 (CST) Received: from dggpeml500023.china.huawei.com (unknown [7.185.36.114]) by mail.maildlp.com (Postfix) with ESMTPS id 5AAF218007A; Wed, 5 Jun 2024 15:09:08 +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; Wed, 5 Jun 2024 15:09:08 +0800 From: Xiu Jianfeng To: , CC: , Subject: [PATCH v2 -next 1/3] mm/hugetlb_cgroup: identify the legacy using cgroup_subsys_on_dfl() Date: Wed, 5 Jun 2024 07:01:31 +0000 Message-ID: <20240605070133.1941677-2-xiujianfeng@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240605070133.1941677-1-xiujianfeng@huawei.com> References: <20240605070133.1941677-1-xiujianfeng@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.174.26] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpeml500023.china.huawei.com (7.185.36.114) X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 48A5980008 X-Stat-Signature: trqroxce38s3qbm1m7xrdsweks3z7iq5 X-HE-Tag: 1717571350-846109 X-HE-Meta: U2FsdGVkX19g/zyzdSiv7qmPYIRxxn/F3vE95ejNwB/5ynR+StUrF5stL6DxinQLWytbEPth2vhsvc/6YTvpdgYePlsFdlpmxk1MFmoMbN8bv9+SF89gaz52CL9sihNgLrYDl8wqW5kYCK4s6abyw9zImrTH7bxBGfhcmrNkNZQ6vCxcnclFprZ5buBGzROtAznwWQv7SjmcfsN76V1HNTHXV/O47RPIK02e4VX0uWH6/dkIJGLO62TOxA6Q8O/8hNZGsEIxxhWWn/Z3svOx462jqXx+ILw6c0fy0n+4bO3SBCxRRmKb6ckSNa16MwLua56KpnQwqRO1M0qR0Dh2gEC6+PdJSEyV5XMpAu44v0o5I6iSNukeUnrWRvDeI7Ci81kZOVqL1iewlm/DnpqTm8ViGjsH5HXAhjPX/fWupBZ+yQhE/6RxodBKrxD5gaGvZT/5+07xmFZW+4jW4YNdTRL5rDajfkpMyqq5JSqbWergUEc5h072/WNGEExCsSqkZ/Y8Byr7Xr5/s45QJr8WTiZdm5viPH2ZhU+V6N25T7F49bAPR9ayMV+KvvR5taR/hKQblEEggzN+FzIE8AJSzPAqa+tdrpxEW5aNRuiM0Juy6m4yyk+r85yN9OdPFctdC/NdsZAR/Vj6dPNggs7lKWrvQsudnYjG+PbH6Zx4gK5Lzs9QLM0bKIc8HWHZK9f3YCzLwgM4AnIE4cCelGJtrTscLkTkdrNkkeSw9jNDnaiN7ePlqZxilTJycNvxC+zsnCPbBTmlHaNVQcHmHXScGdaOhW7jH6MchzOVr2MfeZgnLMT329Smm5WLqOVYSrKIblOR22CXfooX6jCxUiqgedkGZjd4Q2jxQJyitLRgvwLFfMnzAY91nAv9HUX7rvbDbWhnykWoLMIXM0eQHCV35b+dFurWQApXLaU5Sav+hULSg2/Ho0F8iIB5zTjwe0e9TIfykBFJLFhPD2Ggarv l1xs23jS 8rySEbD9XJCrf/3CjJp512xZcsA8C9fJswprf8CmfpWYsXUkxQ2QwnOTMF8zEp+bM0eto+PgT5XFzyHmwm6aI4eotD6767QzGXYyZCLLoAd/1u1y02PqqQbicbPpj3a7sE4oDSTSat53WsM9Z/s+p2iELKVbs2w5CDOZAQXMTXFtg1pEJOktGYkiUPiXtQFOCJeLE 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: Currently the numa_stat file encodes 1 into private using the micro MEMFILE_PRIVATE() to identify the legacy. Actually, we can use cgroup_subsys_on_dfl() instead. This is helpful to handle .private in the static array of the comming patch. Signed-off-by: Xiu Jianfeng Reviewed-by: Oscar Salvador --- mm/hugetlb_cgroup.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/hugetlb_cgroup.c b/mm/hugetlb_cgroup.c index e20339a346b9..45f94a869776 100644 --- a/mm/hugetlb_cgroup.c +++ b/mm/hugetlb_cgroup.c @@ -460,7 +460,7 @@ static int hugetlb_cgroup_read_numa_stat(struct seq_file *seq, void *dummy) int nid; struct cftype *cft = seq_cft(seq); int idx = MEMFILE_IDX(cft->private); - bool legacy = MEMFILE_ATTR(cft->private); + bool legacy = !cgroup_subsys_on_dfl(hugetlb_cgrp_subsys); struct hugetlb_cgroup *h_cg = hugetlb_cgroup_from_css(seq_css(seq)); struct cgroup_subsys_state *css; unsigned long usage; @@ -839,7 +839,7 @@ static void __init __hugetlb_cgroup_file_legacy_init(int idx) /* Add the numa stat file */ cft = &h->cgroup_files_legacy[8]; snprintf(cft->name, MAX_CFTYPE_NAME, "%s.numa_stat", buf); - cft->private = MEMFILE_PRIVATE(idx, 1); + cft->private = MEMFILE_PRIVATE(idx, 0); cft->seq_show = hugetlb_cgroup_read_numa_stat; /* NULL terminate the last cft */