From: Mats Petersson <mats.petersson@citrix.com>
To: David Vrabel <david.vrabel@citrix.com>
Cc: "xen-devel@lists.xen.org" <xen-devel@lists.xen.org>,
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Subject: Re: [RFC/PATCH] Improve speed of mapping guest memory into Dom0
Date: Wed, 14 Nov 2012 16:43:07 +0000 [thread overview]
Message-ID: <50A3CA1B.6050907@citrix.com> (raw)
In-Reply-To: <50A3C94C.2040806@citrix.com>
On 14/11/12 16:39, David Vrabel wrote:
> On 14/11/12 13:08, David Vrabel wrote:
>> On 14/11/12 11:13, Mats Petersson wrote:
>>
>>> I have also found that the munmap() call used to unmap the guest memory
>>> from Dom0 is about 35% slower in 3.7 kernel than in the 2.6 kernel (3.8M
>>> cycles vs 2.8M cycles).
>> This performance reduction only occurs with 32-bit guests is the Xen
>> then traps-and-emulates both halves of the PTE write.
>>
>>> I think this could be made quicker by using a
>>> direct write of zero rather than the compare exchange operation that is
>>> currently used [which traps into Xen, performs the compare & exchange] -
>> This is something I noticed but never got around to producing a patch.
>> How about this (uncomplied!) patch?
>>
>> -- a/mm/memory.c
>> +++ b/mm/memory.c
>> @@ -1146,8 +1146,16 @@ again:
>> page->index > details->last_index))
>> continue;
>> }
>> - ptent = ptep_get_and_clear_full(mm, addr, pte,
>> - tlb->fullmm);
>> + /*
>> + * No need for the expensive atomic get and
>> + * clear for anonymous mappings as the dirty
>> + * and young bits are not used.
>> + */
>> + if (PageAnon(page))
> The mapping might not be backed by pages (e.g., foreign mappings) so:
>
> if (!page || PageAnon(page))
Indeed, this works fine - it now takes just under 500K cycles to "unmap"
1024 pages - compared to 3800k cycles with the original code.
--
Mats
>
>> + pte_clear(mm, addr, pte);
>> + else
>> + ptent = ptep_get_and_clear_full(mm, addr, pte,
>> + tlb->fullmm);
>> tlb_remove_tlb_entry(tlb, pte, addr);
>> if (unlikely(!page))
>> continue;
> David
>
>
prev parent reply other threads:[~2012-11-14 16:43 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-14 11:13 [RFC/PATCH] Improve speed of mapping guest memory into Dom0 Mats Petersson
2012-11-14 13:08 ` David Vrabel
2012-11-14 13:16 ` Ian Campbell
2012-11-14 14:04 ` Mats Petersson
2012-11-14 16:39 ` David Vrabel
2012-11-14 16:43 ` Mats Petersson [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=50A3CA1B.6050907@citrix.com \
--to=mats.petersson@citrix.com \
--cc=david.vrabel@citrix.com \
--cc=konrad.wilk@oracle.com \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.