mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Jones <drjones@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: rusty@rustcorp.com.au
Subject: [PATCH] modules: insert mods sorted
Date: Sat, 25 May 2013 10:09:46 +0200	[thread overview]
Message-ID: <1369469386-3215-1-git-send-email-drjones@redhat.com> (raw)

While there isn't a big difference between typing 'lsmod' and
'lsmod | sort', the module listing in Oopses isn't so easily sorted.
Attempting to search these quickly by eye for particular modules while
rapidly triaging bugs can be a pain. Sort the list and reduce the pain.

Signed-off-by: Andrew Jones <drjones@redhat.com>
---
 kernel/module.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/kernel/module.c b/kernel/module.c
index cab4bce49c23d..7914d8ef2e09c 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -3146,7 +3146,7 @@ static int may_init_module(void)
 static int add_unformed_module(struct module *mod)
 {
 	int err;
-	struct module *old;
+	struct module *old, *m;
 
 	mod->state = MODULE_STATE_UNFORMED;
 
@@ -3166,7 +3166,13 @@ again:
 		err = -EEXIST;
 		goto out;
 	}
-	list_add_rcu(&mod->list, &modules);
+	if (!list_empty(&modules)) {
+		list_for_each_entry(m, &modules, list)
+			if (strcmp(mod->name, m->name) < 0)
+				break;
+		list_add_tail_rcu(&mod->list, &m->list);
+	} else
+		list_add_rcu(&mod->list, &modules);
 	err = 0;
 
 out:
-- 
1.8.1.4


             reply	other threads:[~2013-05-25  8:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-25  8:09 Andrew Jones [this message]
2013-05-26  8:25 ` Andrew Jones
2013-05-27 11:03 ` Rusty Russell

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=1369469386-3215-1-git-send-email-drjones@redhat.com \
    --to=drjones@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    /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®