Skip to contentSkip to conversation

x86/mm: use put_page_type_preemptible in put_page_from_l{3, 4}e

PATCH In review Wei Liu 3 participants 6 messages Sep 4, 2017

lore
Share & tools
lore

Wei Liu

author
#0 lore raw

PATCH 1/1 x86/mm: use put_page_type_preemptible in put_page_from_l{3, 4}e

No functional change.

---
Cc: Jan Beulich <[email protected]>
Cc: Andrew Cooper <[email protected]>
Cc: George Dunlap <[email protected]>

---
 xen/arch/x86/mm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
xen/arch/x86/mm.c +2 -2
index e5b0cceae4..314da84720 100644
@@ -1376,7 +1376,7 @@ static int put_page_from_l3e(l3_pgentry_t l3e, unsigned long pfn,
     if ( unlikely(partial > 0) )
     {
         ASSERT(!defer);
-        return __put_page_type(pg, 1);
+        return put_page_type_preemptible(pg);
     }
 
     if ( defer )
@@ -1399,7 +1399,7 @@ static int put_page_from_l4e(l4_pgentry_t l4e, unsigned long pfn,
         if ( unlikely(partial > 0) )
         {
             ASSERT(!defer);
-            return __put_page_type(pg, 1);
+            return put_page_type_preemptible(pg);
         }
 
         if ( defer )
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
author
#1 lore raw

xen/arch/x86/mm.c

Quoted 15 lines · Wei Liu

No functional change.

---
Cc: Jan Beulich <[email protected]>
Cc: Andrew Cooper <[email protected]>
Cc: George Dunlap <[email protected]>

---
 xen/arch/x86/mm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
xen/arch/x86/mm.c +0 -0
index e5b0cceae4..314da84720 100644

In fact the forward declaration for __put_page_type here can also be deleted.

Quoted 21 lines
xen/arch/x86/mm.c +2 -2
@@ -1376,7 +1376,7 @@ static int put_page_from_l3e(l3_pgentry_t l3e, unsigned long pfn,
     if ( unlikely(partial > 0) )
     {
         ASSERT(!defer);
-        return __put_page_type(pg, 1);
+        return put_page_type_preemptible(pg);
     }
 
     if ( defer )
@@ -1399,7 +1399,7 @@ static int put_page_from_l4e(l4_pgentry_t l4e, unsigned long pfn,
         if ( unlikely(partial > 0) )
         {
             ASSERT(!defer);
-            return __put_page_type(pg, 1);
+            return put_page_type_preemptible(pg);
         }
 
         if ( defer )
Signature · 1 line
2.11.0

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

#2 lore raw
Quoted 12 lines · Wei Liu
Quoted 11 lines · Wei Liu

No functional change.

---
Cc: Jan Beulich <[email protected]>
Cc: Andrew Cooper <[email protected]>
Cc: George Dunlap <[email protected]>

---
 xen/arch/x86/mm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 6 lines

xen/arch/x86/mm.c

Quoted 4 lines
xen/arch/x86/mm.c +0 -0
index e5b0cceae4..314da84720 100644

In fact the forward declaration for __put_page_type here can also be deleted.

With this done, Reviewed-by: Andrew Cooper <[email protected]>

Quoted 17 lines
Quoted 17 lines
xen/arch/x86/mm.c +2 -2
@@ -1376,7 +1376,7 @@ static int put_page_from_l3e(l3_pgentry_t l3e, unsigned long pfn,
     if ( unlikely(partial > 0) )
     {
         ASSERT(!defer);
-        return __put_page_type(pg, 1);
+        return put_page_type_preemptible(pg);
     }
 
     if ( defer )
@@ -1399,7 +1399,7 @@ static int put_page_from_l4e(l4_pgentry_t l4e, unsigned long pfn,
         if ( unlikely(partial > 0) )
         {
             ASSERT(!defer);
-            return __put_page_type(pg, 1);
+            return put_page_type_preemptible(pg);
         }
 
Quoted 4 lines
Quoted 4 lines
xen/arch/x86/mm.c +0 -0
         if ( defer )
Signature · 1 line
2.11.0

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

#3 lore raw
In reply to Wei Liu
Quoted 13 lines
Quoted 1 line
Quoted 1 line · On 04.09.17 at 13:42, <[email protected]> wrote:
xen/arch/x86/mm.c +1 -1
@@ -1376,7 +1376,7 @@ static int put_page_from_l3e(l3_pgentry_t l3e, unsigned long pfn,
     if ( unlikely(partial > 0) )
     {
         ASSERT(!defer);
-        return __put_page_type(pg, 1);
+        return put_page_type_preemptible(pg);
     }
 
     if ( defer )

xen/arch/x86/mm.c static int put_page_from_l4e(l4_pgentry_t l4e, unsigned long pfn, · line 1403

Quoted 6 lines
xen/arch/x86/mm.c +1 -1
@@ -1399,7 +1399,7 @@ static int put_page_from_l4e(l4_pgentry_t l4e, unsigned long pfn,
         if ( unlikely(partial > 0) )
         {
             ASSERT(!defer);
-            return __put_page_type(pg, 1);
+            return put_page_type_preemptible(pg);
         }

Is this really a good idea? put_page_type_preemptible() is just a thin wrapper around __put_page_type(), so that the latter can remain private to mm.c. By going through the wrapper you add another branch into a path that I would guess isn't executed frequently enough for its constituents to remain in the uops cache, but possibly frequently enough for the extra branch to matter. Otoh I see we use get_page_type_preemptible() in mm.c too in two places (albeit that one also has an extra ASSERT())...

Bottom line - since you've got Andrew's approval, I don't mean to outright object to the change, but I like this extra aspect to be taken into account before deciding whether to really put it in.

Jan

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

author
#4 lore raw
Quoted 20 lines · Jan Beulich
Quoted 13 lines
Quoted 1 line
Quoted 1 line · On 04.09.17 at 13:42, <[email protected]> wrote:
xen/arch/x86/mm.c +1 -1
@@ -1376,7 +1376,7 @@ static int put_page_from_l3e(l3_pgentry_t l3e, unsigned long pfn,
     if ( unlikely(partial > 0) )
     {
         ASSERT(!defer);
-        return __put_page_type(pg, 1);
+        return put_page_type_preemptible(pg);
     }
 
     if ( defer )

xen/arch/x86/mm.c static int put_page_from_l4e(l4_pgentry_t l4e, unsigned long pfn, · line 1403

Quoted 6 lines
xen/arch/x86/mm.c +1 -1
@@ -1399,7 +1399,7 @@ static int put_page_from_l4e(l4_pgentry_t l4e, unsigned long pfn,
         if ( unlikely(partial > 0) )
         {
             ASSERT(!defer);
-            return __put_page_type(pg, 1);
+            return put_page_type_preemptible(pg);
         }
Quoted 9 lines

Is this really a good idea? put_page_type_preemptible() is just a thin wrapper around __put_page_type(), so that the latter can remain private to mm.c. By going through the wrapper you add another branch into a path that I would guess isn't executed frequently enough for its constituents to remain in the uops cache, but possibly frequently enough for the extra branch to matter. Otoh I see we use get_page_type_preemptible() in mm.c too in two places (albeit that one also has an extra ASSERT())...

This patch is taken from my mm.c refactoring series.

Like you said, __put_page_type should remain private to mm.c. By making this change I can move put_page_from_l{2,3,4}e to pv/mm.c and leave __put_page_type in mm.c. Is this a good enough reason for you?

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

#5 lore raw
Quoted 34 lines
Quoted 1 line
Quoted 1 line · On 04.09.17 at 15:13, <[email protected]> wrote:
Quoted 4 lines · Jan Beulich

xen/arch/x86/mm.c static int put_page_from_l3e(l3_pgentry_t l3e,

Quoted 4 lines
Quoted 1 line
Quoted 1 line · On 04.09.17 at 13:42, <[email protected]> wrote:
xen/arch/x86/mm.c +0 -0
@@ -1376,7 +1376,7 @@ static int put_page_from_l3e(l3_pgentry_t l3e, 

unsigned long pfn,

Quoted 9 lines

xen/arch/x86/mm.c static int put_page_from_l4e(l4_pgentry_t l4e,

Quoted 9 lines
xen/arch/x86/mm.c +1 -1
     if ( unlikely(partial > 0) )
     {
         ASSERT(!defer);
-        return __put_page_type(pg, 1);
+        return put_page_type_preemptible(pg);
     }
 
     if ( defer )
@@ -1399,7 +1399,7 @@ static int put_page_from_l4e(l4_pgentry_t l4e, 

unsigned long pfn,

Quoted 7 lines

xen/arch/x86/mm.c static int put_page_from_l3e(l3_pgentry_t l3e, unsigned long pfn, · line 1380

Quoted 6 lines
xen/arch/x86/mm.c +1 -1
         if ( unlikely(partial > 0) )
         {
             ASSERT(!defer);
-            return __put_page_type(pg, 1);
+            return put_page_type_preemptible(pg);
         }
Quoted 9 lines

Is this really a good idea? put_page_type_preemptible() is just a thin wrapper around __put_page_type(), so that the latter can remain private to mm.c. By going through the wrapper you add another branch into a path that I would guess isn't executed frequently enough for its constituents to remain in the uops cache, but possibly frequently enough for the extra branch to matter. Otoh I see we use get_page_type_preemptible() in mm.c too in two places (albeit that one also has an extra ASSERT())...

Quoted 5 lines

This patch is taken from my mm.c refactoring series.

Like you said, __put_page_type should remain private to mm.c. By making this change I can move put_page_from_l{2,3,4}e to pv/mm.c and leave __put_page_type in mm.c. Is this a good enough reason for you?

Ah, I see, that's fine then.

Jan

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