LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] mm: fix alloc_bootmem_core to use fast searching for all nodes
@ 2008-03-11 6:23 Yinghai Lu
2008-03-11 8:18 ` Ingo Molnar
0 siblings, 1 reply; 2+ messages in thread
From: Yinghai Lu @ 2008-03-11 6:23 UTC (permalink / raw)
To: Andrew Morton, Ingo Molnar, Christoph Lameter; +Cc: kernel list
[-- Attachment #1: Type: text/plain, Size: 455 bytes --]
[PATCH] mm: fix alloc_bootmem_core to use fast searching for all nodes
make the nodes other than node 0 could use bdata->last_success for
fast search too.
we need to use __alloc_bootmem_core for vmemmap allocation for other nodes when
numa and sparsemem/vmemmap are enabled.
also make fail_block path increase i with incr only needed after ALIGN to avoid
extra increase when size is large than align.
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: vmemmap_2.patch --]
[-- Type: text/x-patch; name=vmemmap_2.patch, Size: 1499 bytes --]
Index: linux-2.6/mm/bootmem.c
===================================================================
--- linux-2.6.orig/mm/bootmem.c
+++ linux-2.6/mm/bootmem.c
@@ -227,28 +227,32 @@ __alloc_bootmem_core(struct bootmem_data
* We try to allocate bootmem pages above 'goal'
* first, then we try to allocate lower pages.
*/
- if (goal && goal >= bdata->node_boot_start && PFN_DOWN(goal) < end_pfn) {
- preferred = goal - bdata->node_boot_start;
+ preferred = 0;
+ if (goal && PFN_DOWN(goal) < end_pfn) {
+ if (goal > bdata->node_boot_start)
+ preferred = goal - bdata->node_boot_start;
if (bdata->last_success >= preferred)
if (!limit || (limit && limit > bdata->last_success))
preferred = bdata->last_success;
- } else
- preferred = 0;
+ }
preferred = PFN_DOWN(ALIGN(preferred, align)) + offset;
areasize = (size + PAGE_SIZE-1) / PAGE_SIZE;
incr = align >> PAGE_SHIFT ? : 1;
restart_scan:
- for (i = preferred; i < eidx; i += incr) {
+ for (i = preferred; i < eidx;) {
unsigned long j;
+
i = find_next_zero_bit(bdata->node_bootmem_map, eidx, i);
i = ALIGN(i, incr);
if (i >= eidx)
break;
- if (test_bit(i, bdata->node_bootmem_map))
+ if (test_bit(i, bdata->node_bootmem_map)) {
+ i += incr;
continue;
+ }
for (j = i + 1; j < i + areasize; ++j) {
if (j >= eidx)
goto fail_block;
@@ -259,6 +263,8 @@ restart_scan:
goto found;
fail_block:
i = ALIGN(j, incr);
+ if (i == j)
+ i += incr;
}
if (preferred > offset) {
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] mm: fix alloc_bootmem_core to use fast searching for all nodes
2008-03-11 6:23 [PATCH] mm: fix alloc_bootmem_core to use fast searching for all nodes Yinghai Lu
@ 2008-03-11 8:18 ` Ingo Molnar
0 siblings, 0 replies; 2+ messages in thread
From: Ingo Molnar @ 2008-03-11 8:18 UTC (permalink / raw)
To: Yinghai Lu; +Cc: Andrew Morton, Christoph Lameter, kernel list
* Yinghai Lu <yhlu.kernel@gmail.com> wrote:
> [PATCH] mm: fix alloc_bootmem_core to use fast searching for all nodes
a nice improvement as well. Find below the text-inlined patch for -mm
inclusion.
Ingo
-------------------->
Subject: mm: fix alloc_bootmem_core to use fast searching for all nodes
From: "Yinghai Lu" <yhlu.kernel@gmail.com>
Date: Mon, 10 Mar 2008 23:23:42 -0700
make the nodes other than node 0 could use bdata->last_success for fast
search too.
we need to use __alloc_bootmem_core for vmemmap allocation for other
nodes when numa and sparsemem/vmemmap are enabled.
also make fail_block path increase i with incr only needed after ALIGN
to avoid extra increase when size is larger than align.
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
mm/bootmem.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
Index: linux-x86.q/mm/bootmem.c
===================================================================
--- linux-x86.q.orig/mm/bootmem.c
+++ linux-x86.q/mm/bootmem.c
@@ -227,28 +227,32 @@ __alloc_bootmem_core(struct bootmem_data
* We try to allocate bootmem pages above 'goal'
* first, then we try to allocate lower pages.
*/
- if (goal && goal >= bdata->node_boot_start && PFN_DOWN(goal) < end_pfn) {
- preferred = goal - bdata->node_boot_start;
+ preferred = 0;
+ if (goal && PFN_DOWN(goal) < end_pfn) {
+ if (goal > bdata->node_boot_start)
+ preferred = goal - bdata->node_boot_start;
if (bdata->last_success >= preferred)
if (!limit || (limit && limit > bdata->last_success))
preferred = bdata->last_success;
- } else
- preferred = 0;
+ }
preferred = PFN_DOWN(ALIGN(preferred, align)) + offset;
areasize = (size + PAGE_SIZE-1) / PAGE_SIZE;
incr = align >> PAGE_SHIFT ? : 1;
restart_scan:
- for (i = preferred; i < eidx; i += incr) {
+ for (i = preferred; i < eidx;) {
unsigned long j;
+
i = find_next_zero_bit(bdata->node_bootmem_map, eidx, i);
i = ALIGN(i, incr);
if (i >= eidx)
break;
- if (test_bit(i, bdata->node_bootmem_map))
+ if (test_bit(i, bdata->node_bootmem_map)) {
+ i += incr;
continue;
+ }
for (j = i + 1; j < i + areasize; ++j) {
if (j >= eidx)
goto fail_block;
@@ -259,6 +263,8 @@ restart_scan:
goto found;
fail_block:
i = ALIGN(j, incr);
+ if (i == j)
+ i += incr;
}
if (preferred > offset) {
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-03-11 8:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-11 6:23 [PATCH] mm: fix alloc_bootmem_core to use fast searching for all nodes Yinghai Lu
2008-03-11 8:18 ` Ingo Molnar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).