public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Josh Aas <josha@sgi.com>
To: linux-kernel@vger.kernel.org, Andrew Morton <akpm@osdl.org>,
	steiner@sgi.com
Subject: [PATCH] Reduce bkl usage in do_coredump
Date: Mon, 09 Aug 2004 09:38:01 -0500	[thread overview]
Message-ID: <41178C49.3080305@sgi.com> (raw)

[-- 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;
 }

             reply	other threads:[~2004-08-09 14:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-09 14:38 Josh Aas [this message]
2004-08-09 17:30 ` [PATCH] Reduce bkl usage in do_coredump Dave Hansen
2004-08-09 17:45   ` Josh Aas
2004-08-09 18:13   ` Andrew Morton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=41178C49.3080305@sgi.com \
    --to=josha@sgi.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=steiner@sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox