From patchwork Sun Oct 13 00:30:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mina Almasry X-Patchwork-Id: 11187171 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4632F112B for ; Sun, 13 Oct 2019 00:30:39 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 1226C20679 for ; Sun, 13 Oct 2019 00:30:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="hJsydjot" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1226C20679 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 7DDAA8E0006; Sat, 12 Oct 2019 20:30:36 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 766C28E0005; Sat, 12 Oct 2019 20:30:36 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5E0978E0006; Sat, 12 Oct 2019 20:30:36 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0159.hostedemail.com [216.40.44.159]) by kanga.kvack.org (Postfix) with ESMTP id 3A06D8E0005 for ; Sat, 12 Oct 2019 20:30:36 -0400 (EDT) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with SMTP id C5911611B for ; Sun, 13 Oct 2019 00:30:35 +0000 (UTC) X-FDA: 76036880430.04.spoon84_5c77fb500fd1e X-Spam-Summary: 2,0,0,b89e87752568ccf1,d41d8cd98f00b204,3kncixqskciclwxl329xtylrzzrwp.nzxwty58-xxv6lnv.z2r@flex--almasrymina.bounces.google.com,:mike.kravetz@oracle.com:shuah@kernel.org:almasrymina@google.com:rientjes@google.com:shakeelb@google.com:gthelen@google.com:akpm@linux-foundation.org:khalid.aziz@oracle.com:linux-kernel@vger.kernel.org::linux-kselftest@vger.kernel.org:cgroups@vger.kernel.org:aneesh.kumar@linux.vnet.ibm.com:mkoutny@suse.com,RULES_HIT:41:152:355:379:541:966:988:989:1260:1277:1313:1314:1345:1359:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2196:2199:2393:2559:2562:3138:3139:3140:3141:3142:3152:3352:3876:3877:4321:4385:4605:5007:6114:6119:6261:6642:6653:6742:9969:10004:10400:11026:11232:11473:11658:11914:12043:12296:12297:12438:12555:12895:12986:13069:13311:13357:14394:14659:14721:21080:21444:21627:30054,0,RBL:209.85.210.202:@flex--almasrymina.bounces.google.com:.lbl8.mailshell.net-62.18.0.100 66.100.201.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Net check:no X-HE-Tag: spoon84_5c77fb500fd1e X-Filterd-Recvd-Size: 4111 Received: from mail-pf1-f202.google.com (mail-pf1-f202.google.com [209.85.210.202]) by imf27.hostedemail.com (Postfix) with ESMTP for ; Sun, 13 Oct 2019 00:30:35 +0000 (UTC) Received: by mail-pf1-f202.google.com with SMTP id b204so10650055pfb.11 for ; Sat, 12 Oct 2019 17:30:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=bBrSpk5/lkb8AYsfeF62BNq9VWemrH+WCBAgVGWPGII=; b=hJsydjotiPKAHadLUhsMYb1DIvUHI/kTS4eMu9je11cjpNhoSeutvUQtrx/wKtlpnw KQ9qbPdjYSO8qTEwOaAYp1y+a9mT3vEPpNW/symkNk0FLP6a2K4IcbLuP/QgYmh8BbEr sJoWnep9Jx+LO8ugGxfDMv/HuEqGs785Fuc5e9crs1hhJPomjPhsIe2Dazo2zleIiBvT jUP+k489gBqIWZi1aR8iLR4OBNa0WGPAAWPJkMr7llHnVGZNphvewvTDllm3rB0rsRWp YLAq6vZwAdjwh8zxFMfiIL6O1Sh/wIOpnsMNoOHXEePop0Tqm3EoHuhpP+n1rH1sHCGk IwDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=bBrSpk5/lkb8AYsfeF62BNq9VWemrH+WCBAgVGWPGII=; b=PgPs6EexDn5cKG59NUUjdzHyU+i9pjFxcgkwuICGIzsA1KvtntUFuPCJcY0QI0Z8LZ N8wKA41iz+pbCfgQMzFMVk0+Oy9XGU/GYHBHauhRAylP8J8/JC8awPHlY7AOTAiW51Po ZWH9edy2lWJKrpYliz7hIRTtHFFqDIKVXU2OufYJQNGkUvwPg3uufxoZxbNemih9yEe1 f0CNdPV7eaX2KLMbNTnemT5bgoZY9zYiKEYOSvCggVbHODxtZmIBjDqzayXTp/NOoLBh ZamHsCQ23jIamYyBZ9w0E0yFpewDFV4huMB/jyvelg+ru56pRf6nl5UI6NdPyQIV790U b2vQ== X-Gm-Message-State: APjAAAW7/lNiecVInsLXd30rP92+SJm6TpmVlGitWyS1Nr3L1az4byh+ be/8j2IwMoT9WSzQd7E2lvMZJE2v/BvT3ZDojw== X-Google-Smtp-Source: APXvYqyIcSJcfujhRC7eYCwvl3F0kP+Cp+S3qVcoEFG/cktxKwguPX459Efupz3ruaGszXcEJTI3C/3AIufOhsvM5g== X-Received: by 2002:a63:f247:: with SMTP id d7mr23278319pgk.300.1570926634315; Sat, 12 Oct 2019 17:30:34 -0700 (PDT) Date: Sat, 12 Oct 2019 17:30:18 -0700 In-Reply-To: <20191013003024.215429-1-almasrymina@google.com> Message-Id: <20191013003024.215429-3-almasrymina@google.com> Mime-Version: 1.0 References: <20191013003024.215429-1-almasrymina@google.com> X-Mailer: git-send-email 2.23.0.700.g56cf767bdb-goog Subject: [PATCH v6 3/9] hugetlb_cgroup: add cgroup-v2 support From: Mina Almasry To: mike.kravetz@oracle.com Cc: shuah@kernel.org, almasrymina@google.com, rientjes@google.com, shakeelb@google.com, gthelen@google.com, akpm@linux-foundation.org, khalid.aziz@oracle.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, cgroups@vger.kernel.org, aneesh.kumar@linux.vnet.ibm.com, mkoutny@suse.com 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: --- mm/hugetlb_cgroup.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) --- 2.23.0.700.g56cf767bdb-goog diff --git a/mm/hugetlb_cgroup.c b/mm/hugetlb_cgroup.c index 854117513979b..ac1500205faf7 100644 --- a/mm/hugetlb_cgroup.c +++ b/mm/hugetlb_cgroup.c @@ -503,8 +503,13 @@ static void __init __hugetlb_cgroup_file_init(int idx) cft = &h->cgroup_files[HUGETLB_RES_NULL]; memset(cft, 0, sizeof(*cft)); - WARN_ON(cgroup_add_legacy_cftypes(&hugetlb_cgrp_subsys, - h->cgroup_files)); + if (cgroup_subsys_on_dfl(hugetlb_cgrp_subsys)) { + WARN_ON(cgroup_add_dfl_cftypes(&hugetlb_cgrp_subsys, + h->cgroup_files)); + } else { + WARN_ON(cgroup_add_legacy_cftypes(&hugetlb_cgrp_subsys, + h->cgroup_files)); + } } void __init hugetlb_cgroup_file_init(void) @@ -548,8 +553,14 @@ void hugetlb_cgroup_migrate(struct page *oldhpage, struct page *newhpage) return; } +static struct cftype hugetlb_files[] = { + {} /* terminate */ +}; + struct cgroup_subsys hugetlb_cgrp_subsys = { .css_alloc = hugetlb_cgroup_css_alloc, .css_offline = hugetlb_cgroup_css_offline, .css_free = hugetlb_cgroup_css_free, + .dfl_cftypes = hugetlb_files, + .legacy_cftypes = hugetlb_files, };