summaryrefslogtreecommitdiff
path: root/fs/proc/base.c
diff options
context:
space:
mode:
authorAlexey Dobriyan <adobriyan@gmail.com>2014-08-08 14:21:27 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2014-08-08 15:57:22 -0700
commit335eb53158466a4c4d018fa53ceb8c8ba1067fa3 (patch)
treef12db91b65fa3ea85bad2610aab8dfa3d8f4dfc8 /fs/proc/base.c
parentdbcdb504417ae108a20454ef89776a614b948571 (diff)
proc: faster /proc/$PID lookup
Currently lookup for /proc/$PID first goes through spinlock and whole list of misc /proc entries only to confirm that, yes, /proc/42 can not possibly match random proc entry. List is is several dozens entries long (52 entries on my setup). None of this is necessary. Try to convert dentry name to integer first. If it works, it must be /proc/$PID. If it doesn't, it must be random proc entry. Based on patch from Al Viro. Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Cc: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/proc/base.c')
-rw-r--r--fs/proc/base.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 11375216b493..35afb2eb4a6f 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -2780,7 +2780,7 @@ out:
struct dentry *proc_pid_lookup(struct inode *dir, struct dentry * dentry, unsigned int flags)
{
- int result = 0;
+ int result = -ENOENT;
struct task_struct *task;
unsigned tgid;
struct pid_namespace *ns;