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 |    9 ++++-----
 fs/proc/root.c      |   10 ++++++----
 2 files changed, 10 insertions(+), 9 deletions(-)

diff -puN fs/proc/proc_misc.c~proc-lock_kernel-removal fs/proc/proc_misc.c
--- 25/fs/proc/proc_misc.c~proc-lock_kernel-removal	2003-06-28 02:04:31.000000000 -0700
+++ 25-akpm/fs/proc/proc_misc.c	2003-06-28 02:04:31.000000000 -0700
@@ -509,11 +509,10 @@ static int ds1286_read_proc(char *page, 
 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;
 }
 
diff -puN fs/proc/root.c~proc-lock_kernel-removal fs/proc/root.c
--- 25/fs/proc/root.c~proc-lock_kernel-removal	2003-06-28 02:04:31.000000000 -0700
+++ 25-akpm/fs/proc/root.c	2003-06-28 02:04:31.000000000 -0700
@@ -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;

_