From: Mike Travis <travis@sgi.com>
To: Andrew Morton <akpm@linux-foundation.org>,
Eric Dumazet <dada1@cosmosbay.com>, Ingo Molnar <mingo@elte.hu>,
Thomas Gleixner <tglx@linutronix.de>, Andi Kleen <ak@suse.de>
Cc: Christoph Lameter <clameter@sgi.com>,
Jack Steiner <steiner@sgi.com>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: [PATCH 1/1] x86_64: x86_64_cleanup_pda() should use nr_cpu_ids instead of NR_CPUS
Date: Mon, 25 Feb 2008 10:33:09 -0800 [thread overview]
Message-ID: <20080225183308.446028000@polaris-admin.engr.sgi.com> (raw)
In-Reply-To: 20080225183308.159770000@polaris-admin.engr.sgi.com
[-- Attachment #1: fold-pda-fix --]
[-- Type: text/plain, Size: 1451 bytes --]
We allocate an array of nr_cpu_ids pointers, so we should respect its bonds.
Delay change of _cpu_pda after array initialization.
Also take into account that alloc_bootmem_low() :
- calls panic() if not enough memory
- already clears allocated memory
Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
Signed-off-by: Mike Travis <travis@sgi.com>
---
arch/x86/kernel/head64.c | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
--- a/arch/x86/kernel/head64.c
+++ b/arch/x86/kernel/head64.c
@@ -151,18 +151,16 @@ void __init x86_64_start_kernel(char * r
void __init x86_64_cleanup_pda(void)
{
int i;
+ struct x8664_pda **new_cpu_pda;
- _cpu_pda = alloc_bootmem_low(nr_cpu_ids * sizeof(void *));
+ new_cpu_pda = alloc_bootmem_low(nr_cpu_ids * sizeof(void *));
- if (!_cpu_pda)
- panic("Cannot allocate cpu pda table\n");
+ for (i = 0; i < nr_cpu_ids; i++)
+ if (_cpu_pda_init[i] != &boot_cpu_pda[i])
+ new_cpu_pda[i] = _cpu_pda_init[i];
+ mb();
+ _cpu_pda = new_cpu_pda;
/* cpu_pda() now points to allocated cpu_pda_table */
-
- for (i = 0; i < NR_CPUS; i++)
- if (_cpu_pda_init[i] == &boot_cpu_pda[i])
- cpu_pda(i) = NULL;
- else
- cpu_pda(i) = _cpu_pda_init[i];
}
#endif
--
--
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>
prev parent reply other threads:[~2008-02-25 18:33 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-25 18:33 [PATCH 0/1] x86_64: x86_64_cleanup_pda() should use nr_cpu_ids instead of NR_CPUS Mike Travis
2008-02-25 18:33 ` Mike Travis [this message]
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=20080225183308.446028000@polaris-admin.engr.sgi.com \
--to=travis@sgi.com \
--cc=ak@suse.de \
--cc=akpm@linux-foundation.org \
--cc=clameter@sgi.com \
--cc=dada1@cosmosbay.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mingo@elte.hu \
--cc=steiner@sgi.com \
--cc=tglx@linutronix.de \
/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).