Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1211686

[PATCH 2/6] cgroup: Add css_mount and css_umount

From Vikas Shivappa <vikas.shivappa@linux.intel.com>
Newsgroups linux.kernel
Subject [PATCH 2/6] cgroup: Add css_mount and css_umount
Date 2015-08-24 00:50 +0200
Message-ID <q0Mfo-62H-17@gated-at.bofh.it> (permalink)
References <q0Mfn-62H-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Add subsystem APIs css_mount and css_umount which will be called during
cgroup_mount and umount respectively. This will let the subsystem
perform any specific setup during mount/umount.
This will be used in code data prioritization code later.

Signed-off-by: Vikas Shivappa <vikas.shivappa@linux.intel.com>
---
 include/linux/cgroup.h |  2 ++
 kernel/cgroup.c        | 12 ++++++++++++
 2 files changed, 14 insertions(+)

diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index 292ed97..3ded186 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -655,6 +655,8 @@ struct cgroup_subsys {
 		     struct cgroup_subsys_state *old_css,
 		     struct task_struct *task);
 	void (*bind)(struct cgroup_subsys_state *root_css);
+	void (*css_mount)(void *mount_info);
+	void (*css_umount)(void);
 
 	int disabled;
 	int early_init;
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 668f614..e139504 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -1345,6 +1345,7 @@ struct cgroup_sb_opts {
 	char *name;
 	/* User explicitly requested empty subsystem */
 	bool none;
+	void *mount_info;
 };
 
 static int parse_cgroupfs_options(char *data, struct cgroup_sb_opts *opts)
@@ -1787,6 +1788,11 @@ static struct dentry *cgroup_mount(struct file_system_type *fs_type,
 	if (ret)
 		goto out_unlock;
 
+	for_each_subsys(ss, i) {
+		if ((opts.subsys_mask && (1U << i)) && ss->css_mount)
+			ss->css_mount(opts.mount_info);
+	}
+
 	/* look for a matching existing root */
 	if (opts.flags & CGRP_ROOT_SANE_BEHAVIOR) {
 		cgrp_dfl_root_visible = true;
@@ -1928,7 +1934,13 @@ static void cgroup_kill_sb(struct super_block *sb)
 {
 	struct kernfs_root *kf_root = kernfs_root_from_sb(sb);
 	struct cgroup_root *root = cgroup_root_from_kf(kf_root);
+	struct cgroup_subsys *ss;
+	int i;
 
+	for_each_subsys(ss, i) {
+		if ((root->subsys_mask && (1U << i)) && ss->css_umount)
+			ss->css_umount();
+	}
 	/*
 	 * If @root doesn't have any mounts or children, start killing it.
 	 * This prevents new mounts by disabling percpu_ref_tryget_live().
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH V1 0/6] cgroup,x86/intel_rdt : *pre h/w* Intel code data prioritization support and cgroup changes Vikas Shivappa <vikas.shivappa@linux.intel.com> - 2015-08-24 00:50 +0200
  [PATCH 1/6] cgroup: Adds cgroup_destroy_children Vikas Shivappa <vikas.shivappa@linux.intel.com> - 2015-08-24 00:50 +0200
  [PATCH 5/6] x86/intel_rdt: Class of service management for code data prioritization Vikas Shivappa <vikas.shivappa@linux.intel.com> - 2015-08-24 00:50 +0200
  [PATCH 6/6] x86/intel_rdt: Support dcache and icache mask for Code data prioritization Vikas Shivappa <vikas.shivappa@linux.intel.com> - 2015-08-24 00:50 +0200
  [PATCH 2/6] cgroup: Add css_mount and css_umount Vikas Shivappa <vikas.shivappa@linux.intel.com> - 2015-08-24 00:50 +0200

csiph-web