diff options
author | Li Zefan <lizefan@huawei.com> | 2013-07-31 21:52:15 -0400 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2013-08-01 09:29:41 -0400 |
commit | b395890a092d8ecbe54f005179e3dec4b6bf752a (patch) | |
tree | 4f92e381874aa68bdb098277e33ef9bd444c3e7a | |
parent | 876ede8b2b9880615be0de3ec7b8afd0a1786e76 (diff) |
cgroup: rename cgroup_pidlist->mutex
It's a rw_semaphore not a mutex.
Signed-off-by: Li Zefan <lizefan@huawei.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
-rw-r--r-- | kernel/cgroup.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/kernel/cgroup.c b/kernel/cgroup.c index 9f6dab22289e..9420662df87e 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c | |||
@@ -3436,7 +3436,7 @@ struct cgroup_pidlist { | |||
3436 | /* pointer to the cgroup we belong to, for list removal purposes */ | 3436 | /* pointer to the cgroup we belong to, for list removal purposes */ |
3437 | struct cgroup *owner; | 3437 | struct cgroup *owner; |
3438 | /* protects the other fields */ | 3438 | /* protects the other fields */ |
3439 | struct rw_semaphore mutex; | 3439 | struct rw_semaphore rwsem; |
3440 | }; | 3440 | }; |
3441 | 3441 | ||
3442 | /* | 3442 | /* |
@@ -3509,7 +3509,7 @@ static struct cgroup_pidlist *cgroup_pidlist_find(struct cgroup *cgrp, | |||
3509 | struct pid_namespace *ns = task_active_pid_ns(current); | 3509 | struct pid_namespace *ns = task_active_pid_ns(current); |
3510 | 3510 | ||
3511 | /* | 3511 | /* |
3512 | * We can't drop the pidlist_mutex before taking the l->mutex in case | 3512 | * We can't drop the pidlist_mutex before taking the l->rwsem in case |
3513 | * the last ref-holder is trying to remove l from the list at the same | 3513 | * the last ref-holder is trying to remove l from the list at the same |
3514 | * time. Holding the pidlist_mutex precludes somebody taking whichever | 3514 | * time. Holding the pidlist_mutex precludes somebody taking whichever |
3515 | * list we find out from under us - compare release_pid_array(). | 3515 | * list we find out from under us - compare release_pid_array(). |
@@ -3518,7 +3518,7 @@ static struct cgroup_pidlist *cgroup_pidlist_find(struct cgroup *cgrp, | |||
3518 | list_for_each_entry(l, &cgrp->pidlists, links) { | 3518 | list_for_each_entry(l, &cgrp->pidlists, links) { |
3519 | if (l->key.type == type && l->key.ns == ns) { | 3519 | if (l->key.type == type && l->key.ns == ns) { |
3520 | /* make sure l doesn't vanish out from under us */ | 3520 | /* make sure l doesn't vanish out from under us */ |
3521 | down_write(&l->mutex); | 3521 | down_write(&l->rwsem); |
3522 | mutex_unlock(&cgrp->pidlist_mutex); | 3522 | mutex_unlock(&cgrp->pidlist_mutex); |
3523 | return l; | 3523 | return l; |
3524 | } | 3524 | } |
@@ -3529,8 +3529,8 @@ static struct cgroup_pidlist *cgroup_pidlist_find(struct cgroup *cgrp, | |||
3529 | mutex_unlock(&cgrp->pidlist_mutex); | 3529 | mutex_unlock(&cgrp->pidlist_mutex); |
3530 | return l; | 3530 | return l; |
3531 | } | 3531 | } |
3532 | init_rwsem(&l->mutex); | 3532 | init_rwsem(&l->rwsem); |
3533 | down_write(&l->mutex); | 3533 | down_write(&l->rwsem); |
3534 | l->key.type = type; | 3534 | l->key.type = type; |
3535 | l->key.ns = get_pid_ns(ns); | 3535 | l->key.ns = get_pid_ns(ns); |
3536 | l->owner = cgrp; | 3536 | l->owner = cgrp; |
@@ -3591,7 +3591,7 @@ static int pidlist_array_load(struct cgroup *cgrp, enum cgroup_filetype type, | |||
3591 | l->list = array; | 3591 | l->list = array; |
3592 | l->length = length; | 3592 | l->length = length; |
3593 | l->use_count++; | 3593 | l->use_count++; |
3594 | up_write(&l->mutex); | 3594 | up_write(&l->rwsem); |
3595 | *lp = l; | 3595 | *lp = l; |
3596 | return 0; | 3596 | return 0; |
3597 | } | 3597 | } |
@@ -3669,7 +3669,7 @@ static void *cgroup_pidlist_start(struct seq_file *s, loff_t *pos) | |||
3669 | int index = 0, pid = *pos; | 3669 | int index = 0, pid = *pos; |
3670 | int *iter; | 3670 | int *iter; |
3671 | 3671 | ||
3672 | down_read(&l->mutex); | 3672 | down_read(&l->rwsem); |
3673 | if (pid) { | 3673 | if (pid) { |
3674 | int end = l->length; | 3674 | int end = l->length; |
3675 | 3675 | ||
@@ -3696,7 +3696,7 @@ static void *cgroup_pidlist_start(struct seq_file *s, loff_t *pos) | |||
3696 | static void cgroup_pidlist_stop(struct seq_file *s, void *v) | 3696 | static void cgroup_pidlist_stop(struct seq_file *s, void *v) |
3697 | { | 3697 | { |
3698 | struct cgroup_pidlist *l = s->private; | 3698 | struct cgroup_pidlist *l = s->private; |
3699 | up_read(&l->mutex); | 3699 | up_read(&l->rwsem); |
3700 | } | 3700 | } |
3701 | 3701 | ||
3702 | static void *cgroup_pidlist_next(struct seq_file *s, void *v, loff_t *pos) | 3702 | static void *cgroup_pidlist_next(struct seq_file *s, void *v, loff_t *pos) |
@@ -3742,7 +3742,7 @@ static void cgroup_release_pid_array(struct cgroup_pidlist *l) | |||
3742 | * pidlist_mutex, we have to take pidlist_mutex first. | 3742 | * pidlist_mutex, we have to take pidlist_mutex first. |
3743 | */ | 3743 | */ |
3744 | mutex_lock(&l->owner->pidlist_mutex); | 3744 | mutex_lock(&l->owner->pidlist_mutex); |
3745 | down_write(&l->mutex); | 3745 | down_write(&l->rwsem); |
3746 | BUG_ON(!l->use_count); | 3746 | BUG_ON(!l->use_count); |
3747 | if (!--l->use_count) { | 3747 | if (!--l->use_count) { |
3748 | /* we're the last user if refcount is 0; remove and free */ | 3748 | /* we're the last user if refcount is 0; remove and free */ |
@@ -3750,12 +3750,12 @@ static void cgroup_release_pid_array(struct cgroup_pidlist *l) | |||
3750 | mutex_unlock(&l->owner->pidlist_mutex); | 3750 | mutex_unlock(&l->owner->pidlist_mutex); |
3751 | pidlist_free(l->list); | 3751 | pidlist_free(l->list); |
3752 | put_pid_ns(l->key.ns); | 3752 | put_pid_ns(l->key.ns); |
3753 | up_write(&l->mutex); | 3753 | up_write(&l->rwsem); |
3754 | kfree(l); | 3754 | kfree(l); |
3755 | return; | 3755 | return; |
3756 | } | 3756 | } |
3757 | mutex_unlock(&l->owner->pidlist_mutex); | 3757 | mutex_unlock(&l->owner->pidlist_mutex); |
3758 | up_write(&l->mutex); | 3758 | up_write(&l->rwsem); |
3759 | } | 3759 | } |
3760 | 3760 | ||
3761 | static int cgroup_pidlist_release(struct inode *inode, struct file *file) | 3761 | static int cgroup_pidlist_release(struct inode *inode, struct file *file) |