lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Sat, 16 Dec 2006 17:03:53 +0900 From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com> To: Andrew Morton <akpm@...l.org> Cc: haveblue@...ibm.com, apw@...dowen.org, cbe-oss-dev@...abs.org, linuxppc-dev@...abs.org, linux-mm@...ck.org, mkravetz@...ibm.com, hch@...radead.org, jk@...abs.org, linux-kernel@...r.kernel.org, paulus@...ba.org, benh@...nel.crashing.org, gone@...ibm.com, kmannth@...ibm.com Subject: Re: [PATCH] Fix sparsemem on Cell On Fri, 15 Dec 2006 11:45:36 -0800 Andrew Morton <akpm@...l.org> wrote: > Perhaps if the function's role in the world was commented it would be clearer. > How about patch like this ? (this one is not tested.) Already-exisiting-more-generic-flag is available ? -Kame == include/linux/memory_hotplug.h | 8 ++++++++ mm/memory_hotplug.c | 14 ++++++++++++++ mm/page_alloc.c | 11 +++++++---- 3 files changed, 29 insertions(+), 4 deletions(-) Index: linux-2.6.20-rc1-mm1/include/linux/memory_hotplug.h =================================================================== --- linux-2.6.20-rc1-mm1.orig/include/linux/memory_hotplug.h 2006-11-30 06:57:37.000000000 +0900 +++ linux-2.6.20-rc1-mm1/include/linux/memory_hotplug.h 2006-12-16 16:42:40.000000000 +0900 @@ -133,6 +133,10 @@ #endif /* CONFIG_NUMA */ #endif /* CONFIG_HAVE_ARCH_NODEDATA_EXTENSION */ +extern int under_memory_hotadd(void); + + + #else /* ! CONFIG_MEMORY_HOTPLUG */ /* * Stub functions for when hotplug is off @@ -159,6 +163,10 @@ dump_stack(); return -ENOSYS; } +static inline int under_memory_hotadd() +{ + return 0; +} #endif /* ! CONFIG_MEMORY_HOTPLUG */ static inline int __remove_pages(struct zone *zone, unsigned long start_pfn, Index: linux-2.6.20-rc1-mm1/mm/memory_hotplug.c =================================================================== --- linux-2.6.20-rc1-mm1.orig/mm/memory_hotplug.c 2006-12-16 14:24:10.000000000 +0900 +++ linux-2.6.20-rc1-mm1/mm/memory_hotplug.c 2006-12-16 16:51:08.000000000 +0900 @@ -26,6 +26,17 @@ #include <asm/tlbflush.h> +/* + * Because memory hotplug shares some codes for initilization with boot, + * we sometimes have to check what we are doing ? + */ +static atomic_t memory_hotadd_count; + +int under_memory_hotadd(void) +{ + return atomic_read(&memory_hotadd_count); +} + /* add this memory to iomem resource */ static struct resource *register_memory_resource(u64 start, u64 size) { @@ -273,10 +284,13 @@ if (ret) goto error; } + atomic_inc(&memory_hotadd_count); /* call arch's memory hotadd */ ret = arch_add_memory(nid, start, size); + atomic_dec(&memory_hotadd_count); + if (ret < 0) goto error; Index: linux-2.6.20-rc1-mm1/mm/page_alloc.c =================================================================== --- linux-2.6.20-rc1-mm1.orig/mm/page_alloc.c 2006-12-16 14:24:38.000000000 +0900 +++ linux-2.6.20-rc1-mm1/mm/page_alloc.c 2006-12-16 16:53:02.000000000 +0900 @@ -2069,10 +2069,13 @@ unsigned long pfn; for (pfn = start_pfn; pfn < end_pfn; pfn++) { - if (!early_pfn_valid(pfn)) - continue; - if (!early_pfn_in_nid(pfn, nid)) - continue; + if (!under_memory_hotadd()) { + /* we are in boot */ + if (!early_pfn_valid(pfn)) + continue; + if (!early_pfn_in_nid(pfn, nid)) + continue; + } page = pfn_to_page(pfn); set_page_links(page, zone, nid, pfn); init_page_count(page); - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@...r.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists