Skip to contentSkip to conversation

cls_cgroup: remove unneeded cgroup_lock

PATCH In review Li Zefan 3 participants 3 messages Mar 12, 2009 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore

Li Zefan

author
#0 lore raw

PATCH 1/1 cls_cgroup: remove unneeded cgroup_lock

We can remove this lock here, since we are in cgroup write handler and thus the cgrp is guaranteed to be valid, and no lock is needed when writing a u32 variable.

---
 net/sched/cls_cgroup.c |    6 ------
 1 files changed, 0 insertions(+), 6 deletions(-)
net/sched/cls_cgroup.c +0 -6
index 91a3db4..1ab4542 100644
@@ -62,13 +62,7 @@ static u64 read_classid(struct cgroup *cgrp, struct cftype *cft)
 
 static int write_classid(struct cgroup *cgrp, struct cftype *cft, u64 value)
 {
-	if (!cgroup_lock_live_group(cgrp))
-		return -ENODEV;
-
 	cgrp_cls_state(cgrp)->classid = (u32) value;
-
-	cgroup_unlock();
-
 	return 0;
 }
 
Signature · 1 line
1.5.4.rc3
Acked-by
#2 lore raw
In reply to a message not in the archive
Quoted 3 lines · Li Zefan

We can remove this lock here, since we are in cgroup write handler and thus the cgrp is guaranteed to be valid, and no lock is needed when writing a u32 variable.

There's no guarantee that the group isn't dead, so we could be writing into a value that's never going to be used again, but I guess that's not really a big deal.

Quoted 28 lines
---
 net/sched/cls_cgroup.c |    6 ------
 1 files changed, 0 insertions(+), 6 deletions(-)
net/sched/cls_cgroup.c +0 -7
index 91a3db4..1ab4542 100644
@@ -62,13 +62,7 @@ static u64 read_classid(struct cgroup *cgrp, struct cftype *cft)
 
 static int write_classid(struct cgroup *cgrp, struct cftype *cft, u64 value)
 {
-       if (!cgroup_lock_live_group(cgrp))
-               return -ENODEV;
-
       cgrp_cls_state(cgrp)->classid = (u32) value;
-
-       cgroup_unlock();
-
       return 0;
 }
 
--

1.5.4.rc3

Acked-by on v1 1/1
#3 lore raw
In reply to Li Zefan
Quoted 3 lines · Li Zefan

We can remove this lock here, since we are in cgroup write handler and thus the cgrp is guaranteed to be valid, and no lock is needed when writing a u32 variable.

There's no guarantee that the group isn't dead, so we could be writing into a value that's never going to be used again, but I guess that's not really a big deal.

Quoted 28 lines
---
 net/sched/cls_cgroup.c |    6 ------
 1 files changed, 0 insertions(+), 6 deletions(-)
net/sched/cls_cgroup.c +0 -7
index 91a3db4..1ab4542 100644
@@ -62,13 +62,7 @@ static u64 read_classid(struct cgroup *cgrp, struct cftype *cft)
 
 static int write_classid(struct cgroup *cgrp, struct cftype *cft, u64 value)
 {
-       if (!cgroup_lock_live_group(cgrp))
-               return -ENODEV;
-
       cgrp_cls_state(cgrp)->classid = (u32) value;
-
-       cgroup_unlock();
-
       return 0;
 }
 
--

1.5.4.rc3