]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] procfs: remove some unneeded lock_kernel()s
authorAndrew Morton <akpm@osdl.org>
Wed, 2 Jul 2003 15:48:18 +0000 (08:48 -0700)
committerLinus Torvalds <torvalds@home.osdl.org>
Wed, 2 Jul 2003 15:48:18 +0000 (08:48 -0700)
From: William Lee Irwin III <wli@holomorphy.com>

Remove spurious BKL acquisitions in /proc/.  The BKL is not required to
access nr_threads for reporting, and get_locks_status() takes it
internally, wrapping all operations with it.

fs/proc/proc_misc.c
fs/proc/root.c

index 1268f3883f4e1635abff62142ea29cccdce3847d..eed19a3ea677ec0e234789d1b91df69ccc65e850 100644 (file)
@@ -497,11 +497,10 @@ static int ds1286_read_proc(char *page, char **start, off_t off,
 static int locks_read_proc(char *page, char **start, off_t off,
                                 int count, int *eof, void *data)
 {
-       int len;
-       lock_kernel();
-       len = get_locks_status(page, start, off, count);
-       unlock_kernel();
-       if (len < count) *eof = 1;
+       int len = get_locks_status(page, start, off, count);
+
+       if (len < count)
+               *eof = 1;
        return len;
 }
 
index f6b7c065a9696c3b7922c37912ee69adfeacd56d..fb40f8c53cb4bcb058ebb0c21da5a6b3028c3525 100644 (file)
@@ -81,11 +81,13 @@ void __init proc_root_init(void)
 
 static struct dentry *proc_root_lookup(struct inode * dir, struct dentry * dentry)
 {
-       if (dir->i_ino == PROC_ROOT_INO) { /* check for safety... */
-               lock_kernel();
+       /*
+        * nr_threads is actually protected by the tasklist_lock;
+        * however, it's conventional to do reads, especially for
+        * reporting, without any locking whatsoever.
+        */
+       if (dir->i_ino == PROC_ROOT_INO) /* check for safety... */
                dir->i_nlink = proc_root.nlink + nr_threads;
-               unlock_kernel();
-       }
 
        if (!proc_lookup(dir, dentry)) {
                return NULL;