[PATCH] xen/mm: pg_offlined can be defined as bool in free_heap_pages()

Julien Grall posted 1 patch 2 years, 2 months ago
Failed in applying to current master (apply log)
There is a newer version of this series
xen/common/page_alloc.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
[PATCH] xen/mm: pg_offlined can be defined as bool in free_heap_pages()
Posted by Julien Grall 2 years, 2 months ago
From: Julien Grall <jgrall@amazon.com>

The local variable pg_offlined in free_heap_pages() can only take two
values. So switch it to a bool.

Signed-off-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/page_alloc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index e971bf91e0be..72e6cac2365d 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -1437,8 +1437,9 @@ static void free_heap_pages(
 {
     unsigned long mask;
     mfn_t mfn = page_to_mfn(pg);
-    unsigned int i, node = phys_to_nid(mfn_to_maddr(mfn)), pg_offlined = 0;
+    unsigned int i, node = phys_to_nid(mfn_to_maddr(mfn));
     unsigned int zone = page_to_zone(pg);
+    bool pg_offlined = true;
 
     ASSERT(order <= MAX_ORDER);
 
@@ -1447,7 +1448,7 @@ static void free_heap_pages(
     for ( i = 0; i < (1 << order); i++ )
     {
         if ( mark_page_free(&pg[i], mfn_add(mfn, i)) )
-            pg_offlined = 1;
+            pg_offlined = true;
 
         if ( need_scrub )
         {
-- 
2.32.0


Re: [PATCH] xen/mm: pg_offlined can be defined as bool in free_heap_pages()
Posted by Andrew Cooper 2 years, 2 months ago
On 23/02/2022 18:41, Julien Grall wrote:
> From: Julien Grall <jgrall@amazon.com>
>
> The local variable pg_offlined in free_heap_pages() can only take two
> values. So switch it to a bool.
>
> Signed-off-by: Julien Grall <jgrall@amazon.com>
> ---
>  xen/common/page_alloc.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
> index e971bf91e0be..72e6cac2365d 100644
> --- a/xen/common/page_alloc.c
> +++ b/xen/common/page_alloc.c
> @@ -1437,8 +1437,9 @@ static void free_heap_pages(
>  {
>      unsigned long mask;
>      mfn_t mfn = page_to_mfn(pg);
> -    unsigned int i, node = phys_to_nid(mfn_to_maddr(mfn)), pg_offlined = 0;
> +    unsigned int i, node = phys_to_nid(mfn_to_maddr(mfn));
>      unsigned int zone = page_to_zone(pg);
> +    bool pg_offlined = true;

= false ?

~Andrew

>  
>      ASSERT(order <= MAX_ORDER);
>  
> @@ -1447,7 +1448,7 @@ static void free_heap_pages(
>      for ( i = 0; i < (1 << order); i++ )
>      {
>          if ( mark_page_free(&pg[i], mfn_add(mfn, i)) )
> -            pg_offlined = 1;
> +            pg_offlined = true;
>  
>          if ( need_scrub )
>          {


Re: [PATCH] xen/mm: pg_offlined can be defined as bool in free_heap_pages()
Posted by Julien Grall 2 years, 2 months ago
Hi,

On 23/02/2022 19:03, Andrew Cooper wrote:
> On 23/02/2022 18:41, Julien Grall wrote:
>> From: Julien Grall <jgrall@amazon.com>
>>
>> The local variable pg_offlined in free_heap_pages() can only take two
>> values. So switch it to a bool.
>>
>> Signed-off-by: Julien Grall <jgrall@amazon.com>
>> ---
>>   xen/common/page_alloc.c | 5 +++--
>>   1 file changed, 3 insertions(+), 2 deletions(-)
>>
>> diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
>> index e971bf91e0be..72e6cac2365d 100644
>> --- a/xen/common/page_alloc.c
>> +++ b/xen/common/page_alloc.c
>> @@ -1437,8 +1437,9 @@ static void free_heap_pages(
>>   {
>>       unsigned long mask;
>>       mfn_t mfn = page_to_mfn(pg);
>> -    unsigned int i, node = phys_to_nid(mfn_to_maddr(mfn)), pg_offlined = 0;
>> +    unsigned int i, node = phys_to_nid(mfn_to_maddr(mfn));
>>       unsigned int zone = page_to_zone(pg);
>> +    bool pg_offlined = true;
> 
> = false ?

Whoops. Yes.

I will resend the patch.

Cheers,

-- 
Julien Grall