2013-03-18 11:11:48

by Lin Feng

[permalink] [raw]
Subject: [PATCH] x86: mm: add_pfn_range_mapped: use meaningful index to teach clean_sort_range()

Since add_range_with_merge() return the max none zero element of the array, it's
suffice to use it to instruct clean_sort_range() to do the sort. Or the former
assignment by add_range_with_merge() is nonsense because clean_sort_range()
will produce a accurate number of the sorted array and it never depends on
nr_pfn_mapped.

Cc: Jacob Shin <[email protected]>
Cc: Yinghai Lu <[email protected]>
Signed-off-by: Lin Feng <[email protected]>
---
arch/x86/mm/init.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c
index 59b7fc4..55ae904 100644
--- a/arch/x86/mm/init.c
+++ b/arch/x86/mm/init.c
@@ -310,7 +310,7 @@ static void add_pfn_range_mapped(unsigned long start_pfn, unsigned long end_pfn)
{
nr_pfn_mapped = add_range_with_merge(pfn_mapped, E820_X_MAX,
nr_pfn_mapped, start_pfn, end_pfn);
- nr_pfn_mapped = clean_sort_range(pfn_mapped, E820_X_MAX);
+ nr_pfn_mapped = clean_sort_range(pfn_mapped, nr_pfn_mapped);

max_pfn_mapped = max(max_pfn_mapped, end_pfn);

--
1.8.0.1


2013-03-18 18:52:54

by Yinghai Lu

[permalink] [raw]
Subject: Re: [PATCH] x86: mm: add_pfn_range_mapped: use meaningful index to teach clean_sort_range()

On Mon, Mar 18, 2013 at 3:21 AM, Lin Feng <[email protected]> wrote:
> Since add_range_with_merge() return the max none zero element of the array, it's
> suffice to use it to instruct clean_sort_range() to do the sort. Or the former
> assignment by add_range_with_merge() is nonsense because clean_sort_range()
> will produce a accurate number of the sorted array and it never depends on
> nr_pfn_mapped.
>
> Cc: Jacob Shin <[email protected]>
> Cc: Yinghai Lu <[email protected]>
> Signed-off-by: Lin Feng <[email protected]>
> ---
> arch/x86/mm/init.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c
> index 59b7fc4..55ae904 100644
> --- a/arch/x86/mm/init.c
> +++ b/arch/x86/mm/init.c
> @@ -310,7 +310,7 @@ static void add_pfn_range_mapped(unsigned long start_pfn, unsigned long end_pfn)
> {
> nr_pfn_mapped = add_range_with_merge(pfn_mapped, E820_X_MAX,
> nr_pfn_mapped, start_pfn, end_pfn);
> - nr_pfn_mapped = clean_sort_range(pfn_mapped, E820_X_MAX);
> + nr_pfn_mapped = clean_sort_range(pfn_mapped, nr_pfn_mapped);
>
> max_pfn_mapped = max(max_pfn_mapped, end_pfn);>

Acked-by: Yinghai Lu <[email protected]>

2013-03-25 09:10:58

by Lin Feng

[permalink] [raw]
Subject: Re: [PATCH] x86: mm: add_pfn_range_mapped: use meaningful index to teach clean_sort_range()

Hi Andrew,

On 03/19/2013 02:52 AM, Yinghai Lu wrote:
> On Mon, Mar 18, 2013 at 3:21 AM, Lin Feng <[email protected]> wrote:
>> Since add_range_with_merge() return the max none zero element of the array, it's
>> suffice to use it to instruct clean_sort_range() to do the sort. Or the former
>> assignment by add_range_with_merge() is nonsense because clean_sort_range()
>> will produce a accurate number of the sorted array and it never depends on
>> nr_pfn_mapped.
>>
>> Cc: Jacob Shin <[email protected]>
>> Cc: Yinghai Lu <[email protected]>
>> Signed-off-by: Lin Feng <[email protected]>
>> ---
>> arch/x86/mm/init.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c
>> index 59b7fc4..55ae904 100644
>> --- a/arch/x86/mm/init.c
>> +++ b/arch/x86/mm/init.c
>> @@ -310,7 +310,7 @@ static void add_pfn_range_mapped(unsigned long start_pfn, unsigned long end_pfn)
>> {
>> nr_pfn_mapped = add_range_with_merge(pfn_mapped, E820_X_MAX,
>> nr_pfn_mapped, start_pfn, end_pfn);
>> - nr_pfn_mapped = clean_sort_range(pfn_mapped, E820_X_MAX);
>> + nr_pfn_mapped = clean_sort_range(pfn_mapped, nr_pfn_mapped);
>>
>> max_pfn_mapped = max(max_pfn_mapped, end_pfn);>
>
> Acked-by: Yinghai Lu <[email protected]>

Do we need to pick up this patch?

thanks,
linfeng