[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87y4oyb6sc.fsf@rustcorp.com.au>
Date: Tue, 20 Jan 2015 11:35:39 +1030
From: Rusty Russell <rusty@...tcorp.com.au>
To: Oleg Nesterov <oleg@...hat.com>,
Rasmus Villemoes <linux@...musvillemoes.dk>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
"H. Peter Anvin" <hpa@...or.com>,
"Peter Zijlstra \(Intel\)" <peterz@...radead.org>,
Geert Uytterhoeven <geert@...ux-m68k.org>,
Prarit Bhargava <prarit@...hat.com>,
Fabian Frederick <fabf@...net.be>,
Johannes Weiner <hannes@...xchg.org>,
linux-kernel@...r.kernel.org
Subject: Re: [RFC/PATCH] init/main.c: Simplify initcall_blacklisted()
Oleg Nesterov <oleg@...hat.com> writes:
> On 01/17, Rasmus Villemoes wrote:
>>
>> Using kasprintf to get the function name makes us look up the name
>> twice, along with all the vsnprintf overhead of parsing the format
>> string etc. It also means there is an allocation failure case to deal
>> with. Since symbol_string in vsprintf.c would anyway allocate an array
>> of size KSYM_SYMBOL_LEN on the stack, that might as well be done up
>> here.
>>
>> Signed-off-by: Rasmus Villemoes <linux@...musvillemoes.dk>
>> ---
>>
>> Notes:
>> I don't know how expensive it is to do the symbol lookup for each
>> initcall. It might be worthwhile adding an
>>
>> if (list_empty(&blacklisted_initcalls))
>> return false;
>>
>> at the very beginning of initcall_blacklisted(), since this is a debug
>> feature and the blacklist is indeed usually empty.
>
> If we want to optimize this... I am wondering if we can change
> initcall_blacklist()
>
> - entry->buf = alloc_bootmem(strlen(str_entry) + 1);
> + ebtry->fn = kallsyms_lookup_name(str_entry);
>
> and then change initcall_blacklisted() to just compare the pointers.
That would make far, far more sense. It would fail for modules of
course, but that might be OK. Prarit, this was your code; does it
matter?
Cheers,
Rusty.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists