diff mbox

[v2,part2,08/10] mm/SPARC: use free_highmem_page() to free highmem pages into buddy system

Message ID 1362902470-25787-9-git-send-email-jiang.liu@huawei.com
State Not Applicable
Delegated to: David Miller
Headers show

Commit Message

Jiang Liu March 10, 2013, 8:01 a.m. UTC
Use helper function free_highmem_page() to free highmem pages into
the buddy system.

Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: sparclinux@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
 arch/sparc/mm/init_32.c |   12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

Comments

Andrew Morton March 12, 2013, 9:42 p.m. UTC | #1
On Sun, 10 Mar 2013 16:01:08 +0800 Jiang Liu <liuj97@gmail.com> wrote:

> Use helper function free_highmem_page() to free highmem pages into
> the buddy system.
> 
> ...
>
> --- a/arch/sparc/mm/init_32.c
> +++ b/arch/sparc/mm/init_32.c
> @@ -282,14 +282,8 @@ static void map_high_region(unsigned long start_pfn, unsigned long end_pfn)
>  	printk("mapping high region %08lx - %08lx\n", start_pfn, end_pfn);
>  #endif
>  
> -	for (tmp = start_pfn; tmp < end_pfn; tmp++) {
> -		struct page *page = pfn_to_page(tmp);
> -
> -		ClearPageReserved(page);
> -		init_page_count(page);
> -		__free_page(page);
> -		totalhigh_pages++;
> -	}
> +	for (tmp = start_pfn; tmp < end_pfn; tmp++)
> +		free_higmem_page(pfn_to_page(tmp));
>  }

This code isn't inside #ifdef CONFIG_HIGHMEM, but afaict that's OK
because CONFIG_HIGHMEM=n isn't possible on sparc32.

This patch and one other mistyped "free_highmem_page".  I got lazy and
edited those patches in-place.

--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sam Ravnborg March 13, 2013, 6:34 a.m. UTC | #2
On Tue, Mar 12, 2013 at 02:42:15PM -0700, Andrew Morton wrote:
> On Sun, 10 Mar 2013 16:01:08 +0800 Jiang Liu <liuj97@gmail.com> wrote:
> 
> > Use helper function free_highmem_page() to free highmem pages into
> > the buddy system.
> > 
> > ...
> >
> > --- a/arch/sparc/mm/init_32.c
> > +++ b/arch/sparc/mm/init_32.c
> > @@ -282,14 +282,8 @@ static void map_high_region(unsigned long start_pfn, unsigned long end_pfn)
> >  	printk("mapping high region %08lx - %08lx\n", start_pfn, end_pfn);
> >  #endif
> >  
> > -	for (tmp = start_pfn; tmp < end_pfn; tmp++) {
> > -		struct page *page = pfn_to_page(tmp);
> > -
> > -		ClearPageReserved(page);
> > -		init_page_count(page);
> > -		__free_page(page);
> > -		totalhigh_pages++;
> > -	}
> > +	for (tmp = start_pfn; tmp < end_pfn; tmp++)
> > +		free_higmem_page(pfn_to_page(tmp));
> >  }
> 
> This code isn't inside #ifdef CONFIG_HIGHMEM, but afaict that's OK
> because CONFIG_HIGHMEM=n isn't possible on sparc32.
Correct - from arch/sparc/Kconfig

config HIGHMEM
        bool
        default y if SPARC32


> This patch and one other mistyped "free_highmem_page".  I got lazy and
> edited those patches in-place.
Good spot!

You can add my:
Acked-by: Sam Ravnborg <sam@ravnborg.org>

	Sam
 
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jiang Liu March 13, 2013, 4:47 p.m. UTC | #3
On 03/13/2013 05:42 AM, Andrew Morton wrote:
> On Sun, 10 Mar 2013 16:01:08 +0800 Jiang Liu <liuj97@gmail.com> wrote:
> 
>> Use helper function free_highmem_page() to free highmem pages into
>> the buddy system.
>>
>> ...
>>
>> --- a/arch/sparc/mm/init_32.c
>> +++ b/arch/sparc/mm/init_32.c
>> @@ -282,14 +282,8 @@ static void map_high_region(unsigned long start_pfn, unsigned long end_pfn)
>>  	printk("mapping high region %08lx - %08lx\n", start_pfn, end_pfn);
>>  #endif
>>  
>> -	for (tmp = start_pfn; tmp < end_pfn; tmp++) {
>> -		struct page *page = pfn_to_page(tmp);
>> -
>> -		ClearPageReserved(page);
>> -		init_page_count(page);
>> -		__free_page(page);
>> -		totalhigh_pages++;
>> -	}
>> +	for (tmp = start_pfn; tmp < end_pfn; tmp++)
>> +		free_higmem_page(pfn_to_page(tmp));
>>  }
> 
> This code isn't inside #ifdef CONFIG_HIGHMEM, but afaict that's OK
> because CONFIG_HIGHMEM=n isn't possible on sparc32.
> 
> This patch and one other mistyped "free_highmem_page".  I got lazy and
> edited those patches in-place.
> 
Hi Andrew,
	Great thanks for fixing them!
	Gerry
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/arch/sparc/mm/init_32.c b/arch/sparc/mm/init_32.c
index 13d6fee..6a7eb68 100644
--- a/arch/sparc/mm/init_32.c
+++ b/arch/sparc/mm/init_32.c
@@ -282,14 +282,8 @@  static void map_high_region(unsigned long start_pfn, unsigned long end_pfn)
 	printk("mapping high region %08lx - %08lx\n", start_pfn, end_pfn);
 #endif
 
-	for (tmp = start_pfn; tmp < end_pfn; tmp++) {
-		struct page *page = pfn_to_page(tmp);
-
-		ClearPageReserved(page);
-		init_page_count(page);
-		__free_page(page);
-		totalhigh_pages++;
-	}
+	for (tmp = start_pfn; tmp < end_pfn; tmp++)
+		free_higmem_page(pfn_to_page(tmp));
 }
 
 void __init mem_init(void)
@@ -347,8 +341,6 @@  void __init mem_init(void)
 		map_high_region(start_pfn, end_pfn);
 	}
 	
-	totalram_pages += totalhigh_pages;
-
 	codepages = (((unsigned long) &_etext) - ((unsigned long)&_start));
 	codepages = PAGE_ALIGN(codepages) >> PAGE_SHIFT;
 	datapages = (((unsigned long) &_edata) - ((unsigned long)&_etext));