public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] modules: insert mods sorted
@ 2013-05-25  8:09 Andrew Jones
  2013-05-26  8:25 ` Andrew Jones
  2013-05-27 11:03 ` Rusty Russell
  0 siblings, 2 replies; 3+ messages in thread
From: Andrew Jones @ 2013-05-25  8:09 UTC (permalink / raw)
  To: linux-kernel; +Cc: rusty

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


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

* Re: [PATCH] modules: insert mods sorted
  2013-05-25  8:09 [PATCH] modules: insert mods sorted Andrew Jones
@ 2013-05-26  8:25 ` Andrew Jones
  2013-05-27 11:03 ` Rusty Russell
  1 sibling, 0 replies; 3+ messages in thread
From: Andrew Jones @ 2013-05-26  8:25 UTC (permalink / raw)
  To: linux-kernel; +Cc: rusty

On Sat, May 25, 2013 at 10:09:46AM +0200, Andrew Jones wrote:
> 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
>

self-nacking. Tons of docs and tools exist expecting this
list in reverse load order. I'll blame the momentary insanity
the drove me to post this patch on having to triage too many
bugs...

drew

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

* Re: [PATCH] modules: insert mods sorted
  2013-05-25  8:09 [PATCH] modules: insert mods sorted Andrew Jones
  2013-05-26  8:25 ` Andrew Jones
@ 2013-05-27 11:03 ` Rusty Russell
  1 sibling, 0 replies; 3+ messages in thread
From: Rusty Russell @ 2013-05-27 11:03 UTC (permalink / raw)
  To: Andrew Jones, linux-kernel

Andrew Jones <drjones@redhat.com> writes:
> 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>

Hi Andrew,

        ISTR the story of young Fleming being fired as bottlewasher for
a major lab because the head researcher felt he was wasting his
talents.[1]

        Please take my rejection of this patch as similar endorsement of
your future prospects.

Cheers,
Rusty.
[1] Google can't find any trace of this story, so may be my imagination...

> ---
>  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

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

end of thread, other threads:[~2013-05-27 23:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-25  8:09 [PATCH] modules: insert mods sorted Andrew Jones
2013-05-26  8:25 ` Andrew Jones
2013-05-27 11:03 ` Rusty Russell

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