Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 273278
b: refs/heads/master
c: c1e2ee2
h: refs/heads/master
v: v3
  • Loading branch information
Andrew Bresticker authored and Linus Torvalds committed Nov 2, 2011
1 parent d82aed3 commit 58b8ed6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 080d676de095a14ecba14c0b9a91acb5bbb634df
refs/heads/master: c1e2ee2dc436574880758b3836fc96935b774c32
2 changes: 1 addition & 1 deletion trunk/include/linux/cgroup.h
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ struct cgroup_subsys {
struct list_head sibling;
/* used when use_id == true */
struct idr idr;
spinlock_t id_lock;
rwlock_t id_lock;

/* should be defined only by modular subsystems */
struct module *module;
Expand Down
18 changes: 9 additions & 9 deletions trunk/kernel/cgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -4883,9 +4883,9 @@ void free_css_id(struct cgroup_subsys *ss, struct cgroup_subsys_state *css)

rcu_assign_pointer(id->css, NULL);
rcu_assign_pointer(css->id, NULL);
spin_lock(&ss->id_lock);
write_lock(&ss->id_lock);
idr_remove(&ss->idr, id->id);
spin_unlock(&ss->id_lock);
write_unlock(&ss->id_lock);
kfree_rcu(id, rcu_head);
}
EXPORT_SYMBOL_GPL(free_css_id);
Expand All @@ -4911,10 +4911,10 @@ static struct css_id *get_new_cssid(struct cgroup_subsys *ss, int depth)
error = -ENOMEM;
goto err_out;
}
spin_lock(&ss->id_lock);
write_lock(&ss->id_lock);
/* Don't use 0. allocates an ID of 1-65535 */
error = idr_get_new_above(&ss->idr, newid, 1, &myid);
spin_unlock(&ss->id_lock);
write_unlock(&ss->id_lock);

/* Returns error when there are no free spaces for new ID.*/
if (error) {
Expand All @@ -4929,9 +4929,9 @@ static struct css_id *get_new_cssid(struct cgroup_subsys *ss, int depth)
return newid;
remove_idr:
error = -ENOSPC;
spin_lock(&ss->id_lock);
write_lock(&ss->id_lock);
idr_remove(&ss->idr, myid);
spin_unlock(&ss->id_lock);
write_unlock(&ss->id_lock);
err_out:
kfree(newid);
return ERR_PTR(error);
Expand All @@ -4943,7 +4943,7 @@ static int __init_or_module cgroup_init_idr(struct cgroup_subsys *ss,
{
struct css_id *newid;

spin_lock_init(&ss->id_lock);
rwlock_init(&ss->id_lock);
idr_init(&ss->idr);

newid = get_new_cssid(ss, 0);
Expand Down Expand Up @@ -5038,9 +5038,9 @@ css_get_next(struct cgroup_subsys *ss, int id,
* scan next entry from bitmap(tree), tmpid is updated after
* idr_get_next().
*/
spin_lock(&ss->id_lock);
read_lock(&ss->id_lock);
tmp = idr_get_next(&ss->idr, &tmpid);
spin_unlock(&ss->id_lock);
read_unlock(&ss->id_lock);

if (!tmp)
break;
Expand Down

0 comments on commit 58b8ed6

Please sign in to comment.