diff mbox

x86/mm: silence a pointless warning

Message ID 5908BECC0200007800155EE5@prv-mh.provo.novell.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jan Beulich May 2, 2017, 3:15 p.m. UTC
get_page() logs a message when it fails (dom_cow is never dying or
paging_mode_external()), so better avoid the call when it's pointless
to do anyway.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
Possibly we could be even more rigid and bail right away if ->is_dying
is set.
x86/mm: silence a pointless warning

get_page() logs a message when it fails (dom_cow is never dying or
paging_mode_external()), so better avoid the call when it's pointless
to do anyway.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
Possibly we could be even more rigid and bail right away if ->is_dying
is set.

--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -501,9 +501,9 @@ struct page_info *get_page_from_gfn_p2m(
                 if ( fdom == NULL )
                     page = NULL;
             }
-            else if ( !get_page(page, d)
+            else if ( !get_page(page, d) &&
                       /* Page could be shared */
-                      && !get_page(page, dom_cow) )
+                      (!p2m_is_shared(*t) || !get_page(page, dom_cow)) )
                 page = NULL;
         }
         p2m_read_unlock(p2m);

Comments

George Dunlap May 2, 2017, 5:04 p.m. UTC | #1
On 02/05/17 16:15, Jan Beulich wrote:
> get_page() logs a message when it fails (dom_cow is never dying or
> paging_mode_external()), so better avoid the call when it's pointless
> to do anyway.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

The other option would be to add "domain == dom_cow" as a condition for
which get_page() doesn't report an error.

But on the whole I think this is probably the better option:

Acked-by: George Dunlap <george.dunlap@citrix.com>
Jan Beulich May 3, 2017, 7:31 a.m. UTC | #2
>>> On 02.05.17 at 19:04, <george.dunlap@citrix.com> wrote:
> On 02/05/17 16:15, Jan Beulich wrote:
>> get_page() logs a message when it fails (dom_cow is never dying or
>> paging_mode_external()), so better avoid the call when it's pointless
>> to do anyway.
>> 
>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> 
> The other option would be to add "domain == dom_cow" as a condition for
> which get_page() doesn't report an error.

That would imo be undesirable namely for the currently one case
where get_page(..., dom_cow) is being used from mem_sharing.c.

> But on the whole I think this is probably the better option:
> 
> Acked-by: George Dunlap <george.dunlap@citrix.com>

Thanks.

Jan
diff mbox

Patch

--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -501,9 +501,9 @@  struct page_info *get_page_from_gfn_p2m(
                 if ( fdom == NULL )
                     page = NULL;
             }
-            else if ( !get_page(page, d)
+            else if ( !get_page(page, d) &&
                       /* Page could be shared */
-                      && !get_page(page, dom_cow) )
+                      (!p2m_is_shared(*t) || !get_page(page, dom_cow)) )
                 page = NULL;
         }
         p2m_read_unlock(p2m);