From: Li Zefan <lizefan@huawei.com>
To: Tejun Heo <tj@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>, Cgroups <cgroups@vger.kernel.org>
Subject: [PATCH 4/7] cgroup: rename cgroup_pidlist->mutex
Date: Wed, 31 Jul 2013 16:17:28 +0800 [thread overview]
Message-ID: <51F8C818.4080308@huawei.com> (raw)
In-Reply-To: <51F8C7C5.9040608@huawei.com>
It's a semaphore not a mutex.
Signed-off-by: Li Zefan <lizefan@huawei.com>
---
kernel/cgroup.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index f0d7f5d..0d378b1 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -3417,7 +3417,7 @@ struct cgroup_pidlist {
/* pointer to the cgroup we belong to, for list removal purposes */
struct cgroup *owner;
/* protects the other fields */
- struct rw_semaphore mutex;
+ struct rw_semaphore sem;
};
/*
@@ -3490,7 +3490,7 @@ static struct cgroup_pidlist *cgroup_pidlist_find(struct cgroup *cgrp,
struct pid_namespace *ns = task_active_pid_ns(current);
/*
- * We can't drop the pidlist_mutex before taking the l->mutex in case
+ * We can't drop the pidlist_mutex before taking the l->sem in case
* the last ref-holder is trying to remove l from the list at the same
* time. Holding the pidlist_mutex precludes somebody taking whichever
* list we find out from under us - compare release_pid_array().
@@ -3499,7 +3499,7 @@ static struct cgroup_pidlist *cgroup_pidlist_find(struct cgroup *cgrp,
list_for_each_entry(l, &cgrp->pidlists, links) {
if (l->key.type == type && l->key.ns == ns) {
/* make sure l doesn't vanish out from under us */
- down_write(&l->mutex);
+ down_write(&l->sem);
mutex_unlock(&cgrp->pidlist_mutex);
return l;
}
@@ -3510,8 +3510,8 @@ static struct cgroup_pidlist *cgroup_pidlist_find(struct cgroup *cgrp,
mutex_unlock(&cgrp->pidlist_mutex);
return l;
}
- init_rwsem(&l->mutex);
- down_write(&l->mutex);
+ init_rwsem(&l->sem);
+ down_write(&l->sem);
l->key.type = type;
l->key.ns = get_pid_ns(ns);
l->owner = cgrp;
@@ -3572,7 +3572,7 @@ static int pidlist_array_load(struct cgroup *cgrp, enum cgroup_filetype type,
l->list = array;
l->length = length;
l->use_count++;
- up_write(&l->mutex);
+ up_write(&l->sem);
*lp = l;
return 0;
}
@@ -3650,7 +3650,7 @@ static void *cgroup_pidlist_start(struct seq_file *s, loff_t *pos)
int index = 0, pid = *pos;
int *iter;
- down_read(&l->mutex);
+ down_read(&l->sem);
if (pid) {
int end = l->length;
@@ -3677,7 +3677,7 @@ static void *cgroup_pidlist_start(struct seq_file *s, loff_t *pos)
static void cgroup_pidlist_stop(struct seq_file *s, void *v)
{
struct cgroup_pidlist *l = s->private;
- up_read(&l->mutex);
+ up_read(&l->sem);
}
static void *cgroup_pidlist_next(struct seq_file *s, void *v, loff_t *pos)
@@ -3723,7 +3723,7 @@ static void cgroup_release_pid_array(struct cgroup_pidlist *l)
* pidlist_mutex, we have to take pidlist_mutex first.
*/
mutex_lock(&l->owner->pidlist_mutex);
- down_write(&l->mutex);
+ down_write(&l->sem);
BUG_ON(!l->use_count);
if (!--l->use_count) {
/* we're the last user if refcount is 0; remove and free */
@@ -3731,12 +3731,12 @@ static void cgroup_release_pid_array(struct cgroup_pidlist *l)
mutex_unlock(&l->owner->pidlist_mutex);
pidlist_free(l->list);
put_pid_ns(l->key.ns);
- up_write(&l->mutex);
+ up_write(&l->sem);
kfree(l);
return;
}
mutex_unlock(&l->owner->pidlist_mutex);
- up_write(&l->mutex);
+ up_write(&l->sem);
}
static int cgroup_pidlist_release(struct inode *inode, struct file *file)
--
1.8.0.2
next prev parent reply other threads:[~2013-07-31 8:17 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-31 8:16 [PATCH 0/7] some pending cgroup patches Li Zefan
2013-07-31 8:16 ` Li Zefan
2013-07-31 8:16 ` [PATCH 1/7] cgroup: fix a leak when percpu_ref_init() fails Li Zefan
[not found] ` <51F8C7DC.8060306-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2013-07-31 10:14 ` Tejun Heo
2013-07-31 10:14 ` Tejun Heo
2013-07-31 8:16 ` [PATCH 2/7] cgroup: remove sparse tags from offline_css() Li Zefan
[not found] ` <51F8C7E8.1080909-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2013-07-31 10:42 ` Tejun Heo
2013-07-31 10:42 ` Tejun Heo
2013-07-31 8:17 ` [PATCH 3/7] cgroup: restructure the failure path in cgroup_write_event_control() Li Zefan
[not found] ` <51F8C802.7070404-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2013-07-31 10:44 ` Tejun Heo
2013-07-31 10:44 ` Tejun Heo
[not found] ` <20130731104448.GH2810-Gd/HAXX7CRxy/B6EtB590w@public.gmane.org>
2013-08-01 1:51 ` [PATCH v2 " Li Zefan
2013-08-01 1:51 ` Li Zefan
2013-08-01 13:30 ` Tejun Heo
2013-07-31 8:17 ` Li Zefan [this message]
[not found] ` <51F8C818.4080308-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2013-07-31 11:35 ` [PATCH 4/7] cgroup: rename cgroup_pidlist->mutex Tejun Heo
2013-07-31 11:35 ` Tejun Heo
[not found] ` <20130731113518.GJ2810-Gd/HAXX7CRxy/B6EtB590w@public.gmane.org>
2013-08-01 1:52 ` [PATCH v2 " Li Zefan
2013-08-01 1:52 ` Li Zefan
[not found] ` <51F9BF4F.5030704-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2013-08-01 13:30 ` Tejun Heo
2013-08-01 13:30 ` Tejun Heo
2013-07-31 8:17 ` [PATCH 5/7] cgroup: remove struct cgroup_seqfile_state Li Zefan
2013-07-31 9:27 ` Li Zefan
[not found] ` <51F8D88B.2040400-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2013-07-31 11:35 ` Tejun Heo
2013-07-31 11:35 ` Tejun Heo
[not found] ` <20130731113557.GK2810-Gd/HAXX7CRxy/B6EtB590w@public.gmane.org>
2013-08-01 1:11 ` Li Zefan
2013-08-01 1:11 ` Li Zefan
2013-07-31 8:18 ` [PATCH 6/7] cgroup: rename current_css_set_cg_links Li Zefan
[not found] ` <51F8C83F.6010407-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2013-07-31 11:38 ` Tejun Heo
2013-07-31 11:38 ` Tejun Heo
[not found] ` <20130731113857.GM2810-Gd/HAXX7CRxy/B6EtB590w@public.gmane.org>
2013-08-01 1:11 ` Li Zefan
2013-08-01 1:11 ` Li Zefan
2013-07-31 8:18 ` [PATCH 7/7] cgroup: more naming cleanups Li Zefan
2013-07-31 11:39 ` 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=51F8C818.4080308@huawei.com \
--to=lizefan@huawei.com \
--cc=cgroups@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tj@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.