From: christoph <christoph@scalex86.org>
To: linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] Factor in buddy allocator alignment requirements in node memory alignment
Date: Mon, 16 May 2005 12:05:53 -0700 (PDT) [thread overview]
Message-ID: <Pine.LNX.4.62.0505161204540.4977@ScMPusgw> (raw)
Memory for nodes on i386 is currently aligned on 2 MB boundaries.
However, the buddy allocator needs pages to be aligned on
PAGE_SIZE << MAX_ORDER which is 8MB if MAX_ORDER = 11.
The following patch determines the maximum alignment needed and will
chose 2MB boundaries if MAX_ORDER is very low but will align correctly
to a MAX_ORDER boundary if the alignment requirements of the page allocator
are greater than 2MB.
Signed-off-by: Christoph Lameter <christoph@scalex86.org>
Signed-off-by: Shai Fultheim <shai@scalex86.org>
Index: linux-2.6.11/arch/i386/mm/discontig.c
===================================================================
--- linux-2.6.11.orig/arch/i386/mm/discontig.c 2005-05-12 20:04:56.000000000 -0700
+++ linux-2.6.11/arch/i386/mm/discontig.c 2005-05-12 20:05:58.000000000 -0700
@@ -100,8 +100,6 @@ extern unsigned long max_low_pfn;
extern unsigned long totalram_pages;
extern unsigned long totalhigh_pages;
-#define LARGE_PAGE_BYTES (PTRS_PER_PTE * PAGE_SIZE)
-
unsigned long node_remap_start_pfn[MAX_NUMNODES];
unsigned long node_remap_size[MAX_NUMNODES];
unsigned long node_remap_offset[MAX_NUMNODES];
@@ -185,6 +183,12 @@ static unsigned long calculate_numa_rema
{
int nid;
unsigned long size, reserve_pages = 0;
+ /*
+ * Alignment is either to the PMD boundary or to the boundary of the
+ * largest order allowed by the buddy allocator whichever is bigger
+ */
+ unsigned long alignment = (( 1 << MAX_ORDER ) > PTRS_PER_PTE) ?
+ 1 << MAX_ORDER : PTRS_PER_PTE;
for_each_online_node(nid) {
if (nid == 0)
@@ -204,10 +208,10 @@ static unsigned long calculate_numa_rema
/* ensure the remap includes space for the pgdat. */
size = node_remap_size[nid] + sizeof(pg_data_t);
- /* convert size to large (pmd size) pages, rounding up */
- size = (size + LARGE_PAGE_BYTES - 1) / LARGE_PAGE_BYTES;
+ /* convert size to the alignment, rounding up */
+ size = (size + (alignment * PAGE_SIZE) - 1) / (alignment * PAGE_SIZE);
/* now the roundup is correct, convert to PAGE_SIZE pages */
- size = size * PTRS_PER_PTE;
+ size = size * alignment;
printk("Reserving %ld pages of KVA for lmem_map of node %d\n",
size, nid);
node_remap_size[nid] = size;
--
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:"aart@kvack.org"> aart@kvack.org </a>
next reply other threads:[~2005-05-16 19:05 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-05-16 19:05 christoph [this message]
2005-05-16 20:14 ` Dave Hansen
2005-05-16 19:43 ` christoph
2005-05-16 20:47 ` Dave Hansen
2005-05-16 19:55 ` christoph
2005-05-16 20:56 ` Dave Hansen
2005-05-16 20:12 ` christoph
2005-05-16 21:06 ` Martin J. Bligh
2005-05-17 13:12 ` Andrea Arcangeli
2005-05-17 14:16 ` Andy Whitcroft
2005-05-16 20:51 ` Martin J. Bligh
2005-05-17 12:25 ` Andy Whitcroft
2005-05-17 17:19 ` christoph
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=Pine.LNX.4.62.0505161204540.4977@ScMPusgw \
--to=christoph@scalex86.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
/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