mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Randy.Dunlap" <rdunlap@xenotime.net>
To: <tyler@agat.net>
Cc: rusty@rustcorp.com.au, gregkh@suse.de, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Kmod optimization
Date: Thu, 13 Apr 2006 11:19:36 -0700	[thread overview]
Message-ID: <20060413111936.3d035771.rdunlap@xenotime.net> (raw)
In-Reply-To: <20060413180345.GA10910@Starbuck>

On Thu, 13 Apr 2006 20:03:45 +0200 tyler@agat.net wrote:

> Hi,
> 
> the request_mod functions try to load automatically a module by running
> a user mode process helper (modprobe).
> 
> The user process is launched even if the module is already loaded. I
> think it would be better to test if the module is already loaded.

Please try not to use attachments: it makes it more difficult
to review and comment on code (so I'll paste it here).


+	/* We don't to load the module if it's already loaded */
+	spin_lock_irqsave(&modlist_lock, flags);
+	if (is_loaded(module_name)) {
+		return -EEXIST;
+	}
+	spin_unlock_irqrestore(&modlist_lock, flags);

Need to do spin_unlock_irqrestore() even if is_loaded() is true.

+/* Test if a module is loaded : must hold module_mutex */
+int is_loaded(const char *module_name);
+{
+	struct module *mod = find_module(module_name);
+
+	if (!mod) {
+		return 1;
+	}

Don't use braces when not needed.
Why not make this function inline and put it into a header file?

---
~Randy

  reply	other threads:[~2006-04-13 18:17 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-13 18:03 tyler
2006-04-13 18:19 ` Randy.Dunlap [this message]
2006-04-13 18:57   ` Jan Engelhardt
2006-04-13 18:24 ` Greg KH
2006-04-13 18:36   ` tyler
2006-04-13 18:50     ` Greg KH
2006-04-13 19:04       ` tyler
2006-04-13 22:53         ` Roman Zippel
2006-04-13 23:13         ` Greg KH
2006-04-14 10:57           ` tyler
2006-04-13 19:10     ` Paulo Marques
2006-04-13 19:17       ` tyler

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=20060413111936.3d035771.rdunlap@xenotime.net \
    --to=rdunlap@xenotime.net \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    --cc=tyler@agat.net \
    /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

all inboxes | Powered by JetHome®