Re: [PATCH 2/2] module: fix bne2 "gave up waiting for init of module libcrc32c"

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linus Torvalds
Date: Wednesday, June 2, 2010 - 7:50 am

On Wed, 2 Jun 2010, Rusty Russell wrote:

Yup.

And now that I'm looking at that call-chain (to see if it would make sense 
to use some other more specific lock - doesn't look like it: all the 
readers are using RCU and this is the only writer), I also give you this 
trivial one-liner. It changes each_symbol() to not put that constant array 
on the stack, resulting in changing

        movq    $C.388.31095, %rsi      #, tmp85
        subq    $376, %rsp      #,
        movq    %rdi, %rbx      # fn, fn
        leaq    -208(%rbp), %rdi        #, tmp84
        movq    %rbx, %rdx      # fn,
        rep movsl
        xorl    %esi, %esi      #
        leaq    -208(%rbp), %rdi        #, tmp87
        movq    %r12, %rcx      # data,
        call    each_symbol_in_section.clone.0  #

into

        xorl    %esi, %esi      #
        subq    $216, %rsp      #,
        movq    %rdi, %rbx      # fn, fn  
        movq    $arr.31078, %rdi        #,
        call    each_symbol_in_section.clone.0  #

which is not so much about being obviously shorter and simpler because we 
don't unnecessarily copy that constant array around onto the stack, but 
also about having a much smaller stack footprint (376 vs 216 bytes - see 
the update of 'rsp').

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
---

Btw, feel free to consider all those peeling patches signed-off-on, since 
they seem to work.


I don't think it's necessarily bad to have multiple exit targets (although 
9 is pushing it), if the thing is short enough that you can fairly easily 
see how they work. Not that it's quite there yet.

		Linus
---
 kernel/module.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/kernel/module.c b/kernel/module.c
index 01e8874..2602264 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -227,7 +227,7 @@ bool each_symbol(bool (*fn)(const struct symsearch *arr, struct module *owner,
 			    unsigned int symnum, void *data), void *data)
 {
 	struct module *mod;
-	const struct symsearch arr[] = {
+	static const struct symsearch arr[] = {
 		{ __start___ksymtab, __stop___ksymtab, __start___kcrctab,
 		  NOT_GPL_ONLY, false },
 		{ __start___ksymtab_gpl, __stop___ksymtab_gpl,
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[Regression] Crash in load_module() while freeing args, Rafael J. Wysocki, (Tue May 25, 2:00 pm)
Re: [Regression] Crash in load_module() while freeing args, Rafael J. Wysocki, (Tue May 25, 3:54 pm)
Re: [Regression] Crash in load_module() while freeing args, Linus Torvalds, (Tue May 25, 4:47 pm)
Re: [Regression] Crash in load_module() while freeing args, Linus Torvalds, (Wed May 26, 8:41 am)
Re: [Regression] Crash in load_module() while freeing args, Rafael J. Wysocki, (Wed May 26, 3:56 pm)
Re: [Regression] Crash in load_module() while freeing args, Linus Torvalds, (Wed May 26, 4:07 pm)
Re: [Regression] Crash in load_module() while freeing args, Rusty Russell, (Wed May 26, 10:26 pm)
Re: [Regression] Crash in load_module() while freeing args, Brandon Philips, (Thu May 27, 11:46 am)
Re: [Regression] Crash in load_module() while freeing args, Rafael J. Wysocki, (Thu May 27, 2:57 pm)
Re: [Regression] Crash in load_module() while freeing args, Rusty Russell, (Mon May 31, 12:54 am)
[PATCH 0/2] kernel/module.c locking changes, Rusty Russell, (Mon May 31, 5:00 am)
[PATCH 1/2] module: make locking more fine-grained., Rusty Russell, (Mon May 31, 5:01 am)
[PATCH 1/2] Make the module 'usage' lists be two-way, Linus Torvalds, (Mon May 31, 1:16 pm)
Re: [PATCH 1/2] Make the module 'usage' lists be two-way, Rusty Russell, (Mon May 31, 6:37 pm)
Re: [PATCH 1/2] Make the module 'usage' lists be two-way, Américo Wang, (Mon May 31, 7:44 pm)
Re: [PATCH 1/2] Make the module 'usage' lists be two-way, Rusty Russell, (Mon May 31, 8:42 pm)
Re: [PATCH 1/2] Make the module 'usage' lists be two-way, Linus Torvalds, (Mon May 31, 8:51 pm)
Re: [PATCH 1/2] Make the module 'usage' lists be two-way, Linus Torvalds, (Mon May 31, 9:00 pm)
Re: [PATCH 1/2] Make the module 'usage' lists be two-way, Linus Torvalds, (Mon May 31, 9:05 pm)
Re: [PATCH 1/2] module: make locking more fine-grained., Américo Wang, (Mon May 31, 10:38 pm)
Re: [PATCH 1/2] module: make locking more fine-grained., Rusty Russell, (Mon May 31, 10:55 pm)
Re: [PATCH 2/2] module: fix bne2 "gave up waiting for init ..., Linus Torvalds, (Wed Jun 2, 7:50 am)