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
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1207180285.30407.45.camel@dyn9047017100.beaverton.ibm.com>
Date:	Wed, 02 Apr 2008 15:51:25 -0800
From:	Badari Pulavarty <pbadari@...ibm.com>
To:	yhlu.kernel@...il.com
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	Ingo Molnar <mingo@...e.hu>, michael@...erman.id.au,
	Kamalesh Babulal <kamalesh@...ux.vnet.ibm.com>,
	linuxppc-dev@...abs.org, Balbir Singh <balbir@...ux.vnet.ibm.com>,
	kernel list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] mm: allocate usemap at first instead of mem_map in
	sparse_init

On Wed, 2008-04-02 at 15:25 -0700, Yinghai Lu wrote:
> [PATCH] mm: allocate usemap at first instead of mem_map in sparse_init
> so try to allocate usemap at first altogether.
> 
> Signed-off-by: Yinghai Lu <yhlu.kernel@...il.com>
> 
> diff --git a/mm/sparse.c b/mm/sparse.c
> index d3cb085..782ebe5 100644
> --- a/mm/sparse.c
> +++ b/mm/sparse.c
> @@ -294,7 +294,7 @@ void __init sparse_init(void)
>  	unsigned long pnum;
>  	struct page *map;
>  	unsigned long *usemap;
> -	struct page **section_map;
> +	unsigned long **usemap_map;
>  	int size;
>  	int node;
> 
> @@ -305,27 +305,31 @@ void __init sparse_init(void)
>  	 * make next 2M slip to one more 2M later.
>  	 * then in big system, the memmory will have a lot hole...
>  	 * here try to allocate 2M pages continously.

Comments are x86-64 specific. On ppc its 16MB chunks :(

> +	 *
> +	 * powerpc hope to sparse_init_one_section right after each
> +	 * sparse_early_mem_map_alloc, so allocate usemap_map
> +	 * at first.
>  	 */
> -	size = sizeof(struct page *) * NR_MEM_SECTIONS;
> -	section_map = alloc_bootmem(size);
> -	if (!section_map)
> -		panic("can not allocate section_map\n");
> +	size = sizeof(unsigned long *) * NR_MEM_SECTIONS;
> +	usemap_map = alloc_bootmem(size);
> +	if (!usemap_map)
> +		panic("can not allocate usemap_map\n");
> 
>  	for (pnum = 0; pnum < NR_MEM_SECTIONS; pnum++) {
>  		if (!present_section_nr(pnum))
>  			continue;
> -		section_map[pnum] = sparse_early_mem_map_alloc(pnum);
> +		usemap_map[pnum] = sparse_early_usemap_alloc(pnum);
>  	}
> 
>  	for (pnum = 0; pnum < NR_MEM_SECTIONS; pnum++) {
>  		if (!present_section_nr(pnum))
>  			continue;
> 
> -		map = section_map[pnum];
> +		map = sparse_early_mem_map_alloc(pnum);
>  		if (!map)
>  			 continue;
> 
> -		usemap = sparse_early_usemap_alloc(pnum);
> +		usemap = usemap_map[pnum];
>  		if (!usemap)
>  			continue;

You may want to move this check before doing sparse_early_mem_map_alloc
(). We are also not handling errors properly (freeing up the unused
map or usemap) if we "continue". I know the original code is this way,
but you touched it last :)

> 
> @@ -333,7 +337,7 @@ void __init sparse_init(void)
>  								usemap);
>  	}
> 
> -	free_bootmem(__pa(section_map), size);
> +	free_bootmem(__pa(usemap_map), size);
>  }
> 
>  #ifdef CONFIG_MEMORY_HOTPLUG

Tested and boots my machine fine.

Acked-by: Badari Pulavarty <pbadari@...ibm.com>

Thanks,
Badari

--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ