lkml.org 
[lkml]   [2012]   [Jul]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH 2/3] x86/mm: Simplify for-loop in free_init_pages()
From
On Sat, Jul 14, 2012 at 11:43 PM, Joe Perches <joe@perches.com> wrote:
> On Sat, 2012-07-14 at 13:36 -0700, Yinghai Lu wrote:
>> On Sat, Jul 14, 2012 at 6:41 AM, Pekka Enberg <penberg@kernel.org> wrote:
>> > As a cleanup, move initial "addr" assignment to the for-loop construct
>> > in free_init_pages().
>
> Not really a good idea.

Of course it's a good idea. The current code flow makes no sense.

>> > diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c
> []
>> > @@ -349,8 +349,6 @@ void free_init_pages(char *what, unsigned long begin, unsigned long end)
>> > if (begin >= end)
>> > return;
>> >
>> > - addr = begin;
>> > -
>> > /*
>> > * If debugging page accesses then do not free this memory but
>> > * mark them not present - any buggy init-section access will
>> > @@ -371,7 +369,7 @@ void free_init_pages(char *what, unsigned long begin, unsigned long end)
>> >
>> > printk(KERN_INFO "Freeing %s: %luk freed\n", what, (end - begin) >> 10);
>> >
>> > - for (; addr < end; addr += PAGE_SIZE) {
>> > + for (addr = begin; addr < end; addr += PAGE_SIZE) {
>> > ClearPageReserved(virt_to_page(addr));
>> > init_page_count(virt_to_page(addr));
>> > memset((void *)addr, POISON_FREE_INITMEM, PAGE_SIZE);
>> > --
>
> Now there's an unused variable warning when CONFIG_DEBUG_PAGEALLOC

Sure, that needs fixing. It'd probably be simplest to introduce a
__free_init_pages() helper.


\
 
 \ /
  Last update: 2012-07-14 23:21    [W:0.047 / U:0.464 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site