diff options
author | Michal Hocko <mhocko@suse.cz> | 2011-07-08 08:39:41 -0400 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2011-07-08 16:21:58 -0400 |
commit | d8bf4ca9ca9576548628344c9725edd3786e90b1 (patch) | |
tree | df338f50a5af6bc3651bd863b79fa91e6b1e9e20 /kernel | |
parent | eb032b9837a958e21ca000358a5bde5e17192ddb (diff) |
rcu: treewide: Do not use rcu_read_lock_held when calling rcu_dereference_check
Since ca5ecddf (rcu: define __rcu address space modifier for sparse)
rcu_dereference_check use rcu_read_lock_held as a part of condition
automatically so callers do not have to do that as well.
Signed-off-by: Michal Hocko <mhocko@suse.cz>
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/cgroup.c | 8 | ||||
-rw-r--r-- | kernel/exit.c | 1 | ||||
-rw-r--r-- | kernel/pid.c | 1 | ||||
-rw-r--r-- | kernel/rcutorture.c | 2 | ||||
-rw-r--r-- | kernel/sched.c | 1 |
5 files changed, 2 insertions, 11 deletions
diff --git a/kernel/cgroup.c b/kernel/cgroup.c index 2731d115d725..5ae71d6e274b 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c | |||
@@ -1697,7 +1697,6 @@ int cgroup_path(const struct cgroup *cgrp, char *buf, int buflen) | |||
1697 | { | 1697 | { |
1698 | char *start; | 1698 | char *start; |
1699 | struct dentry *dentry = rcu_dereference_check(cgrp->dentry, | 1699 | struct dentry *dentry = rcu_dereference_check(cgrp->dentry, |
1700 | rcu_read_lock_held() || | ||
1701 | cgroup_lock_is_held()); | 1700 | cgroup_lock_is_held()); |
1702 | 1701 | ||
1703 | if (!dentry || cgrp == dummytop) { | 1702 | if (!dentry || cgrp == dummytop) { |
@@ -1723,7 +1722,6 @@ int cgroup_path(const struct cgroup *cgrp, char *buf, int buflen) | |||
1723 | break; | 1722 | break; |
1724 | 1723 | ||
1725 | dentry = rcu_dereference_check(cgrp->dentry, | 1724 | dentry = rcu_dereference_check(cgrp->dentry, |
1726 | rcu_read_lock_held() || | ||
1727 | cgroup_lock_is_held()); | 1725 | cgroup_lock_is_held()); |
1728 | if (!cgrp->parent) | 1726 | if (!cgrp->parent) |
1729 | continue; | 1727 | continue; |
@@ -4813,8 +4811,7 @@ unsigned short css_id(struct cgroup_subsys_state *css) | |||
4813 | * on this or this is under rcu_read_lock(). Once css->id is allocated, | 4811 | * on this or this is under rcu_read_lock(). Once css->id is allocated, |
4814 | * it's unchanged until freed. | 4812 | * it's unchanged until freed. |
4815 | */ | 4813 | */ |
4816 | cssid = rcu_dereference_check(css->id, | 4814 | cssid = rcu_dereference_check(css->id, atomic_read(&css->refcnt)); |
4817 | rcu_read_lock_held() || atomic_read(&css->refcnt)); | ||
4818 | 4815 | ||
4819 | if (cssid) | 4816 | if (cssid) |
4820 | return cssid->id; | 4817 | return cssid->id; |
@@ -4826,8 +4823,7 @@ unsigned short css_depth(struct cgroup_subsys_state *css) | |||
4826 | { | 4823 | { |
4827 | struct css_id *cssid; | 4824 | struct css_id *cssid; |
4828 | 4825 | ||
4829 | cssid = rcu_dereference_check(css->id, | 4826 | cssid = rcu_dereference_check(css->id, atomic_read(&css->refcnt)); |
4830 | rcu_read_lock_held() || atomic_read(&css->refcnt)); | ||
4831 | 4827 | ||
4832 | if (cssid) | 4828 | if (cssid) |
4833 | return cssid->depth; | 4829 | return cssid->depth; |
diff --git a/kernel/exit.c b/kernel/exit.c index 20a406471525..07dc154fc799 100644 --- a/kernel/exit.c +++ b/kernel/exit.c | |||
@@ -85,7 +85,6 @@ static void __exit_signal(struct task_struct *tsk) | |||
85 | struct tty_struct *uninitialized_var(tty); | 85 | struct tty_struct *uninitialized_var(tty); |
86 | 86 | ||
87 | sighand = rcu_dereference_check(tsk->sighand, | 87 | sighand = rcu_dereference_check(tsk->sighand, |
88 | rcu_read_lock_held() || | ||
89 | lockdep_tasklist_lock_is_held()); | 88 | lockdep_tasklist_lock_is_held()); |
90 | spin_lock(&sighand->siglock); | 89 | spin_lock(&sighand->siglock); |
91 | 90 | ||
diff --git a/kernel/pid.c b/kernel/pid.c index 57a8346a270e..e432057f3b21 100644 --- a/kernel/pid.c +++ b/kernel/pid.c | |||
@@ -405,7 +405,6 @@ struct task_struct *pid_task(struct pid *pid, enum pid_type type) | |||
405 | if (pid) { | 405 | if (pid) { |
406 | struct hlist_node *first; | 406 | struct hlist_node *first; |
407 | first = rcu_dereference_check(hlist_first_rcu(&pid->tasks[type]), | 407 | first = rcu_dereference_check(hlist_first_rcu(&pid->tasks[type]), |
408 | rcu_read_lock_held() || | ||
409 | lockdep_tasklist_lock_is_held()); | 408 | lockdep_tasklist_lock_is_held()); |
410 | if (first) | 409 | if (first) |
411 | result = hlist_entry(first, struct task_struct, pids[(type)].node); | 410 | result = hlist_entry(first, struct task_struct, pids[(type)].node); |
diff --git a/kernel/rcutorture.c b/kernel/rcutorture.c index 2e138db03382..ced72102adc2 100644 --- a/kernel/rcutorture.c +++ b/kernel/rcutorture.c | |||
@@ -941,7 +941,6 @@ static void rcu_torture_timer(unsigned long unused) | |||
941 | idx = cur_ops->readlock(); | 941 | idx = cur_ops->readlock(); |
942 | completed = cur_ops->completed(); | 942 | completed = cur_ops->completed(); |
943 | p = rcu_dereference_check(rcu_torture_current, | 943 | p = rcu_dereference_check(rcu_torture_current, |
944 | rcu_read_lock_held() || | ||
945 | rcu_read_lock_bh_held() || | 944 | rcu_read_lock_bh_held() || |
946 | rcu_read_lock_sched_held() || | 945 | rcu_read_lock_sched_held() || |
947 | srcu_read_lock_held(&srcu_ctl)); | 946 | srcu_read_lock_held(&srcu_ctl)); |
@@ -1002,7 +1001,6 @@ rcu_torture_reader(void *arg) | |||
1002 | idx = cur_ops->readlock(); | 1001 | idx = cur_ops->readlock(); |
1003 | completed = cur_ops->completed(); | 1002 | completed = cur_ops->completed(); |
1004 | p = rcu_dereference_check(rcu_torture_current, | 1003 | p = rcu_dereference_check(rcu_torture_current, |
1005 | rcu_read_lock_held() || | ||
1006 | rcu_read_lock_bh_held() || | 1004 | rcu_read_lock_bh_held() || |
1007 | rcu_read_lock_sched_held() || | 1005 | rcu_read_lock_sched_held() || |
1008 | srcu_read_lock_held(&srcu_ctl)); | 1006 | srcu_read_lock_held(&srcu_ctl)); |
diff --git a/kernel/sched.c b/kernel/sched.c index 3f2e502d609b..71e5a25a8a58 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -581,7 +581,6 @@ static inline int cpu_of(struct rq *rq) | |||
581 | 581 | ||
582 | #define rcu_dereference_check_sched_domain(p) \ | 582 | #define rcu_dereference_check_sched_domain(p) \ |
583 | rcu_dereference_check((p), \ | 583 | rcu_dereference_check((p), \ |
584 | rcu_read_lock_held() || \ | ||
585 | lockdep_is_held(&sched_domains_mutex)) | 584 | lockdep_is_held(&sched_domains_mutex)) |
586 | 585 | ||
587 | /* | 586 | /* |