* [PATCH] mm: kill one if in loop of __free_pages_bootmem
@ 2013-07-23 2:17 Yinghai Lu
2013-07-23 5:52 ` Johannes Weiner
0 siblings, 1 reply; 2+ messages in thread
From: Yinghai Lu @ 2013-07-23 2:17 UTC (permalink / raw)
To: Andrew Morton
Cc: Johannes Weiner, Mel Gorman, linux-mm, linux-kernel, Yinghai Lu
We should not check loop+1 with loop end in loop body.
Just duplicate two lines code to avoid it.
That will help a bit when we have huge amount of pages on
system with 16TiB memory.
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Cc: Mel Gorman <mgorman@suse.de>
---
mm/page_alloc.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
Index: linux-2.6/mm/page_alloc.c
===================================================================
--- linux-2.6.orig/mm/page_alloc.c
+++ linux-2.6/mm/page_alloc.c
@@ -750,19 +750,19 @@ static void __free_pages_ok(struct page
void __init __free_pages_bootmem(struct page *page, unsigned int order)
{
unsigned int nr_pages = 1 << order;
+ struct page *p = page;
unsigned int loop;
- prefetchw(page);
- for (loop = 0; loop < nr_pages; loop++) {
- struct page *p = &page[loop];
-
- if (loop + 1 < nr_pages)
- prefetchw(p + 1);
+ prefetchw(p);
+ for (loop = 0; loop < (nr_pages - 1); loop++, p++) {
+ prefetchw(p + 1);
__ClearPageReserved(p);
set_page_count(p, 0);
}
+ __ClearPageReserved(p);
+ set_page_count(p, 0);
- page_zone(page)->managed_pages += 1 << order;
+ page_zone(page)->managed_pages += nr_pages;
set_page_refcounted(page);
__free_pages(page, order);
}
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] mm: kill one if in loop of __free_pages_bootmem
2013-07-23 2:17 [PATCH] mm: kill one if in loop of __free_pages_bootmem Yinghai Lu
@ 2013-07-23 5:52 ` Johannes Weiner
0 siblings, 0 replies; 2+ messages in thread
From: Johannes Weiner @ 2013-07-23 5:52 UTC (permalink / raw)
To: Yinghai Lu; +Cc: Andrew Morton, Mel Gorman, linux-mm, linux-kernel
On Mon, Jul 22, 2013 at 07:17:42PM -0700, Yinghai Lu wrote:
> We should not check loop+1 with loop end in loop body.
> Just duplicate two lines code to avoid it.
>
> That will help a bit when we have huge amount of pages on
> system with 16TiB memory.
>
> Signed-off-by: Yinghai Lu <yinghai@kernel.org>
> Cc: Mel Gorman <mgorman@suse.de>
Disassembly looks good, thanks!
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-07-23 5:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-23 2:17 [PATCH] mm: kill one if in loop of __free_pages_bootmem Yinghai Lu
2013-07-23 5:52 ` Johannes Weiner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox