From: Tejun Heo <tj@kernel.org>
To: lizefan@huawei.com
Cc: cgroups@vger.kernel.org, linux-kernel@vger.kernel.org,
Tejun Heo <tj@kernel.org>
Subject: [PATCH 5/5] cgroup: make CFTYPE_ONLY_ON_DFL and CFTYPE_NO_ internal to cgroup core
Date: Wed, 2 Jul 2014 19:50:55 -0400 [thread overview]
Message-ID: <1404345055-8196-6-git-send-email-tj@kernel.org> (raw)
In-Reply-To: <1404345055-8196-1-git-send-email-tj@kernel.org>
cgroup now distinguishes cftypes for the default and legacy
hierarchies more explicitly by using separate arrays and
CFTYPE_ONLY_ON_DFL and CFTYPE_INSANE should be and are used only
inside cgroup core proper. Let's make it clear that the flags are
internal by prefixing them with double underscores.
CFTYPE_INSANE is renamed to __CFTYPE_NOT_ON_DFL for consistency. The
two flags are also collected and assigned bits >= 16 so that they
aren't mixed with the published flags.
Signed-off-by: Tejun Heo <tj@kernel.org>
---
include/linux/cgroup.h | 6 ++++--
kernel/cgroup.c | 8 ++++----
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index 62a2be1..c047887c 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -376,9 +376,11 @@ struct css_set {
enum {
CFTYPE_ONLY_ON_ROOT = (1 << 0), /* only create on root cgrp */
CFTYPE_NOT_ON_ROOT = (1 << 1), /* don't create on root cgrp */
- CFTYPE_INSANE = (1 << 2), /* don't create if sane_behavior */
CFTYPE_NO_PREFIX = (1 << 3), /* (DON'T USE FOR NEW FILES) no subsys prefix */
- CFTYPE_ONLY_ON_DFL = (1 << 4), /* only on default hierarchy */
+
+ /* internal flags, do not use outside cgroup core proper */
+ __CFTYPE_ONLY_ON_DFL = (1 << 16), /* only on default hierarchy */
+ __CFTYPE_NOT_ON_DFL = (1 << 17), /* not on default hierarchy */
};
#define MAX_CFTYPE_NAME 64
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 94cdb7b..028ebf1 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -2921,9 +2921,9 @@ static int cgroup_addrm_files(struct cgroup *cgrp, struct cftype cfts[],
for (cft = cfts; cft->name[0] != '\0'; cft++) {
/* does cft->flags tell us to skip this file on @cgrp? */
- if ((cft->flags & CFTYPE_ONLY_ON_DFL) && !cgroup_on_dfl(cgrp))
+ if ((cft->flags & __CFTYPE_ONLY_ON_DFL) && !cgroup_on_dfl(cgrp))
continue;
- if ((cft->flags & CFTYPE_INSANE) && cgroup_on_dfl(cgrp))
+ if ((cft->flags & __CFTYPE_NOT_ON_DFL) && cgroup_on_dfl(cgrp))
continue;
if ((cft->flags & CFTYPE_NOT_ON_ROOT) && !cgroup_parent(cgrp))
continue;
@@ -3104,7 +3104,7 @@ int cgroup_add_dfl_cftypes(struct cgroup_subsys *ss, struct cftype *cfts)
struct cftype *cft;
for (cft = cfts; cft && cft->name[0] != '\0'; cft++)
- cft->flags |= CFTYPE_ONLY_ON_DFL;
+ cft->flags |= __CFTYPE_ONLY_ON_DFL;
return cgroup_add_cftypes(ss, cfts);
}
@@ -3121,7 +3121,7 @@ int cgroup_add_legacy_cftypes(struct cgroup_subsys *ss, struct cftype *cfts)
struct cftype *cft;
for (cft = cfts; cft && cft->name[0] != '\0'; cft++)
- cft->flags |= CFTYPE_INSANE;
+ cft->flags |= __CFTYPE_NOT_ON_DFL;
return cgroup_add_cftypes(ss, cfts);
}
--
1.9.3
next prev parent reply other threads:[~2014-07-02 23:51 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-02 23:50 [PATCHSET cgroup/for-3.17] cgroup: distinguish the default and legacy hierarchies when handling cftypes Tejun Heo
2014-07-02 23:50 ` [PATCH 1/5] cgroup: split cgroup_base_files[] into cgroup_{dfl|legacy}_base_files[] Tejun Heo
2014-07-04 17:11 ` [PATCH v2 " Tejun Heo
2014-07-02 23:50 ` [PATCH 2/5] cgroup: rename cgroup_subsys->base_cftypes to ->legacy_cftypes Tejun Heo
2014-07-03 11:02 ` Neil Horman
2014-07-02 23:50 ` [PATCH 3/5] cgroup: replace cgroup_add_cftypes() with cgroup_add_legacy_cftypes() Tejun Heo
2014-07-03 11:08 ` Neil Horman
2014-07-02 23:50 ` [PATCH 4/5] cgroup: distinguish the default and legacy hierarchies when handling cftypes Tejun Heo
2014-07-03 11:14 ` Neil Horman
2014-07-03 15:20 ` [PATCH v2 " Tejun Heo
2014-07-14 2:13 ` [PATCH " Li Zefan
2014-07-14 14:42 ` Tejun Heo
2014-07-02 23:50 ` Tejun Heo [this message]
2014-07-03 15:21 ` [PATCH 6/5] cgroup: initialize cgrp_dfl_root_inhibit_ss_mask from !->dfl_files test Tejun Heo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1404345055-8196-6-git-send-email-tj@kernel.org \
--to=tj@kernel.org \
--cc=cgroups@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lizefan@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox