Re: [PATCH 02/46] x86, mm: Split out split_mem_range from init_memory_mapping
On Mon, Nov 12, 2012 at 11:03 PM, wrote: > On 2012年11月13日 14:20, Yinghai Lu wrote: >>> 2012/11/13 6:17, Yinghai Lu wrote: + nr_range = 0; >>> >>> This is unnecessary since it is set in the below. >>> + nr_range = split_mem_range(mr, nr_range, start, end); >> >> > > Why not use 0 directly? > > nr_range = split_mem_range(mr, 0, start, end); yes, even could remove nr_range from split_mem_range. but originally try to like "really" chopping the code to two parts. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 02/46] x86, mm: Split out split_mem_range from init_memory_mapping
On Mon, Nov 12, 2012 at 11:03 PM, snakky.zh...@gmail.com wrote: On 2012年11月13日 14:20, Yinghai Lu wrote: 2012/11/13 6:17, Yinghai Lu wrote: + nr_range = 0; This is unnecessary since it is set in the below. + nr_range = split_mem_range(mr, nr_range, start, end); Why not use 0 directly? nr_range = split_mem_range(mr, 0, start, end); yes, even could remove nr_range from split_mem_range. but originally try to like really chopping the code to two parts. -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 02/46] x86, mm: Split out split_mem_range from init_memory_mapping
On 2012年11月13日 14:20, Yinghai Lu wrote: On Mon, Nov 12, 2012 at 9:51 PM, Yasuaki Ishimatsu wrote: 2012/11/13 6:17, Yinghai Lu wrote: + nr_range = 0; This is unnecessary since it is set in the below. + nr_range = split_mem_range(mr, nr_range, start, end); Why not use 0 directly? nr_range = split_mem_range(mr, 0, start, end); -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 02/46] x86, mm: Split out split_mem_range from init_memory_mapping
On Mon, Nov 12, 2012 at 9:51 PM, Yasuaki Ishimatsu wrote: > 2012/11/13 6:17, Yinghai Lu wrote: >> + nr_range = 0; > > This is unnecessary since it is set in the below. > >> + nr_range = split_mem_range(mr, nr_range, start, end); -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 02/46] x86, mm: Split out split_mem_range from init_memory_mapping
2012/11/13 6:17, Yinghai Lu wrote: > So make init_memory_mapping smaller and readable. > > Suggested-by: Ingo Molnar > Signed-off-by: Yinghai Lu > Reviewed-by: Pekka Enberg > --- > arch/x86/mm/init.c | 42 ++ > 1 files changed, 26 insertions(+), 16 deletions(-) > > diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c > index aa5b0da..6d8e102 100644 > --- a/arch/x86/mm/init.c > +++ b/arch/x86/mm/init.c > @@ -146,25 +146,13 @@ static int __meminit save_mr(struct map_range *mr, int > nr_range, > return nr_range; > } > > -/* > - * Setup the direct mapping of the physical memory at PAGE_OFFSET. > - * This runs before bootmem is initialized and gets pages directly from > - * the physical memory. To access them they are temporarily mapped. > - */ > -unsigned long __init_refok init_memory_mapping(unsigned long start, > -unsigned long end) > +static int __meminit split_mem_range(struct map_range *mr, int nr_range, > + unsigned long start, > + unsigned long end) > { > unsigned long start_pfn, end_pfn; > - unsigned long ret = 0; > unsigned long pos; > - struct map_range mr[NR_RANGE_MR]; > - int nr_range, i; > - > - printk(KERN_INFO "init_memory_mapping: [mem %#010lx-%#010lx]\n", > -start, end - 1); > - > - memset(mr, 0, sizeof(mr)); > - nr_range = 0; > + int i; > > /* head if not big page alignment ? */ > start_pfn = start >> PAGE_SHIFT; > @@ -258,6 +246,28 @@ unsigned long __init_refok init_memory_mapping(unsigned > long start, > (mr[i].page_size_mask & (1<(mr[i].page_size_mask & (1< > + return nr_range; > +} > + > +/* > + * Setup the direct mapping of the physical memory at PAGE_OFFSET. > + * This runs before bootmem is initialized and gets pages directly from > + * the physical memory. To access them they are temporarily mapped. > + */ > +unsigned long __init_refok init_memory_mapping(unsigned long start, > +unsigned long end) > +{ > + struct map_range mr[NR_RANGE_MR]; > + unsigned long ret = 0; > + int nr_range, i; > + > + pr_info("init_memory_mapping: [mem %#010lx-%#010lx]\n", > +start, end - 1); > + > + memset(mr, 0, sizeof(mr)); > + nr_range = 0; This is unnecessary since it is set in the below. > + nr_range = split_mem_range(mr, nr_range, start, end); Thanks, Yasuaki Ishimatsu > + > /* >* Find space for the kernel direct mapping tables. >* > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 02/46] x86, mm: Split out split_mem_range from init_memory_mapping
So make init_memory_mapping smaller and readable. Suggested-by: Ingo Molnar Signed-off-by: Yinghai Lu Reviewed-by: Pekka Enberg --- arch/x86/mm/init.c | 42 ++ 1 files changed, 26 insertions(+), 16 deletions(-) diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c index aa5b0da..6d8e102 100644 --- a/arch/x86/mm/init.c +++ b/arch/x86/mm/init.c @@ -146,25 +146,13 @@ static int __meminit save_mr(struct map_range *mr, int nr_range, return nr_range; } -/* - * Setup the direct mapping of the physical memory at PAGE_OFFSET. - * This runs before bootmem is initialized and gets pages directly from - * the physical memory. To access them they are temporarily mapped. - */ -unsigned long __init_refok init_memory_mapping(unsigned long start, - unsigned long end) +static int __meminit split_mem_range(struct map_range *mr, int nr_range, +unsigned long start, +unsigned long end) { unsigned long start_pfn, end_pfn; - unsigned long ret = 0; unsigned long pos; - struct map_range mr[NR_RANGE_MR]; - int nr_range, i; - - printk(KERN_INFO "init_memory_mapping: [mem %#010lx-%#010lx]\n", - start, end - 1); - - memset(mr, 0, sizeof(mr)); - nr_range = 0; + int i; /* head if not big page alignment ? */ start_pfn = start >> PAGE_SHIFT; @@ -258,6 +246,28 @@ unsigned long __init_refok init_memory_mapping(unsigned long start, (mr[i].page_size_mask & (1
[PATCH 02/46] x86, mm: Split out split_mem_range from init_memory_mapping
So make init_memory_mapping smaller and readable. Suggested-by: Ingo Molnar mi...@elte.hu Signed-off-by: Yinghai Lu ying...@kernel.org Reviewed-by: Pekka Enberg penb...@kernel.org --- arch/x86/mm/init.c | 42 ++ 1 files changed, 26 insertions(+), 16 deletions(-) diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c index aa5b0da..6d8e102 100644 --- a/arch/x86/mm/init.c +++ b/arch/x86/mm/init.c @@ -146,25 +146,13 @@ static int __meminit save_mr(struct map_range *mr, int nr_range, return nr_range; } -/* - * Setup the direct mapping of the physical memory at PAGE_OFFSET. - * This runs before bootmem is initialized and gets pages directly from - * the physical memory. To access them they are temporarily mapped. - */ -unsigned long __init_refok init_memory_mapping(unsigned long start, - unsigned long end) +static int __meminit split_mem_range(struct map_range *mr, int nr_range, +unsigned long start, +unsigned long end) { unsigned long start_pfn, end_pfn; - unsigned long ret = 0; unsigned long pos; - struct map_range mr[NR_RANGE_MR]; - int nr_range, i; - - printk(KERN_INFO init_memory_mapping: [mem %#010lx-%#010lx]\n, - start, end - 1); - - memset(mr, 0, sizeof(mr)); - nr_range = 0; + int i; /* head if not big page alignment ? */ start_pfn = start PAGE_SHIFT; @@ -258,6 +246,28 @@ unsigned long __init_refok init_memory_mapping(unsigned long start, (mr[i].page_size_mask (1PG_LEVEL_1G))?1G:( (mr[i].page_size_mask (1PG_LEVEL_2M))?2M:4k)); + return nr_range; +} + +/* + * Setup the direct mapping of the physical memory at PAGE_OFFSET. + * This runs before bootmem is initialized and gets pages directly from + * the physical memory. To access them they are temporarily mapped. + */ +unsigned long __init_refok init_memory_mapping(unsigned long start, + unsigned long end) +{ + struct map_range mr[NR_RANGE_MR]; + unsigned long ret = 0; + int nr_range, i; + + pr_info(init_memory_mapping: [mem %#010lx-%#010lx]\n, + start, end - 1); + + memset(mr, 0, sizeof(mr)); + nr_range = 0; + nr_range = split_mem_range(mr, nr_range, start, end); + /* * Find space for the kernel direct mapping tables. * -- 1.7.7 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 02/46] x86, mm: Split out split_mem_range from init_memory_mapping
2012/11/13 6:17, Yinghai Lu wrote: So make init_memory_mapping smaller and readable. Suggested-by: Ingo Molnar mi...@elte.hu Signed-off-by: Yinghai Lu ying...@kernel.org Reviewed-by: Pekka Enberg penb...@kernel.org --- arch/x86/mm/init.c | 42 ++ 1 files changed, 26 insertions(+), 16 deletions(-) diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c index aa5b0da..6d8e102 100644 --- a/arch/x86/mm/init.c +++ b/arch/x86/mm/init.c @@ -146,25 +146,13 @@ static int __meminit save_mr(struct map_range *mr, int nr_range, return nr_range; } -/* - * Setup the direct mapping of the physical memory at PAGE_OFFSET. - * This runs before bootmem is initialized and gets pages directly from - * the physical memory. To access them they are temporarily mapped. - */ -unsigned long __init_refok init_memory_mapping(unsigned long start, -unsigned long end) +static int __meminit split_mem_range(struct map_range *mr, int nr_range, + unsigned long start, + unsigned long end) { unsigned long start_pfn, end_pfn; - unsigned long ret = 0; unsigned long pos; - struct map_range mr[NR_RANGE_MR]; - int nr_range, i; - - printk(KERN_INFO init_memory_mapping: [mem %#010lx-%#010lx]\n, -start, end - 1); - - memset(mr, 0, sizeof(mr)); - nr_range = 0; + int i; /* head if not big page alignment ? */ start_pfn = start PAGE_SHIFT; @@ -258,6 +246,28 @@ unsigned long __init_refok init_memory_mapping(unsigned long start, (mr[i].page_size_mask (1PG_LEVEL_1G))?1G:( (mr[i].page_size_mask (1PG_LEVEL_2M))?2M:4k)); + return nr_range; +} + +/* + * Setup the direct mapping of the physical memory at PAGE_OFFSET. + * This runs before bootmem is initialized and gets pages directly from + * the physical memory. To access them they are temporarily mapped. + */ +unsigned long __init_refok init_memory_mapping(unsigned long start, +unsigned long end) +{ + struct map_range mr[NR_RANGE_MR]; + unsigned long ret = 0; + int nr_range, i; + + pr_info(init_memory_mapping: [mem %#010lx-%#010lx]\n, +start, end - 1); + + memset(mr, 0, sizeof(mr)); + nr_range = 0; This is unnecessary since it is set in the below. + nr_range = split_mem_range(mr, nr_range, start, end); Thanks, Yasuaki Ishimatsu + /* * Find space for the kernel direct mapping tables. * -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 02/46] x86, mm: Split out split_mem_range from init_memory_mapping
On Mon, Nov 12, 2012 at 9:51 PM, Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com wrote: 2012/11/13 6:17, Yinghai Lu wrote: + nr_range = 0; This is unnecessary since it is set in the below. + nr_range = split_mem_range(mr, nr_range, start, end); -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 02/46] x86, mm: Split out split_mem_range from init_memory_mapping
On 2012年11月13日 14:20, Yinghai Lu wrote: On Mon, Nov 12, 2012 at 9:51 PM, Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com wrote: 2012/11/13 6:17, Yinghai Lu wrote: + nr_range = 0; This is unnecessary since it is set in the below. + nr_range = split_mem_range(mr, nr_range, start, end); Why not use 0 directly? nr_range = split_mem_range(mr, 0, start, end); -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/