Subject: + mm-kill-one-if-loop-in-__free_pages_bootmem.patch added to -mm tree To: yinghai@xxxxxxxxxx,hannes@xxxxxxxxxxx,mgorman@xxxxxxx From: akpm@xxxxxxxxxxxxxxxxxxxx Date: Wed, 24 Jul 2013 15:32:55 -0700 The patch titled Subject: mm: kill one if loop in __free_pages_bootmem() has been added to the -mm tree. Its filename is mm-kill-one-if-loop-in-__free_pages_bootmem.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/mm-kill-one-if-loop-in-__free_pages_bootmem.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/mm-kill-one-if-loop-in-__free_pages_bootmem.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Yinghai Lu <yinghai@xxxxxxxxxx> Subject: mm: kill one if loop in __free_pages_bootmem() 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@xxxxxxxxxx> Cc: Mel Gorman <mgorman@xxxxxxx> Acked-by: Johannes Weiner <hannes@xxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/page_alloc.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff -puN mm/page_alloc.c~mm-kill-one-if-loop-in-__free_pages_bootmem mm/page_alloc.c --- a/mm/page_alloc.c~mm-kill-one-if-loop-in-__free_pages_bootmem +++ a/mm/page_alloc.c @@ -751,19 +751,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); } _ Patches currently in -mm which might be from yinghai@xxxxxxxxxx are mm-kill-one-if-loop-in-__free_pages_bootmem.patch firmware-dmi_scan-drop-obsolete-comment.patch linux-next.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html