Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp919768lqj; Mon, 3 Jun 2024 05:13:15 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXbe0M0ldWYpXCIiK5yqcYIhmt8vMVCTSaPiJsFimLYb4IFE98e4ictIrLvjDnjgdZblSH/wKmbkE2VyedYrYEKYjlsKwM9dfHAajkCPg== X-Google-Smtp-Source: AGHT+IGIeQsQXeKpM2kyefip1cbrlAXv3Ka2ebwp2oQywckwIW13id3LF/SVTv/o9zFxceSgUFTc X-Received: by 2002:a50:cd04:0:b0:57a:2fc1:e838 with SMTP id 4fb4d7f45d1cf-57a363aed39mr6123020a12.22.1717416795713; Mon, 03 Jun 2024 05:13:15 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717416795; cv=pass; d=google.com; s=arc-20160816; b=jh2+4y1hSR1ejPxG4NYq+DI1NVa76l8HqJvy7V4ffSqrF4FNfRSoahgKFg/qmEgeo7 mPDrFXhpcqiSD3Rolb3D3p3v2OM+idZUN4UnR9uXrlIQIgnA8ToVcbsBFgDEfiK5u5Bw UrVspk/1JYG769lQIaYI2N9dv/7gu6G3LBqzOocA7zejGwXxJjFKqs8AafdOa8oC49+g u/ZVlEGYbUTLTxHLCjE1gHs7isIzVT5GueXUziWaNTgoqCS2LrwVhGRszTE+cfLO+BiF SdpSKCu0heiUNWfVGZDOcFrj0gtq/8YKI9jZRzahtPj7a0EkN+s3GWi+czx0Q4S89ysq kDvA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=70EliohaERBf7VAU1Ekt+wf6hOHMooOBNdpsZ2TcaMg=; fh=TgsdcG+EnP0bZGRdmPJBfZxaEjhDIWRwATd+8h9YUAE=; b=Xn9MDVXyLb4cShW8A0CwPbKG15Q88fTCPjuzLQkfbRRC3NR/HwXColUPRqx+3m/sKR FUlyJqCZv3OOQ7+sH0d6/3jMTjAsqIYh0v3PzTnNBKT+oM4u/3vJF1nozdTJH6K7pDIT 0z75hR0TzeCjWl/kXss1pn8Bwa2afUwKX5RJjgoxc6UYnljBz0zt/NIeVoafn+poIoRW 0DJzkxqXd4EeAoubx5QpLHQjh/inmpXK7lbPEkfr2Ymq5YibgjvYIE0/I2MWoxL8L3U/ CZ0beE7XyQH2itJvPp3iqILY3lM+lKA94+o5W7WA/QTwfx7phOVM76TrGogG8zu6x0lx 4nZQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-199089-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-199089-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57a31c7708esi3890390a12.422.2024.06.03.05.13.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Jun 2024 05:13:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-199089-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-199089-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-199089-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id C66901F215A8 for ; Mon, 3 Jun 2024 12:13:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D2760129A67; Mon, 3 Jun 2024 12:12:50 +0000 (UTC) Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 22D5D128820 for ; Mon, 3 Jun 2024 12:12:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.255 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717416770; cv=none; b=Srwxyj5j9t2AXrUmY95L/mamj6Vgie50EONuvSOaYifXL0eZhVyF+HGirqTr0bTDMK/OS2WnGVNRPUsf8MC1z9owxPH6waYD/lHVaZWfq6QnJ2s/OHYC2Xx+Hj7n5UOM+JrUuHHflts+0gzTtaCpy9XC71YfPg4gBQR05EVd30w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717416770; c=relaxed/simple; bh=OAIaQ6JZgKz5GOYpBFjTY8RlwKi7yq66Tt48HkB10iM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=vF4OIFVyUIC/+sy5C+Gspcg4wzkxx1FvpSEGJj8pe/nqtG8MuL0DmYR8uA3SiSbjD8Xg9dWuQZWn6gWnckLlVFu3P/nhs4U3yctn/L3zM2Tg3lPgieItKebplM0gZ9OYkrYAYFaZynYYs8FsjDORF4uJycpydC8rRwK/9yMn/bY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.255 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.88.194]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4VtCDz2xwGz1S91k; Mon, 3 Jun 2024 20:08:51 +0800 (CST) Received: from dggpeml500023.china.huawei.com (unknown [7.185.36.114]) by mail.maildlp.com (Postfix) with ESMTPS id 55926140109; Mon, 3 Jun 2024 20:12:45 +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; Mon, 3 Jun 2024 20:12:45 +0800 From: Xiu Jianfeng To: , CC: , Subject: [PATCH -next 1/3] mm/hugetlb_cgroup: identify the legacy using cgroup_subsys_on_dfl() Date: Mon, 3 Jun 2024 12:05:04 +0000 Message-ID: <20240603120506.1837322-2-xiujianfeng@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240603120506.1837322-1-xiujianfeng@huawei.com> References: <20240603120506.1837322-1-xiujianfeng@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpeml500023.china.huawei.com (7.185.36.114) 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 in the next patch. Signed-off-by: Xiu Jianfeng --- 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 */ -- 2.34.1