From: Zhaolei <zhaolei@cn.fujitsu.com>
To: Ingo Molnar <mingo@elte.hu>, David Rientjes <rientjes@google.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
"H. Peter Anvin" <hpa@zytor.com>,
Vegard Nossum <vegard.nossum@gmail.com>,
linux-kernel@vger.kernel.org
Subject: Re: Re: [PATCH] Remove initialization of page_table in one_page_table_init()
Date: Mon, 20 Jul 2009 11:07:29 +0800 [thread overview]
Message-ID: <4A63DF71.2070905@cn.fujitsu.com> (raw)
In-Reply-To: <20090718141157.GH32618@elte.hu>
Ingo Molnar wrote:
> * Zhaolei <zhaolei@cn.fujitsu.com> wrote:
>
>> Only judge if (!page_table) when CONFIG_DEBUG_PAGEALLOC or CONFIG_KMEMCHECK
>> are defined, then we don't need to set init value for page_table.
>>
>> Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
>> ---
>> arch/x86/mm/init_32.c | 4 ++--
>> 1 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
>> index 3cd7711..55da09b 100644
>> --- a/arch/x86/mm/init_32.c
>> +++ b/arch/x86/mm/init_32.c
>> @@ -108,13 +108,13 @@ static pmd_t * __init one_md_table_init(pgd_t *pgd)
>> static pte_t * __init one_page_table_init(pmd_t *pmd)
>> {
>> if (!(pmd_val(*pmd) & _PAGE_PRESENT)) {
>> - pte_t *page_table = NULL;
>> + pte_t *page_table;
>>
>> if (after_bootmem) {
>> #if defined(CONFIG_DEBUG_PAGEALLOC) || defined(CONFIG_KMEMCHECK)
>> page_table = (pte_t *) alloc_bootmem_pages(PAGE_SIZE);
>> -#endif
>> if (!page_table)
>> +#endif
>> page_table =
>> (pte_t *)alloc_bootmem_low_pages(PAGE_SIZE);
>
> I think the original code was cleaner - putting an #ifdef straight
> into the middle of a control block is quite fragile.
>
> Ingo
>
Hello, Ingo
David Rientjes said that:
Nack, gcc will already optimize the branch out for configs without
CONFIG_DEBUG_PAGEALLOC and CONFIG_KMEMCHECK. The only thing this change
does is make the code less readable.
I tested it with gcc -O2, and proved that David is correct.
Initialization of page_table and additional "if (!page_table)" was removed by optimization.
Please ignore this patch.
Thanks
Zhaolei
next prev parent reply other threads:[~2009-07-20 3:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-14 8:57 [PATCH] Remove initialization of page_table in one_page_table_init() Zhaolei
2009-07-14 10:18 ` David Rientjes
2009-07-18 14:11 ` Ingo Molnar
2009-07-20 3:07 ` Zhaolei [this message]
2009-07-20 11:50 ` Ingo Molnar
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=4A63DF71.2070905@cn.fujitsu.com \
--to=zhaolei@cn.fujitsu.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=rientjes@google.com \
--cc=tglx@linutronix.de \
--cc=vegard.nossum@gmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.