On Thu, Aug 04, 2011 at 02:55:17PM +0800, Bob Liu wrote: > On Thu, Aug 4, 2011 at 2:10 PM, Pekka Enberg <penberg@xxxxxxxxxx> wrote: > > On Thu, Aug 4, 2011 at 6:09 AM, Bob Liu <lliubbo@xxxxxxxxx> wrote: > >> This patch using kzalloc to clean up sparse_index_alloc() and > >> __GFP_ZERO to clean up __kmalloc_section_memmap(). > >> > >> Signed-off-by: Bob Liu <lliubbo@xxxxxxxxx> > >> --- > >> mm/sparse.c | 24 +++++++----------------- > >> 1 files changed, 7 insertions(+), 17 deletions(-) > >> > >> diff --git a/mm/sparse.c b/mm/sparse.c > >> index 858e1df..9596635 100644 > >> --- a/mm/sparse.c > >> +++ b/mm/sparse.c > >> @@ -65,15 +65,12 @@ static struct mem_section noinline __init_refok *sparse_index_alloc(int nid) > >> > >> if (slab_is_available()) { > >> if (node_state(nid, N_HIGH_MEMORY)) > >> - section = kmalloc_node(array_size, GFP_KERNEL, nid); > >> + section = kzalloc_node(array_size, GFP_KERNEL, nid); > >> else > >> - section = kmalloc(array_size, GFP_KERNEL); > >> + section = kzalloc(array_size, GFP_KERNEL); > >> } else > >> section = alloc_bootmem_node(NODE_DATA(nid), array_size); > >> > >> - if (section) > >> - memset(section, 0, array_size); > >> - > > > > You now broke the alloc_bootmem_node() path. > > > > Yes. > But In my opinion, the alloc_bootmem_node() will also return zeroed memory. > I saw it has used kzalloc or memset() but i'm not pretty sure. > CC'd yinghai@xxxxxxxxxx,hpa@xxxxxxxxx You are right, bootmem always returns zeroed memory. But it deserves mentioning in the changelog. -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/ Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>