|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 6 of 6] x86/mm: Don't claim a slot on the paging ring if we might not need it
On Feb 23, 2012, at 11:34 AM, Tim Deegan wrote:
> # HG changeset patch
> # User Tim Deegan <tim@xxxxxxx>
> # Date 1330013929 0
> # Node ID 516f96172e67ff463c371357e0ab93724c8b9048
> # Parent 510d80343793227bd39b9a5d4d3b61b9a3f776e4
> x86/mm: Don't claim a slot on the paging ring if we might not need it.
>
> This avoids the possibility of hitting a wait queue for a slot and then
> finding out later that it wasn't necessary.
>
> Signed-off-by: Tim Deegan <tim@xxxxxxx>
>
> diff -r 510d80343793 -r 516f96172e67 xen/arch/x86/mm/p2m.c
> --- a/xen/arch/x86/mm/p2m.c Thu Feb 23 16:18:09 2012 +0000
> +++ b/xen/arch/x86/mm/p2m.c Thu Feb 23 16:18:49 2012 +0000
> @@ -1001,19 +1001,23 @@ void p2m_mem_paging_populate(struct doma
> p2m_access_t a;
> mfn_t mfn;
> struct p2m_domain *p2m = p2m_get_hostp2m(d);
> - int send_request = 0;
> + int rc, send_request = 0;
>
> - /* We're paging. There should be a ring */
> - int rc = mem_event_claim_slot(d, &d->mem_event->paging);
> - if ( rc == -ENOSYS )
> + if ( !d->mem_event->paging.ring_page )
There is a trivial call to do this in non open-coded fashion
bool_t mem_event_check_ring(struct mem_event_domain *med);
I don't use it frequently myself…otherwise
Acked-by: Andres Lagar-Cavilla <andres@xxxxxxxxxxxxxxxx>
> {
> gdprintk(XENLOG_ERR, "Domain %hu paging gfn %lx yet no ring "
> "in place\n", d->domain_id, gfn);
> domain_crash(d);
> return;
> }
> - else if ( rc < 0 )
> - return;
> +
> + /* Foreign users must grab a ring entry before doing any work since
> + * they might not be able to get one later. Local users shouldn't
> + * grab a slot until they know they need it, to avoid going on a
> + * wait-queue unnecessarily. */
> + if ( d != current->domain )
> + if ( mem_event_claim_slot(d, &d->mem_event->paging) < 0 )
> + return;
>
> /* Fix p2m mapping */
> gfn_lock(p2m, gfn, 0);
> @@ -1042,10 +1046,18 @@ void p2m_mem_paging_populate(struct doma
> if ( p2mt != p2m_ram_paging_out && p2mt != p2m_ram_paged )
> {
> /* gfn is already on its way back and vcpu is not paused */
> - mem_event_cancel_slot(d, &d->mem_event->paging);
> + if ( d != current->domain )
> + mem_event_cancel_slot(d, &d->mem_event->paging);
> return;
> }
>
> + /* Now local users should claim a slot. */
> + if ( d == current->domain )
> + {
> + rc = mem_event_claim_slot(d, &d->mem_event->paging);
> + ASSERT(rc == 0);
> + }
> +
> /* Send request to pager */
> req.p2mt = p2mt;
> req.vcpu_id = v->vcpu_id;
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |