From: Dave Hansen <dave@linux.vnet.ibm.com>
To: paulus@samba.org
Cc: Jon Tollefson <kniht@linux.vnet.ibm.com>,
Mel Gorman <mel@csn.ul.ie>, Dave Hansen <dave@linux.vnet.ibm.com>,
linuxppc-dev@ozlabs.org, "Serge E. Hallyn" <serue@us.ibm.com>
Subject: [PATCH 5/8] cleanup careful_allocation(): consolidate memset()
Date: Tue, 09 Dec 2008 10:21:36 -0800 [thread overview]
Message-ID: <20081209182136.0D1397F7@kernel> (raw)
In-Reply-To: <20081209182130.DB2150A2@kernel>
Both users of careful_allocation() immediately memset() the
result. So, just do it in one place.
Also give careful_allocation() a 'z' prefix to bring it in
line with kzmalloc() and friends.
Signed-off-by: Dave Hansen <dave@linux.vnet.ibm.com>
---
linux-2.6.git-dave/arch/powerpc/mm/numa.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff -puN arch/powerpc/mm/numa.c~cleanup-careful_allocation2 arch/powerpc/mm/numa.c
--- linux-2.6.git/arch/powerpc/mm/numa.c~cleanup-careful_allocation2 2008-12-09 10:16:06.000000000 -0800
+++ linux-2.6.git-dave/arch/powerpc/mm/numa.c 2008-12-09 10:16:06.000000000 -0800
@@ -824,7 +824,7 @@ static void __init dump_numa_memory_topo
*
* Returns the virtual address of the memory.
*/
-static void __init *careful_allocation(int nid, unsigned long size,
+static void __init *careful_zallocation(int nid, unsigned long size,
unsigned long align,
unsigned long end_pfn)
{
@@ -864,6 +864,7 @@ static void __init *careful_allocation(i
dbg("alloc_bootmem %p %lx\n", ret, size);
}
+ memset(ret, 0, size);
return ret;
}
@@ -970,10 +971,9 @@ void __init do_init_bootmem(void)
* previous nodes' bootmem to be initialized and have
* all reserved areas marked.
*/
- NODE_DATA(nid) = careful_allocation(nid,
+ NODE_DATA(nid) = careful_zallocation(nid,
sizeof(struct pglist_data),
SMP_CACHE_BYTES, end_pfn);
- memset(NODE_DATA(nid), 0, sizeof(struct pglist_data));
dbg("node %d\n", nid);
dbg("NODE_DATA() = %p\n", NODE_DATA(nid));
@@ -989,10 +989,9 @@ void __init do_init_bootmem(void)
dbg("end_paddr = %lx\n", end_pfn << PAGE_SHIFT);
bootmap_pages = bootmem_bootmap_pages(end_pfn - start_pfn);
- bootmem_vaddr = careful_allocation(nid,
+ bootmem_vaddr = careful_zallocation(nid,
bootmap_pages << PAGE_SHIFT,
PAGE_SIZE, end_pfn);
- memset(bootmem_vaddr, 0, bootmap_pages << PAGE_SHIFT);
dbg("bootmap_vaddr = %p\n", bootmem_vaddr);
@@ -1003,7 +1002,7 @@ void __init do_init_bootmem(void)
free_bootmem_with_active_regions(nid, end_pfn);
/*
* Be very careful about moving this around. Future
- * calls to careful_allocation() depend on this getting
+ * calls to careful_zallocation() depend on this getting
* done correctly.
*/
mark_reserved_regions_for_nid(nid);
_
next prev parent reply other threads:[~2008-12-09 18:21 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-09 18:21 [PATCH 0/8] Fix a bug and cleanup NUMA boot-time code Dave Hansen
2008-12-09 18:21 ` [PATCH 1/8] fix bootmem reservation on uninitialized node Dave Hansen
2008-12-10 22:14 ` Paul Mackerras
2008-12-10 22:30 ` Jon Tollefson
2008-12-10 22:54 ` Dave Hansen
2008-12-09 18:21 ` [PATCH 2/8] Add better comment on careful_allocation() Dave Hansen
2008-12-09 18:21 ` [PATCH 3/8] cleanup careful_allocation(): bootmem already panics Dave Hansen
2008-12-09 18:21 ` [PATCH 4/8] make careful_allocation() return vaddrs Dave Hansen
2008-12-09 18:21 ` Dave Hansen [this message]
2008-12-09 18:21 ` [PATCH 6/8] cleanup do_init_bootmem() Dave Hansen
2008-12-09 21:54 ` Serge E. Hallyn
2008-12-16 5:06 ` Paul Mackerras
2008-12-09 18:21 ` [PATCH 7/8] less use of NODE_DATA() Dave Hansen
2008-12-16 5:16 ` Paul Mackerras
2008-12-09 18:21 ` [PATCH 8/8] make free_bootmem_with_active_regions() take pgdat Dave Hansen
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=20081209182136.0D1397F7@kernel \
--to=dave@linux.vnet.ibm.com \
--cc=kniht@linux.vnet.ibm.com \
--cc=linuxppc-dev@ozlabs.org \
--cc=mel@csn.ul.ie \
--cc=paulus@samba.org \
--cc=serue@us.ibm.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).