public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Reduce bkl usage in do_coredump
@ 2004-08-09 14:38 Josh Aas
  2004-08-09 17:30 ` Dave Hansen
  0 siblings, 1 reply; 4+ messages in thread
From: Josh Aas @ 2004-08-09 14:38 UTC (permalink / raw)
  To: linux-kernel, Andrew Morton, steiner

[-- Attachment #1: Type: text/plain, Size: 358 bytes --]

A patch that reduces bkl usage in do_coredump is attached. I don't see 
anywhere that it is necessary except for the call to format_corename, 
which is controlled via sysctl (sys_sysctl holds the bkl).

Also make format_corename() static.

Signed-off-by: Josh Aas <josha@sgi.com>

-- 
Josh Aas
Silicon Graphics, Inc. (SGI)
Linux System Software
651-683-3068

[-- Attachment #2: coredump_bkl.patch --]
[-- Type: text/x-patch, Size: 1344 bytes --]

--- a/fs/exec.c	2004-08-09 09:14:53.000000000 -0500
+++ b/fs/exec.c	2004-08-09 09:18:50.000000000 -0500
@@ -1193,7 +1193,7 @@ EXPORT_SYMBOL(set_binfmt);
  * name into corename, which must have space for at least
  * CORENAME_MAX_SIZE bytes plus one byte for the zero terminator.
  */
-void format_corename(char *corename, const char *pattern, long signr)
+static void format_corename(char *corename, const char *pattern, long signr)
 {
 	const char *pat_ptr = pattern;
 	char *out_ptr = corename;
@@ -1357,7 +1357,6 @@ int do_coredump(long signr, int exit_cod
 	struct file * file;
 	int retval = 0;
 
-	lock_kernel();
 	binfmt = current->binfmt;
 	if (!binfmt || !binfmt->core_dump)
 		goto fail;
@@ -1375,7 +1374,13 @@ int do_coredump(long signr, int exit_cod
 	if (current->rlim[RLIMIT_CORE].rlim_cur < binfmt->min_coredump)
 		goto fail_unlock;
 
- 	format_corename(corename, core_pattern, signr);
+	/* 
+	 * lock_kernel() because format_corename() is controlled by sysctl, which
+	 * uses lock_kernel()
+	 */
+ 	lock_kernel();
+	format_corename(corename, core_pattern, signr);
+	unlock_kernel();
 	file = filp_open(corename, O_CREAT | 2 | O_NOFOLLOW | O_LARGEFILE, 0600);
 	if (IS_ERR(file))
 		goto fail_unlock;
@@ -1402,6 +1407,5 @@ close_fail:
 fail_unlock:
 	complete_all(&mm->core_done);
 fail:
-	unlock_kernel();
 	return retval;
 }

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-08-09 18:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-08-09 14:38 [PATCH] Reduce bkl usage in do_coredump Josh Aas
2004-08-09 17:30 ` Dave Hansen
2004-08-09 17:45   ` Josh Aas
2004-08-09 18:13   ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox