Skip to contentSkip to conversation

Low mem virq incremental adjustments

PATCH In review Andres Lagar-Cavilla 4 participants 6 messages Mar 7, 2012 – Mar 9, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Low mem virq incremental adjustments

 .gitignore              |  1 +
 xen/common/page_alloc.c |  7 +++++--
 2 files changed, 6 insertions(+), 2 deletions(-)

Consider tmem before firing the virq.

Add .gitignore rune.

.gitignore +1 -0
diff -r f7ce6d26635c -r 5651945c7a74 .gitignore
@@ -197,6 +197,7 @@ tools/misc/xen-hvmctx
 tools/misc/gtraceview
 tools/misc/gtracestat
 tools/misc/xenlockprof
+tools/misc/lowmemd
 tools/pygrub/build/*
 tools/python/build/*
 tools/python/xen/util/path.py
xen/common/page_alloc.c +5 -2
diff -r f7ce6d26635c -r 5651945c7a74 xen/common/page_alloc.c
@@ -377,7 +377,10 @@ static void __init setup_low_mem_virq(vo
 
 static void check_low_mem_virq(void)
 {
-    if ( unlikely(total_avail_pages <= low_mem_virq_th) )
+    unsigned long avail_pages = total_avail_pages +
+                (opt_tmem) ? tmem_freeable_pages(): 0;
+
+    if ( unlikely(avail_pages <= low_mem_virq_th) )
     {
         send_global_virq(VIRQ_ENOMEM);
 
@@ -391,7 +394,7 @@ static void check_low_mem_virq(void)
         return;
     }
 
-    if ( unlikely(total_avail_pages >= low_mem_virq_high) )
+    if ( unlikely(avail_pages >= low_mem_virq_high) )
     {
         /* Reset hysteresis. Bring threshold up one order.
          * If we are back where originally set, set high
#1 lore raw

xen/common/page_alloc.c static void __init setup_low_mem_virq(vo · line 381

Quoted 10 lines
Quoted 1 line
Quoted 1 line · Andres Lagar-Cavilla
xen/common/page_alloc.c +2 -1
@@ -377,7 +377,10 @@ static void __init setup_low_mem_virq(vo
 
 static void check_low_mem_virq(void)
 {
-    if ( unlikely(total_avail_pages <= low_mem_virq_th) )
+    unsigned long avail_pages = total_avail_pages +
+                (opt_tmem) ? tmem_freeable_pages(): 0;

Can tmem_freeable_pages() return anything other than zero when opt_tmem is zero? (I.e. is the [improperly parenthesized!] conditional expression necessary at all?)

Jan

Quoted 14 lines
xen/common/page_alloc.c +3 -1
+
+    if ( unlikely(avail_pages <= low_mem_virq_th) )
     {
         send_global_virq(VIRQ_ENOMEM);
 
@@ -391,7 +394,7 @@ static void check_low_mem_virq(void)
         return;
     }
 
-    if ( unlikely(total_avail_pages >= low_mem_virq_high) )
+    if ( unlikely(avail_pages >= low_mem_virq_high) )
     {
         /* Reset hysteresis. Bring threshold up one order.
          * If we are back where originally set, set high
#2 lore raw
Quoted 6 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line

On 07.03.12 at 17:15, Andres Lagar-Cavilla <[email protected]>

Quoted 4 lines · wrote:
xen/common/page_alloc.c +0 -0
@@ -377,7 +377,10 @@ static void __init setup_low_mem_virq(vo
 
Quoted 9 lines

xen/common/page_alloc.c static void __init setup_low_mem_virq(vo · line 381

Quoted 5 lines
xen/common/page_alloc.c +2 -1
 static void check_low_mem_virq(void)
 {
-    if ( unlikely(total_avail_pages <= low_mem_virq_th) )
+    unsigned long avail_pages = total_avail_pages +
+                (opt_tmem) ? tmem_freeable_pages(): 0;

Can tmem_freeable_pages() return anything other than zero when opt_tmem is zero? (I.e. is the [improperly parenthesized!] conditional expression necessary at all?)

I'm not sure. I'll let Dan take it from here, as he surely knows the right way. He acked it the way it is.
Andres

Quoted 21 lines

Jan

Quoted 14 lines
xen/common/page_alloc.c +3 -1
+
+    if ( unlikely(avail_pages <= low_mem_virq_th) )
     {
         send_global_virq(VIRQ_ENOMEM);
 
@@ -391,7 +394,7 @@ static void check_low_mem_virq(void)
         return;
     }
 
-    if ( unlikely(total_avail_pages >= low_mem_virq_high) )
+    if ( unlikely(avail_pages >= low_mem_virq_high) )
     {
         /* Reset hysteresis. Bring threshold up one order.
          * If we are back where originally set, set high
#3 lore raw
Quoted 23 lines

From: Andres Lagar-Cavilla [mailto:[email protected]]
Sent: Wednesday, March 07, 2012 11:12 AM
To: Jan Beulich
Cc: Dan Magenheimer; [email protected]; [email protected]; [email protected]; [email protected]; xen-devel; [email protected]
Subject: Re: [PATCH] Low mem virq incremental adjustments

Quoted 6 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line

On 07.03.12 at 17:15, Andres Lagar-Cavilla <[email protected]>

Quoted 4 lines · wrote:
xen/common/page_alloc.c +0 -0
@@ -377,7 +377,10 @@ static void __init setup_low_mem_virq(vo
 
Quoted 9 lines

xen/common/page_alloc.c static void __init setup_low_mem_virq(vo · line 381

Quoted 5 lines
xen/common/page_alloc.c +2 -1
 static void check_low_mem_virq(void)
 {
-    if ( unlikely(total_avail_pages <= low_mem_virq_th) )
+    unsigned long avail_pages = total_avail_pages +
+                (opt_tmem) ? tmem_freeable_pages(): 0;

Can tmem_freeable_pages() return anything other than zero when opt_tmem is zero? (I.e. is the [improperly parenthesized!] conditional expression necessary at all?)

Quoted 3 lines

I'm not sure. I'll let Dan take it from here, as he surely knows the right way. He acked it the way it is.
Andres

Both would be correct (other than the parentheses).

I was also going to make the same comment about tmem_freeable_pages() but decided the way Andres coded it is clearer because it doesn't assume anything about tmem; if tmem is enabled, it uses an abstract interface this code doesn't need to know anything about.

Anyway, either way is fine with me.

Dan

#4 lore raw
Quoted 29 lines
Quoted 5 lines
Quoted 1 line · Dan Magenheimer

From: Andres Lagar-Cavilla [mailto:[email protected]]
Sent: Wednesday, March 07, 2012 11:12 AM
To: Jan Beulich
Cc: Dan Magenheimer; [email protected]; [email protected];

[email protected];

Quoted 19 lines

[email protected]; xen-devel; [email protected]
Subject: Re: [PATCH] Low mem virq incremental adjustments

Quoted 6 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line

On 07.03.12 at 17:15, Andres Lagar-Cavilla <[email protected]>

Quoted 4 lines · wrote:
xen/common/page_alloc.c +0 -0
@@ -377,7 +377,10 @@ static void __init setup_low_mem_virq(vo
 
Quoted 9 lines

xen/common/page_alloc.c static void __init setup_low_mem_virq(vo · line 381

Quoted 5 lines
xen/common/page_alloc.c +2 -1
 static void check_low_mem_virq(void)
 {
-    if ( unlikely(total_avail_pages <= low_mem_virq_th) )
+    unsigned long avail_pages = total_avail_pages +
+                (opt_tmem) ? tmem_freeable_pages(): 0;

Can tmem_freeable_pages() return anything other than zero when opt_tmem is zero? (I.e. is the [improperly parenthesized!] conditional expression necessary at all?)

Quoted 3 lines

I'm not sure. I'll let Dan take it from here, as he surely knows the right way. He acked it the way it is.
Andres

Quoted 8 lines

Both would be correct (other than the parentheses).

I was also going to make the same comment about tmem_freeable_pages() but decided the way Andres coded it is clearer because it doesn't assume anything about tmem; if tmem is enabled, it uses an abstract interface this code doesn't need to know anything about.

Anyway, either way is fine with me.

So I take it that you'll be submitting a fix at least for the parentheses issue.

Jan

#5 lore raw
Quoted 36 lines · Jan Beulich
Quoted 36 lines
Quoted 5 lines
Quoted 1 line · Dan Magenheimer

From: Andres Lagar-Cavilla [mailto:[email protected]]
Sent: Wednesday, March 07, 2012 11:12 AM
To: Jan Beulich
Cc: Dan Magenheimer; [email protected]; [email protected];

[email protected];

Quoted 19 lines

[email protected]; xen-devel; [email protected]
Subject: Re: [PATCH] Low mem virq incremental adjustments

Quoted 6 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line

On 07.03.12 at 17:15, Andres Lagar-Cavilla <[email protected]>

Quoted 4 lines · wrote:
xen/common/page_alloc.c +0 -0
@@ -377,7 +377,10 @@ static void __init setup_low_mem_virq(vo
 
Quoted 9 lines

xen/common/page_alloc.c static void __init setup_low_mem_virq(vo · line 381

Quoted 5 lines
xen/common/page_alloc.c +2 -1
 static void check_low_mem_virq(void)
 {
-    if ( unlikely(total_avail_pages <= low_mem_virq_th) )
+    unsigned long avail_pages = total_avail_pages +
+                (opt_tmem) ? tmem_freeable_pages(): 0;

Can tmem_freeable_pages() return anything other than zero when opt_tmem is zero? (I.e. is the [improperly parenthesized!] conditional expression necessary at all?)

Quoted 3 lines

I'm not sure. I'll let Dan take it from here, as he surely knows the right way. He acked it the way it is.
Andres

Both would be correct (other than the parentheses).

I was also going to make the same comment about tmem_freeable_pages() but decided the way Andres coded it is clearer because it doesn't assume anything about tmem; if tmem is enabled, it uses an abstract interface this code doesn't need to know anything about.

Quoted 4 lines
Quoted 1 line

Anyway, either way is fine with me.

So I take it that you'll be submitting a fix at least for the parentheses issue.

Ugh, I checked it in removing the unnecessary parentheses, but didn't add the required ones around the ternary operator. I'll fix that now.

-- Keir

Quoted 7 lines

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel