|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 1 of 2] Allow decrease_reservation to be preempted if remove_page returns negative
xen/common/memory.c | 29 ++++++++++++++++++++++++++++-
1 files changed, 28 insertions(+), 1 deletions(-)
This will allow for handling of full paging rings in a more graceful manner.
ATM, remove_page does not return negative values, so this code is not yet
exercised.
Signed-off-by: Andres Lagar-Cavilla <andres@xxxxxxxxxxxxxxxx>
diff -r 790cd814bee8 -r 4c4a9ed0728c xen/common/memory.c
--- a/xen/common/memory.c
+++ b/xen/common/memory.c
@@ -226,6 +226,8 @@ static void decrease_reservation(struct
for ( i = a->nr_done; i < a->nr_extents; i++ )
{
+ int one_remove_succeeded = 0;
+
if ( hypercall_preempt_check() )
{
a->preempted = 1;
@@ -255,8 +257,33 @@ static void decrease_reservation(struct
continue;
for ( j = 0; j < (1 << a->extent_order); j++ )
- if ( !guest_remove_page(a->domain, gmfn + j) )
+ {
+ int rv = guest_remove_page(a->domain, gmfn + j);
+ /* negative rv is a result of a mem event ring full
+ * in the presence of paging. We preempt the hypercall */
+ if ( rv < 0 )
+ {
+ /* Indicate we're done with this extent */
+ if ((j+1) == (1 << a->extent_order))
+ i++;
+ a->preempted = 1;
+ raise_softirq(SCHEDULE_SOFTIRQ);
goto out;
+ }
+ /* rv of zero means we tried to remove a gfn with no backing
+ * mfn. It can be a bad argument, or, a continuation in the midst
+ * of an extent. Heuristically determine second case. */
+ if ( !rv )
+ {
+ /* Has to be first extent */
+ if ( i != a->nr_done )
+ goto out;
+ /* No previous remove in this extent must have succeeded */
+ if ( one_remove_succeeded )
+ goto out;
+ } else
+ one_remove_succeeded = 1;
+ }
}
out:
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |