summaryrefslogtreecommitdiff
path: root/fs/proc/base.c
diff options
context:
space:
mode:
authorLai Jiangshan <laijs@cn.fujitsu.com>2008-10-05 00:51:15 +0400
committerAlexey Dobriyan <adobriyan@gmail.com>2008-10-10 04:18:57 +0400
commita6bebbc87a8c16eabb6bd5c6fd2d994be0236fba (patch)
tree3e617ca49063f3a12c982da5d6c687882a1b4070 /fs/proc/base.c
parent53167a3ef23df561d898dee636f3393e9fba937c (diff)
downloadlwn-a6bebbc87a8c16eabb6bd5c6fd2d994be0236fba.tar.gz
lwn-a6bebbc87a8c16eabb6bd5c6fd2d994be0236fba.zip
[PATCH] signal, procfs: some lock_task_sighand() users do not need rcu_read_lock()
lock_task_sighand() make sure task->sighand is being protected, so we do not need rcu_read_lock(). [ exec() will get task->sighand->siglock before change task->sighand! ] But code using rcu_read_lock() _just_ to protect lock_task_sighand() only appear in procfs. (and some code in procfs use lock_task_sighand() without such redundant protection.) Other subsystem may put lock_task_sighand() into rcu_read_lock() critical region, but these rcu_read_lock() are used for protecting "for_each_process()", "find_task_by_vpid()" etc. , not for protecting lock_task_sighand(). Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com> [ok from Oleg] Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Diffstat (limited to 'fs/proc/base.c')
-rw-r--r--fs/proc/base.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c
index a28840b11b89..bb63fa1d34a2 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -164,7 +164,6 @@ static struct fs_struct *get_fs_struct(struct task_struct *task)
static int get_nr_threads(struct task_struct *tsk)
{
- /* Must be called with the rcu_read_lock held */
unsigned long flags;
int count = 0;
@@ -471,14 +470,10 @@ static int proc_pid_limits(struct task_struct *task, char *buffer)
struct rlimit rlim[RLIM_NLIMITS];
- rcu_read_lock();
- if (!lock_task_sighand(task,&flags)) {
- rcu_read_unlock();
+ if (!lock_task_sighand(task, &flags))
return 0;
- }
memcpy(rlim, task->signal->rlim, sizeof(struct rlimit) * RLIM_NLIMITS);
unlock_task_sighand(task, &flags);
- rcu_read_unlock();
/*
* print the file header
@@ -3088,9 +3083,7 @@ static int proc_task_getattr(struct vfsmount *mnt, struct dentry *dentry, struct
generic_fillattr(inode, stat);
if (p) {
- rcu_read_lock();
stat->nlink += get_nr_threads(p);
- rcu_read_unlock();
put_task_struct(p);
}