Received: by 2002:ab2:6c55:0:b0:1fd:c486:4f03 with SMTP id v21csp322645lqp; Wed, 12 Jun 2024 02:40:25 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWTgyRa1tksKzRLJ7HxBRkjLUe3BGsWOsLqsv4+5fSHP9nb7CafCWu1U4nNo5DhRgFFBACYLz/W1ig1wMZmZrtFdYkKYgVFuZ3iT4m+VA== X-Google-Smtp-Source: AGHT+IEJwsEHzhnPZfYf7WeLz3/XY3ECriPsY40RlPOBkESTN4fSTY1O+gGi+90L5OP2G9xy2fUq X-Received: by 2002:a17:906:7b84:b0:a6f:12:8c45 with SMTP id a640c23a62f3a-a6f48029fd3mr74809866b.72.1718185225026; Wed, 12 Jun 2024 02:40:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718185225; cv=pass; d=google.com; s=arc-20160816; b=0jOWij3ia1m+P5tQJZ0/X+fAsZiWVqrDtABw0NabSjVj0Wa5ouTPOHHPOJDFWBTC3S 14m0kN1nCahQhy8KPTfoSzGkGbj8FL/NQ5xSF0obseGwsepEisjT8nqMgentdozBQXcu iZ/ZudSKdr0QtsURxKFKmExAt8S63yme2DGQaIFLPHRWRQpSxhSupHUrEfWzka5Jk8ZB jvrlC+fxRdLZUTAEJF16IFwJ8xveBa2LhFtMWt4NGJl3BE3Z4Sjqg0YjkGTKpmaPvkV1 KdIein9fhfRcOE8iYOmo9nclMz6P1JMCswGS/k/M9YhUlWHSYyBKEuLCbw5lCh5yYfXA Yn6g== 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=+HvMAvryFgbVgtRXqNMEocR+Z+cyn1cMRoVrw6+UdJ0=; fh=p0KhMC7oyorkAvkQCuxq2LojmtRIybW5sGTlQYoXBNw=; b=RzJeGnyr19R605ylJzwOZARLd4AwJQY8yFMmmL4Dq8uyHIoaJiR9Qv9gZCAr2t4Qdg c8OjircCk8ubBKi6CL4AbZ/qNIqn5CYwdkMElZpre7FwXiFgQny8Snr+bN8U2B5LMlER X0Kjk9lfFBkLrD2vKCSWeZwYpy8DV25py9is9Nrs/KFUYFbE7SQ5zOMbVmK/IcbkvXIH foDo5l3C5VC5/5PUDTjdZxMdazD3+m0AzamaN2opFEN2KosMy9PSeqmehaskABguVL6n +nsMxxm/V3kje9JmLxmKlSwblhzeSxolAgjNezi2vPB8mcecKHRraTVh4OPdYx+JFFxJ Uu3Q==; 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-211272-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-211272-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. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a6f1236c77bsi358671766b.765.2024.06.12.02.40.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 02:40:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-211272-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; 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-211272-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-211272-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 18E491F29594 for ; Wed, 12 Jun 2024 09:32:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D31D216DEDD; Wed, 12 Jun 2024 09:32:00 +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 0A49E16DEB2 for ; Wed, 12 Jun 2024 09:31:57 +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=1718184720; cv=none; b=LTE5JCVgYiZ2QiEdpbK9Z0oPM+GzI25x2lB4FNnkn7ivI1ZokuKE6BXqa2Tcw8q8vBXokW6JhEG7HSdARnFasoD1dUmN6HmANhQmKKCA1MXkIJtT2minuPkhaP33vEuY5VxdOL3P7YyeBhHT4iVs2Ep7Y7RerzT0W6OqaTzaZeQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718184720; c=relaxed/simple; bh=ZAPxRrFmaBDIhGEUxMT6pFYhM/l0wMgDXgx/LRaDH2Q=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=jV2wj9Rh6LXJCNXZXFEBeWqBJ1JZ5ftqYbMXkaixycLYPNJFIzumARx30kd1Cb7uewIOYjyH76RuPzvDN6yJ99EIn4JkbuN1QptaEtWw32iT6txyldkyyjEa8UmqanABZbnjIcx+FIQlwKBlzwXxrH9Ek1cXYHsNqufqK7/ufww= 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.163.48]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4VzgF13h0Hz1JCj6; Wed, 12 Jun 2024 17:27:49 +0800 (CST) Received: from dggpeml500023.china.huawei.com (unknown [7.185.36.114]) by mail.maildlp.com (Postfix) with ESMTPS id 217F318007C; Wed, 12 Jun 2024 17:31:55 +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, 12 Jun 2024 17:31:54 +0800 From: Xiu Jianfeng To: , CC: , , Subject: [PATCH v3 -next 1/3] mm/hugetlb_cgroup: identify the legacy using cgroup_subsys_on_dfl() Date: Wed, 12 Jun 2024 09:24:07 +0000 Message-ID: <20240612092409.2027592-2-xiujianfeng@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240612092409.2027592-1-xiujianfeng@huawei.com> References: <20240612092409.2027592-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 templates in the next patch. Reviewed-by: Oscar Salvador 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