Received: by 2002:ab2:6d45:0:b0:1fb:d597:ff75 with SMTP id d5csp117011lqr; Wed, 5 Jun 2024 00:09:33 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU8EXR6nrA2O4d4Q2TyPgQ+3PadtWdCP+vF+qlROfLUgERXexh0pcFfhRhGQUFiKDrQNekGOFBgm8HOLCXpTgKV20UTFzb6VI+w5TffxQ== X-Google-Smtp-Source: AGHT+IFtjQRrXm/hiPVLetO249BOPbcqtHWTPJw5O8uUPzN7BWospXv6tyDW8EIwC0NEkwwA+vtq X-Received: by 2002:a50:aa93:0:b0:572:6af5:1b61 with SMTP id 4fb4d7f45d1cf-57a8b696eadmr1516077a12.6.1717571373037; Wed, 05 Jun 2024 00:09:33 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717571373; cv=pass; d=google.com; s=arc-20160816; b=RU9JMwQNgMNTPQPthT67hza5ZmxArte1UcvWlJAp3XnOa7o25Uh9wr6Z2ZbQHI2u3b B1CGkZm61fuxTYAIxx1GCfobguJkYnT9qeUqfj0M6Yezs0TbkWaNPQL/Ps4oIrKSorAw gJZoMIv7ACctySlAxOQ1eHtSFXLvoYfb+iGmAK3xK5++uiMznDislzg4QwMk/zpHtMb8 gM2TP96cjzskp3T84BG9Dl5JBRfeNtGIqjJwKQbYYpYheZSVETpZh7/+wAaX7+FoHNny RbS6TobGJ5gago5FozfJGjCu1WwgQyjDtD54wk7Gy/xcc7TeX1aMLbZ2631T0Lnn/n2G LUhw== 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=ZLm+g6YurgVM/SWhQxLU91h2Iant6voNfOH9F7zZvJc=; fh=TgsdcG+EnP0bZGRdmPJBfZxaEjhDIWRwATd+8h9YUAE=; b=V1dYPg6ntPP0eNGjnz4KHZV8Bg0i8/oTCPWv9e2B8fbX2HXV+IKZgE2AZQKFlfKa2h gZSYKghM5MZP7zLXxIQFTua+DFuWYDK2VjI8jHYz/rfD3Wn7sXaQRR3JQvrfaoWFgT0B ZBp0oMQLC+sAVFAWvXtKZ7TbOcsUFrC6vEwI1nhKePa8taVNLEWJPhXARCB+ROq+Gfsq oA4de4958OypbCOIELo/eiiIOeMKOgK8k4iewU1+azWyJSmvMlIl24/ibutKNcXqJ7av RPhl/qEN6LqYWIN/hRCy7mVV+mucJ1KIVmgzh9eIWTadE8SmwYjAEOB8NrSzliR9mOCl 4wbg==; 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-201841-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-201841-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 a640c23a62f3a-a6900fd99b8si310913266b.586.2024.06.05.00.09.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 00:09:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-201841-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-201841-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-201841-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 BD15E1F22497 for ; Wed, 5 Jun 2024 07:09:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 378A018C34E; Wed, 5 Jun 2024 07:09:14 +0000 (UTC) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) (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 81E8F13F425 for ; Wed, 5 Jun 2024 07:09:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.187 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717571353; cv=none; b=GDSjmKuND8DSxqCZC+b+orwzbDC/glpFXAvCZpbMnbsVZ+g1usu2VYqOvv1OVsEKfWlSo4zsQRdDF/2bghkZMz8CUa4iv/y5isu/kddcJjrN/2Qec2PrCdn3sqmVr2vBuOZkP1EuxMghyHJb3JzX9beddECBu0IKLh2ebSG7wm0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717571353; c=relaxed/simple; bh=RcSP/PTJzghgdyoK7y380o6hLqTOV6nM1LIc25cUKuo=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=TmrekWN1DgLraX8lbtZrFaPaQ64YQPQQhZoSm2aAaJ1x3N2EmBIyED6FX8BJYtYSYXHEPc82lhgkEJK+ygqnHcY6Msa98qaWnFGBdN+vrrzudmwufSAL4ofY4GDdDYJXJO2ikSPc++MSbO56F7Lfw7kFFtcoPN3eGJPVXHZhKG8= 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.187 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.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> 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 of the comming 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