Add a new option to mem_event_check_ring() to disable the
vcpu_sleep_nosync. This is needed for an upcoming patch which sends a
one-way request to the pager.
Also add a micro-optimization, check ring_full first because its value
was just evaluated.
Signed-off-by: Olaf Hering <olaf@xxxxxxxxx>
---
xen/arch/x86/mm/mem_event.c | 4 ++--
xen/arch/x86/mm/mem_sharing.c | 2 +-
xen/arch/x86/mm/p2m.c | 2 +-
xen/include/asm-x86/mem_event.h | 2 +-
4 files changed, 5 insertions(+), 5 deletions(-)
--- xen-unstable.hg-4.1.22459.orig/xen/arch/x86/mm/mem_event.c
+++ xen-unstable.hg-4.1.22459/xen/arch/x86/mm/mem_event.c
@@ -143,7 +143,7 @@ void mem_event_unpause_vcpus(struct doma
vcpu_wake(v);
}
-int mem_event_check_ring(struct domain *d)
+int mem_event_check_ring(struct domain *d, int do_vcpu_sleep)
{
struct vcpu *curr = current;
int free_requests;
@@ -159,7 +159,7 @@ int mem_event_check_ring(struct domain *
}
ring_full = free_requests < MEM_EVENT_RING_THRESHOLD;
- if ( (curr->domain->domain_id == d->domain_id) && ring_full )
+ if ( ring_full && do_vcpu_sleep && (curr->domain->domain_id ==
d->domain_id) )
{
set_bit(_VPF_mem_event, &curr->pause_flags);
vcpu_sleep_nosync(curr);
--- xen-unstable.hg-4.1.22459.orig/xen/arch/x86/mm/mem_sharing.c
+++ xen-unstable.hg-4.1.22459/xen/arch/x86/mm/mem_sharing.c
@@ -321,7 +321,7 @@ static struct page_info* mem_sharing_all
}
/* XXX: Need to reserve a request, not just check the ring! */
- if(mem_event_check_ring(d)) return page;
+ if(mem_event_check_ring(d, 1)) return page;
req.flags |= MEM_EVENT_FLAG_OUT_OF_MEM;
req.gfn = gfn;
--- xen-unstable.hg-4.1.22459.orig/xen/arch/x86/mm/p2m.c
+++ xen-unstable.hg-4.1.22459/xen/arch/x86/mm/p2m.c
@@ -2758,7 +2758,7 @@ void p2m_mem_paging_populate(struct p2m_
struct domain *d = p2m->domain;
/* Check that there's space on the ring for this request */
- if ( mem_event_check_ring(d) )
+ if ( mem_event_check_ring(d, 1) )
return;
memset(&req, 0, sizeof(req));
--- xen-unstable.hg-4.1.22459.orig/xen/include/asm-x86/mem_event.h
+++ xen-unstable.hg-4.1.22459/xen/include/asm-x86/mem_event.h
@@ -24,7 +24,7 @@
#ifndef __MEM_EVENT_H__
#define __MEM_EVENT_H__
-int mem_event_check_ring(struct domain *d);
+int mem_event_check_ring(struct domain *d, int do_vcpu_sleep);
void mem_event_put_request(struct domain *d, mem_event_request_t *req);
void mem_event_get_response(struct domain *d, mem_event_response_t *rsp);
void mem_event_unpause_vcpus(struct domain *d);
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|