public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Vikas Shivappa <vikas.shivappa@linux.intel.com>
To: vikas.shivappa@intel.com
Cc: vikas.shivappa@linux.intel.com, x86@kernel.org,
	linux-kernel@vger.kernel.org, hpa@zytor.com, tglx@linutronix.de,
	mingo@kernel.org, peterz@infradead.org, tj@kernel.org,
	matt.fleming@intel.com, will.auld@intel.com,
	kanaka.d.juvva@intel.com, glenn.p.williamson@intel.com,
	mtosatti@redhat.com
Subject: [PATCH 2/6] cgroup: Add css_mount and css_umount
Date: Sun, 23 Aug 2015 15:46:38 -0700	[thread overview]
Message-ID: <1440370002-30618-3-git-send-email-vikas.shivappa@linux.intel.com> (raw)
In-Reply-To: <1440370002-30618-1-git-send-email-vikas.shivappa@linux.intel.com>

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


  parent reply	other threads:[~2015-08-23 22:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-23 22:46 [PATCH V1 0/6] cgroup,x86/intel_rdt : *pre h/w* Intel code data prioritization support and cgroup changes Vikas Shivappa
2015-08-23 22:46 ` [PATCH 1/6] cgroup: Adds cgroup_destroy_children Vikas Shivappa
2015-08-23 22:46 ` Vikas Shivappa [this message]
2015-08-23 22:46 ` [PATCH 3/6] x86/intel_rdt: Intel Code Data Prioritization detection Vikas Shivappa
2015-08-23 22:46 ` [PATCH 4/6] x86/intel_rdt: Adds support to enable CDP Vikas Shivappa
2015-08-23 22:46 ` [PATCH 5/6] x86/intel_rdt: Class of service management for code data prioritization Vikas Shivappa
2015-08-23 22:46 ` [PATCH 6/6] x86/intel_rdt: Support dcache and icache mask for Code " Vikas Shivappa

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=1440370002-30618-3-git-send-email-vikas.shivappa@linux.intel.com \
    --to=vikas.shivappa@linux.intel.com \
    --cc=glenn.p.williamson@intel.com \
    --cc=hpa@zytor.com \
    --cc=kanaka.d.juvva@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matt.fleming@intel.com \
    --cc=mingo@kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=tj@kernel.org \
    --cc=vikas.shivappa@intel.com \
    --cc=will.auld@intel.com \
    --cc=x86@kernel.org \
    /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