From mboxrd@z Thu Jan 1 00:00:00 1970 From: Olaf Hering Subject: [PATCH 08/17] xenpaging: make vcpu_sleep_nosync() optional in mem_event_check_ring() Date: Mon, 06 Dec 2010 21:59:15 +0100 Message-ID: <20101206205910.909115685@aepfle.de> References: <20101206205907.848643876@aepfle.de> Return-path: Content-Disposition: inline; filename=xen-unstable.xenpaging.mem_event_check_ring.no_vcpu_sleep.patch List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org 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 --- 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);