From: Zou Nan hai <nanhai.zou@intel.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
ak@suse.de, suresh.b.siddha@intel.com
Subject: Re: [Patch] Allocate sparsemem memmap above 4G on X86_64
Date: 18 May 2007 10:52:57 +0800 [thread overview]
Message-ID: <1179456777.2633.8.camel@linux-znh> (raw)
In-Reply-To: <20070517123216.184104a8.akpm@linux-foundation.org>
On Fri, 2007-05-18 at 03:32, Andrew Morton wrote:
> On 17 May 2007 10:40:07 +0800
> Zou Nan hai <nanhai.zou@intel.com> wrote:
>
> >
> Please always prefer to use static inline functions rather than macros.
> They are more readable, they are more likely to have comments attached to
> them and they provide typechecking.
>
> Please prefer to uninline functions by default. One reason for this is
> that adding inlines to headers increases include complexity. This code is
> all __init anyway, so the possible few bytes of text will get removed.
>
>
> Try to avoid using the ARCH_HAS_FOO thing. We have two alternatives:
>
> a) use __attribute__((weak))
>
> b) do:
>
> extern void foo(void);
> #define foo foo
>
> then, elsewhere,
>
> #ifndef foo
> #define foo() bar()
> #endif
>
> Both tricks avoid the introduction of two new symbols into the global
> namespace to solve a single problem.
On systems with huge amount of physical memory, VFS cache and memory
memmap may eat all available system memory under 4G, then the system may
fail to allocate swiotlb bounce buffer.
There was a fix for this issue in arch/x86_64/mm/numa.c, but that fix
dose not cover sparsemem model.
This patch add fix to sparsemem model by first try to allocate memmap
above 4G.
Signed-off-by: Zou Nan hai <nanhai.zou@intel.com>
Acked-by: Suresh Siddha <suresh.b.siddha@intel.com>
---
arch/x86_64/mm/init.c | 6 ++++++
mm/sparse.c | 11 +++++++++++
2 files changed, 17 insertions(+)
diff -Nraup a/arch/x86_64/mm/init.c b/arch/x86_64/mm/init.c
--- a/arch/x86_64/mm/init.c 2007-05-19 16:54:46.000000000 +0800
+++ b/arch/x86_64/mm/init.c 2007-05-19 17:43:47.000000000 +0800
@@ -761,3 +761,9 @@ int in_gate_area_no_task(unsigned long a
{
return (addr >= VSYSCALL_START) && (addr < VSYSCALL_END);
}
+
+void *alloc_bootmem_high_node(pg_data_t *pgdat, unsigned long size)
+{
+ return __alloc_bootmem_core(pgdat->bdata, size,
+ SMP_CACHE_BYTES, (4UL*1024*1024*1024), 0);
+}
diff -Nraup a/mm/sparse.c b/mm/sparse.c
--- a/mm/sparse.c 2007-05-19 16:54:48.000000000 +0800
+++ b/mm/sparse.c 2007-05-19 17:44:01.000000000 +0800
@@ -209,6 +209,12 @@ static int __meminit sparse_init_one_sec
return 1;
}
+__attribute__((weak))
+void *alloc_bootmem_high_node(pg_data_t *pgdat, unsigned long size)
+{
+ return NULL;
+}
+
static struct page __init *sparse_early_mem_map_alloc(unsigned long pnum)
{
struct page *map;
@@ -219,6 +225,11 @@ static struct page __init *sparse_early_
if (map)
return map;
+ map = alloc_bootmem_high_node(NODE_DATA(nid),
+ sizeof(struct page) * PAGES_PER_SECTION);
+ if (map)
+ return map;
+
map = alloc_bootmem_node(NODE_DATA(nid),
sizeof(struct page) * PAGES_PER_SECTION);
if (map)
next prev parent reply other threads:[~2007-05-18 2:52 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-17 2:40 [Patch] Allocate sparsemem memmap above 4G on X86_64 Zou Nan hai
2007-05-17 19:32 ` Andrew Morton
2007-05-18 2:52 ` Zou Nan hai [this message]
2007-05-18 3:22 ` Andrew Morton
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=1179456777.2633.8.camel@linux-znh \
--to=nanhai.zou@intel.com \
--cc=ak@suse.de \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=suresh.b.siddha@intel.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