Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932248AbbHWWrf (ORCPT ); Sun, 23 Aug 2015 18:47:35 -0400 Received: from mga02.intel.com ([134.134.136.20]:3299 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932107AbbHWWq3 (ORCPT ); Sun, 23 Aug 2015 18:46:29 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,734,1432623600"; d="scan'208";a="789528139" From: Vikas Shivappa 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 Message-Id: <1440370002-30618-3-git-send-email-vikas.shivappa@linux.intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1440370002-30618-1-git-send-email-vikas.shivappa@linux.intel.com> References: <1440370002-30618-1-git-send-email-vikas.shivappa@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2312 Lines: 70 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 --- 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/