All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Revert "mm/memblock.c: hardcode the end_pfn being -1"
@ 2018-03-16  2:56 Jia He
  2018-03-16  9:06 ` Michal Hocko
  0 siblings, 1 reply; 4+ messages in thread
From: Jia He @ 2018-03-16  2:56 UTC (permalink / raw)
  To: Andrew Morton, Michal Hocko, linux-mm
  Cc: Catalin Marinas, Pavel Tatashin, Ard Biesheuvel, AKASHI Takahiro,
	Gioh Kim, Daniel Vacek, linux-kernel, Jia He, Jia He

This reverts commit 379b03b7fa05f7db521b7732a52692448a3c34fe.

Commit 864b75f9d6b0 ("mm/page_alloc: fix memmap_init_zone pageblock
alignment") introduced boot hang issues in arm/arm64 machines, so
Ard Biesheuvel reverted in commit 3e04040df6d4. But there is a
preparation patch for commit 864b75f9d6b0. So just revert it for
the sake of caution.

Signed-off-by: Jia He <jia.he@hxt-semitech.com>
---
 mm/memblock.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/mm/memblock.c b/mm/memblock.c
index b6ba6b7..5a9ca2a 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -1107,7 +1107,7 @@ unsigned long __init_memblock memblock_next_valid_pfn(unsigned long pfn,
 	struct memblock_type *type = &memblock.memory;
 	unsigned int right = type->cnt;
 	unsigned int mid, left = 0;
-	phys_addr_t addr = PFN_PHYS(++pfn);
+	phys_addr_t addr = PFN_PHYS(pfn + 1);
 
 	do {
 		mid = (right + left) / 2;
@@ -1118,15 +1118,15 @@ unsigned long __init_memblock memblock_next_valid_pfn(unsigned long pfn,
 				  type->regions[mid].size))
 			left = mid + 1;
 		else {
-			/* addr is within the region, so pfn is valid */
-			return pfn;
+			/* addr is within the region, so pfn + 1 is valid */
+			return min(pfn + 1, max_pfn);
 		}
 	} while (left < right);
 
 	if (right == type->cnt)
-		return -1UL;
+		return max_pfn;
 	else
-		return PHYS_PFN(type->regions[right].base);
+		return min(PHYS_PFN(type->regions[right].base), max_pfn);
 }
 
 /**
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] Revert "mm/memblock.c: hardcode the end_pfn being -1"
  2018-03-16  2:56 [PATCH] Revert "mm/memblock.c: hardcode the end_pfn being -1" Jia He
@ 2018-03-16  9:06 ` Michal Hocko
  2018-03-16  9:26   ` Jia He
  0 siblings, 1 reply; 4+ messages in thread
From: Michal Hocko @ 2018-03-16  9:06 UTC (permalink / raw)
  To: Jia He
  Cc: Andrew Morton, linux-mm, Catalin Marinas, Pavel Tatashin,
	Ard Biesheuvel, AKASHI Takahiro, Gioh Kim, Daniel Vacek,
	linux-kernel, Jia He

On Thu 15-03-18 19:56:06, Jia He wrote:
> This reverts commit 379b03b7fa05f7db521b7732a52692448a3c34fe.
> 
> Commit 864b75f9d6b0 ("mm/page_alloc: fix memmap_init_zone pageblock
> alignment") introduced boot hang issues in arm/arm64 machines, so
> Ard Biesheuvel reverted in commit 3e04040df6d4. But there is a
> preparation patch for commit 864b75f9d6b0. So just revert it for
> the sake of caution.

Why? Is there anything wrong with this one?

> 
> Signed-off-by: Jia He <jia.he@hxt-semitech.com>
> ---
>  mm/memblock.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/mm/memblock.c b/mm/memblock.c
> index b6ba6b7..5a9ca2a 100644
> --- a/mm/memblock.c
> +++ b/mm/memblock.c
> @@ -1107,7 +1107,7 @@ unsigned long __init_memblock memblock_next_valid_pfn(unsigned long pfn,
>  	struct memblock_type *type = &memblock.memory;
>  	unsigned int right = type->cnt;
>  	unsigned int mid, left = 0;
> -	phys_addr_t addr = PFN_PHYS(++pfn);
> +	phys_addr_t addr = PFN_PHYS(pfn + 1);
>  
>  	do {
>  		mid = (right + left) / 2;
> @@ -1118,15 +1118,15 @@ unsigned long __init_memblock memblock_next_valid_pfn(unsigned long pfn,
>  				  type->regions[mid].size))
>  			left = mid + 1;
>  		else {
> -			/* addr is within the region, so pfn is valid */
> -			return pfn;
> +			/* addr is within the region, so pfn + 1 is valid */
> +			return min(pfn + 1, max_pfn);
>  		}
>  	} while (left < right);
>  
>  	if (right == type->cnt)
> -		return -1UL;
> +		return max_pfn;
>  	else
> -		return PHYS_PFN(type->regions[right].base);
> +		return min(PHYS_PFN(type->regions[right].base), max_pfn);
>  }
>  
>  /**
> -- 
> 2.7.4
> 

-- 
Michal Hocko
SUSE Labs

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Revert "mm/memblock.c: hardcode the end_pfn being -1"
  2018-03-16  9:06 ` Michal Hocko
@ 2018-03-16  9:26   ` Jia He
  2018-03-16 10:27     ` Michal Hocko
  0 siblings, 1 reply; 4+ messages in thread
From: Jia He @ 2018-03-16  9:26 UTC (permalink / raw)
  To: Michal Hocko
  Cc: Andrew Morton, linux-mm, Catalin Marinas, Pavel Tatashin,
	Ard Biesheuvel, AKASHI Takahiro, Gioh Kim, Daniel Vacek,
	linux-kernel, Jia He



On 3/16/2018 5:06 PM, Michal Hocko Wrote:
> On Thu 15-03-18 19:56:06, Jia He wrote:
>> This reverts commit 379b03b7fa05f7db521b7732a52692448a3c34fe.
>>
>> Commit 864b75f9d6b0 ("mm/page_alloc: fix memmap_init_zone pageblock
>> alignment") introduced boot hang issues in arm/arm64 machines, so
>> Ard Biesheuvel reverted in commit 3e04040df6d4. But there is a
>> preparation patch for commit 864b75f9d6b0. So just revert it for
>> the sake of caution.
> Why? Is there anything wrong with this one?
I don't think there might be anything wrong. Justin for the sake of caution.
Please ignore this patch if you prefer to keep 379b03b7fa.
But seems parameter *max_pfn* is useless and can be removed in this case?

Cheers,
Jia
>> Signed-off-by: Jia He <jia.he@hxt-semitech.com>
>> ---
>>   mm/memblock.c | 10 +++++-----
>>   1 file changed, 5 insertions(+), 5 deletions(-)
>>
>> diff --git a/mm/memblock.c b/mm/memblock.c
>> index b6ba6b7..5a9ca2a 100644
>> --- a/mm/memblock.c
>> +++ b/mm/memblock.c
>> @@ -1107,7 +1107,7 @@ unsigned long __init_memblock memblock_next_valid_pfn(unsigned long pfn,
>>   	struct memblock_type *type = &memblock.memory;
>>   	unsigned int right = type->cnt;
>>   	unsigned int mid, left = 0;
>> -	phys_addr_t addr = PFN_PHYS(++pfn);
>> +	phys_addr_t addr = PFN_PHYS(pfn + 1);
>>   
>>   	do {
>>   		mid = (right + left) / 2;
>> @@ -1118,15 +1118,15 @@ unsigned long __init_memblock memblock_next_valid_pfn(unsigned long pfn,
>>   				  type->regions[mid].size))
>>   			left = mid + 1;
>>   		else {
>> -			/* addr is within the region, so pfn is valid */
>> -			return pfn;
>> +			/* addr is within the region, so pfn + 1 is valid */
>> +			return min(pfn + 1, max_pfn);
>>   		}
>>   	} while (left < right);
>>   
>>   	if (right == type->cnt)
>> -		return -1UL;
>> +		return max_pfn;
>>   	else
>> -		return PHYS_PFN(type->regions[right].base);
>> +		return min(PHYS_PFN(type->regions[right].base), max_pfn);
>>   }
>>   
>>   /**
>> -- 
>> 2.7.4
>>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Revert "mm/memblock.c: hardcode the end_pfn being -1"
  2018-03-16  9:26   ` Jia He
@ 2018-03-16 10:27     ` Michal Hocko
  0 siblings, 0 replies; 4+ messages in thread
From: Michal Hocko @ 2018-03-16 10:27 UTC (permalink / raw)
  To: Jia He
  Cc: Andrew Morton, linux-mm, Catalin Marinas, Pavel Tatashin,
	Ard Biesheuvel, AKASHI Takahiro, Gioh Kim, Daniel Vacek,
	linux-kernel, Jia He

On Fri 16-03-18 17:26:57, Jia He wrote:
> 
> 
> On 3/16/2018 5:06 PM, Michal Hocko Wrote:
> > On Thu 15-03-18 19:56:06, Jia He wrote:
> > > This reverts commit 379b03b7fa05f7db521b7732a52692448a3c34fe.
> > > 
> > > Commit 864b75f9d6b0 ("mm/page_alloc: fix memmap_init_zone pageblock
> > > alignment") introduced boot hang issues in arm/arm64 machines, so
> > > Ard Biesheuvel reverted in commit 3e04040df6d4. But there is a
> > > preparation patch for commit 864b75f9d6b0. So just revert it for
> > > the sake of caution.
> > Why? Is there anything wrong with this one?
> I don't think there might be anything wrong. Justin for the sake of caution.
> Please ignore this patch if you prefer to keep 379b03b7fa.

We do not revert just if the patch is correct. I do not have strong
preference for the patch but I also do not see anything wrong with it.

> But seems parameter *max_pfn* is useless and can be removed in this case?

A patch for that is already sitting in mmotm tree

> Cheers,
> Jia
> > > Signed-off-by: Jia He <jia.he@hxt-semitech.com>
> > > ---
> > >   mm/memblock.c | 10 +++++-----
> > >   1 file changed, 5 insertions(+), 5 deletions(-)
> > > 
> > > diff --git a/mm/memblock.c b/mm/memblock.c
> > > index b6ba6b7..5a9ca2a 100644
> > > --- a/mm/memblock.c
> > > +++ b/mm/memblock.c
> > > @@ -1107,7 +1107,7 @@ unsigned long __init_memblock memblock_next_valid_pfn(unsigned long pfn,
> > >   	struct memblock_type *type = &memblock.memory;
> > >   	unsigned int right = type->cnt;
> > >   	unsigned int mid, left = 0;
> > > -	phys_addr_t addr = PFN_PHYS(++pfn);
> > > +	phys_addr_t addr = PFN_PHYS(pfn + 1);
> > >   	do {
> > >   		mid = (right + left) / 2;
> > > @@ -1118,15 +1118,15 @@ unsigned long __init_memblock memblock_next_valid_pfn(unsigned long pfn,
> > >   				  type->regions[mid].size))
> > >   			left = mid + 1;
> > >   		else {
> > > -			/* addr is within the region, so pfn is valid */
> > > -			return pfn;
> > > +			/* addr is within the region, so pfn + 1 is valid */
> > > +			return min(pfn + 1, max_pfn);
> > >   		}
> > >   	} while (left < right);
> > >   	if (right == type->cnt)
> > > -		return -1UL;
> > > +		return max_pfn;
> > >   	else
> > > -		return PHYS_PFN(type->regions[right].base);
> > > +		return min(PHYS_PFN(type->regions[right].base), max_pfn);
> > >   }
> > >   /**
> > > -- 
> > > 2.7.4
> > > 

-- 
Michal Hocko
SUSE Labs

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-03-16 10:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-16  2:56 [PATCH] Revert "mm/memblock.c: hardcode the end_pfn being -1" Jia He
2018-03-16  9:06 ` Michal Hocko
2018-03-16  9:26   ` Jia He
2018-03-16 10:27     ` Michal Hocko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.