Skip to contentSkip to conversation

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

PATCH Superseded Julien Grall 2 participants 3 messages Feb 23, 2022

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

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

From: Julien Grall <[email protected]>

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

---
 xen/common/page_alloc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
xen/common/page_alloc.c +3 -2
index e971bf91e0be..72e6cac2365d 100644
@@ -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 )
         {
Signature · 1 line
2.32.0
#1 lore raw
Quoted 15 lines · Julien Grall

From: Julien Grall <[email protected]>

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

---
 xen/common/page_alloc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
xen/common/page_alloc.c +0 -0
index e971bf91e0be..72e6cac2365d 100644

xen/common/page_alloc.c static void free_heap_pages( · line 1442

Quoted 7 lines
xen/common/page_alloc.c +2 -1
@@ -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

Quoted 12 lines
xen/common/page_alloc.c +1 -1
     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 lore raw

Hi,

Quoted 11 lines · Andrew Cooper
Quoted 10 lines · Julien Grall

From: Julien Grall <[email protected]>

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

---
  xen/common/page_alloc.c | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
Quoted 14 lines

xen/common/page_alloc.c static void free_heap_pages( · line 1442

Quoted 12 lines
xen/common/page_alloc.c +2 -1
index e971bf91e0be..72e6cac2365d 100644
@@ -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,

Signature · 1 line
Julien Grall