From: Andi Kleen <ak@muc.de>
To: torvalds@transmeta.com
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] Speed bootmem up for simulators
Date: Thu, 31 Jan 2002 00:35:07 +0100 [thread overview]
Message-ID: <20020131003507.A1453@averell> (raw)
Hi Linus,
This is a old patch from the x86-64 tree. It just optimizes the final memory
freeing pass to be a bit more efficient. It probably doesn't make much
difference on any CPU, but it is a big time win in a slow CPU simulator
with huge memory where the freeing can take minutes sometimes.
It is just an obvious optimization for the freeing loop.
Patch against 2.5.3. Please apply.
Thanks,
-Andi
--- linux-2.5.3-work/mm/bootmem.c-BOOTMEM Tue Jan 15 17:53:36 2002
+++ linux-2.5.3-work/mm/bootmem.c Wed Jan 30 23:21:35 2002
@@ -247,19 +247,30 @@
bootmem_data_t *bdata = pgdat->bdata;
unsigned long i, count, total = 0;
unsigned long idx;
+ unsigned long *map;
if (!bdata->node_bootmem_map) BUG();
count = 0;
idx = bdata->node_low_pfn - (bdata->node_boot_start >> PAGE_SHIFT);
- for (i = 0; i < idx; i++, page++) {
- if (!test_bit(i, bdata->node_bootmem_map)) {
+ map = bdata->node_bootmem_map;
+ for (i = 0; i < idx; ) {
+ unsigned long v = ~map[i / BITS_PER_LONG];
+ if (v) {
+ unsigned long m;
+ for (m = 1; m && i < idx; m<<=1, page++, i++) {
+ if (v & m) {
count++;
ClearPageReserved(page);
set_page_count(page, 1);
__free_page(page);
}
}
+ } else {
+ i+=BITS_PER_LONG;
+ page+=BITS_PER_LONG;
+ }
+ }
total += count;
/*
reply other threads:[~2002-01-30 23:36 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20020131003507.A1453@averell \
--to=ak@muc.de \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@transmeta.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).