public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: lizefan@huawei.com
Cc: cgroups@vger.kernel.org, linux-kernel@vger.kernel.org,
	vgoyal@redhat.com, axboe@kernel.dk, hannes@cmpxchg.org,
	mhocko@suse.cz, arozansk@redhat.com, Tejun Heo <tj@kernel.org>
Subject: [PATCH 5/5] cgroup: remove cgroup->control_kn
Date: Tue,  6 May 2014 08:44:26 -0400	[thread overview]
Message-ID: <1399380266-3324-6-git-send-email-tj@kernel.org> (raw)
In-Reply-To: <1399380266-3324-1-git-send-email-tj@kernel.org>

Now that cgroup_subtree_control_write() has access to the associated
kernfs_open_file and thus the kernfs_node, there's no need to cache it
in cgroup->control_kn on creation.  Remove cgroup->control_kn and use
@of->kn directly.

Signed-off-by: Tejun Heo <tj@kernel.org>
---
 include/linux/cgroup.h | 1 -
 kernel/cgroup.c        | 8 +++-----
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index f8cfadb..037fa80 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -179,7 +179,6 @@ struct cgroup {
 
 	struct cgroup *parent;		/* my parent */
 	struct kernfs_node *kn;		/* cgroup kernfs entry */
-	struct kernfs_node *control_kn;	/* kn for "cgroup.subtree_control" */
 	struct kernfs_node *populated_kn; /* kn for "cgroup.subtree_populated" */
 
 	/*
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 06ad484..eeb4b62 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -2578,7 +2578,7 @@ static ssize_t cgroup_subtree_control_write(struct kernfs_open_file *of,
 	 * active_ref protection.
 	 */
 	cgroup_get(cgrp);
-	kernfs_break_active_protection(cgrp->control_kn);
+	kernfs_break_active_protection(of->kn);
 
 	mutex_lock(&cgroup_tree_mutex);
 
@@ -2695,7 +2695,7 @@ out_unlock:
 out_unlock_tree:
 	mutex_unlock(&cgroup_tree_mutex);
 out_unbreak:
-	kernfs_unbreak_active_protection(cgrp->control_kn);
+	kernfs_unbreak_active_protection(of->kn);
 	cgroup_put(cgrp);
 	return ret ?: nbytes;
 
@@ -2885,9 +2885,7 @@ static int cgroup_add_file(struct cgroup *cgrp, struct cftype *cft)
 		return ret;
 	}
 
-	if (cft->seq_show == cgroup_subtree_control_show)
-		cgrp->control_kn = kn;
-	else if (cft->seq_show == cgroup_populated_show)
+	if (cft->seq_show == cgroup_populated_show)
 		cgrp->populated_kn = kn;
 	return 0;
 }
-- 
1.9.0


  parent reply	other threads:[~2014-05-06 12:44 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-06 12:44 [PATCHSET cgroup/for-3.16] cgroup: implement cftype->write() Tejun Heo
2014-05-06 12:44 ` [PATCH 1/5] " Tejun Heo
2014-05-06 12:44 ` [PATCH 2/5] cgroup: replace cftype->write_string() with cftype->write() Tejun Heo
2014-05-06 12:54   ` Aristeu Rozanski
2014-05-06 14:07   ` [PATCH v2 " Tejun Heo
2014-05-08 19:35   ` [PATCH " Vivek Goyal
2014-05-06 12:44 ` [PATCH 3/5] cgroup: replace cftype->trigger() " Tejun Heo
2014-05-06 12:44 ` [PATCH 4/5] cgroup: convert "tasks" and "cgroup.procs" handle to use cftype->write() Tejun Heo
2014-05-06 12:44 ` Tejun Heo [this message]
2014-05-09 19:50 ` [PATCHSET cgroup/for-3.16] cgroup: implement cftype->write() Tejun Heo
2014-05-13  6:34 ` Li Zefan
2014-05-13 16:17 ` 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=1399380266-3324-6-git-send-email-tj@kernel.org \
    --to=tj@kernel.org \
    --cc=arozansk@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=cgroups@vger.kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizefan@huawei.com \
    --cc=mhocko@suse.cz \
    --cc=vgoyal@redhat.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