* [PATCH] x86/PoD: skip eager reclaim when possible
@ 2016-05-10 13:44 Jan Beulich
2016-05-10 13:49 ` Jan Beulich
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Jan Beulich @ 2016-05-10 13:44 UTC (permalink / raw)
To: xen-devel; +Cc: George Dunlap
[-- Attachment #1: Type: text/plain, Size: 1029 bytes --]
Reclaiming pages is pointless when the cache can already satisfy all
outstanding PoD entries, and doing reclaims in that case can be very
harmful to performance when that memory gets used by the guest, but
only to store zeroes there.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
--- a/xen/arch/x86/mm/p2m-pod.c
+++ b/xen/arch/x86/mm/p2m-pod.c
@@ -1027,7 +1027,6 @@ static void pod_eager_record(struct p2m_
{
struct pod_mrp_list *mrp = &p2m->pod.mrp;
- ASSERT(mrp->list[mrp->idx] == INVALID_GFN);
ASSERT(gfn != INVALID_GFN);
mrp->list[mrp->idx++] =
@@ -1075,7 +1074,9 @@ p2m_pod_demand_populate(struct p2m_domai
return 0;
}
- pod_eager_reclaim(p2m);
+ /* Only reclaim if we're in actual need of more cache. */
+ if ( p2m->pod.entry_count > p2m->pod.count )
+ pod_eager_reclaim(p2m);
/* Only sweep if we're actually out of memory. Doing anything else
* causes unnecessary time and fragmentation of superpages in the p2m. */
[-- Attachment #2: x86-PoD-avoid-eager-reclaim.patch --]
[-- Type: text/plain, Size: 1068 bytes --]
x86/PoD: skip eager reclaim when possible
Reclaiming pages is pointless when the cache can already satisfy all
outstanding PoD entries, and doing reclaims in that case can be very
harmful to performance when that memory gets used by the guest, but
only to store zeroes there.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
--- a/xen/arch/x86/mm/p2m-pod.c
+++ b/xen/arch/x86/mm/p2m-pod.c
@@ -1027,7 +1027,6 @@ static void pod_eager_record(struct p2m_
{
struct pod_mrp_list *mrp = &p2m->pod.mrp;
- ASSERT(mrp->list[mrp->idx] == INVALID_GFN);
ASSERT(gfn != INVALID_GFN);
mrp->list[mrp->idx++] =
@@ -1075,7 +1074,9 @@ p2m_pod_demand_populate(struct p2m_domai
return 0;
}
- pod_eager_reclaim(p2m);
+ /* Only reclaim if we're in actual need of more cache. */
+ if ( p2m->pod.entry_count > p2m->pod.count )
+ pod_eager_reclaim(p2m);
/* Only sweep if we're actually out of memory. Doing anything else
* causes unnecessary time and fragmentation of superpages in the p2m. */
[-- Attachment #3: Type: text/plain, Size: 126 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] x86/PoD: skip eager reclaim when possible
2016-05-10 13:44 [PATCH] x86/PoD: skip eager reclaim when possible Jan Beulich
@ 2016-05-10 13:49 ` Jan Beulich
2016-05-10 14:18 ` Wei Liu
2016-05-10 13:50 ` Andrew Cooper
2016-05-12 14:40 ` George Dunlap
2 siblings, 1 reply; 8+ messages in thread
From: Jan Beulich @ 2016-05-10 13:49 UTC (permalink / raw)
To: Wei Liu; +Cc: George Dunlap, xen-devel
>>> On 10.05.16 at 15:44, <JBeulich@suse.com> wrote:
> Reclaiming pages is pointless when the cache can already satisfy all
> outstanding PoD entries, and doing reclaims in that case can be very
> harmful to performance when that memory gets used by the guest, but
> only to store zeroes there.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
And I realize I forgot to Cc you, Wei.
Jan
> --- a/xen/arch/x86/mm/p2m-pod.c
> +++ b/xen/arch/x86/mm/p2m-pod.c
> @@ -1027,7 +1027,6 @@ static void pod_eager_record(struct p2m_
> {
> struct pod_mrp_list *mrp = &p2m->pod.mrp;
>
> - ASSERT(mrp->list[mrp->idx] == INVALID_GFN);
> ASSERT(gfn != INVALID_GFN);
>
> mrp->list[mrp->idx++] =
> @@ -1075,7 +1074,9 @@ p2m_pod_demand_populate(struct p2m_domai
> return 0;
> }
>
> - pod_eager_reclaim(p2m);
> + /* Only reclaim if we're in actual need of more cache. */
> + if ( p2m->pod.entry_count > p2m->pod.count )
> + pod_eager_reclaim(p2m);
>
> /* Only sweep if we're actually out of memory. Doing anything else
> * causes unnecessary time and fragmentation of superpages in the p2m.
> */
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] x86/PoD: skip eager reclaim when possible
2016-05-10 13:44 [PATCH] x86/PoD: skip eager reclaim when possible Jan Beulich
2016-05-10 13:49 ` Jan Beulich
@ 2016-05-10 13:50 ` Andrew Cooper
2016-05-10 14:27 ` Jan Beulich
2016-05-12 14:40 ` George Dunlap
2 siblings, 1 reply; 8+ messages in thread
From: Andrew Cooper @ 2016-05-10 13:50 UTC (permalink / raw)
To: Jan Beulich, xen-devel; +Cc: George Dunlap
On 10/05/16 14:44, Jan Beulich wrote:
> Reclaiming pages is pointless when the cache can already satisfy all
> outstanding PoD entries, and doing reclaims in that case can be very
> harmful to performance when that memory gets used by the guest, but
> only to store zeroes there.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Possibly worth mentioning a dd from /dev/zero as the most likely action
to trigger this.
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] x86/PoD: skip eager reclaim when possible
2016-05-10 13:49 ` Jan Beulich
@ 2016-05-10 14:18 ` Wei Liu
0 siblings, 0 replies; 8+ messages in thread
From: Wei Liu @ 2016-05-10 14:18 UTC (permalink / raw)
To: Jan Beulich; +Cc: George Dunlap, xen-devel, Wei Liu
On Tue, May 10, 2016 at 07:49:01AM -0600, Jan Beulich wrote:
> >>> On 10.05.16 at 15:44, <JBeulich@suse.com> wrote:
> > Reclaiming pages is pointless when the cache can already satisfy all
> > outstanding PoD entries, and doing reclaims in that case can be very
> > harmful to performance when that memory gets used by the guest, but
> > only to store zeroes there.
> >
> > Signed-off-by: Jan Beulich <jbeulich@suse.com>
>
> And I realize I forgot to Cc you, Wei.
>
Release-acked-by: Wei Liu <wei.liu2@citrix.com>
Please apply this after we cut RC2.
Wei.
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] x86/PoD: skip eager reclaim when possible
2016-05-10 13:50 ` Andrew Cooper
@ 2016-05-10 14:27 ` Jan Beulich
0 siblings, 0 replies; 8+ messages in thread
From: Jan Beulich @ 2016-05-10 14:27 UTC (permalink / raw)
To: Andrew Cooper; +Cc: George Dunlap, xen-devel
>>> On 10.05.16 at 15:50, <andrew.cooper3@citrix.com> wrote:
> On 10/05/16 14:44, Jan Beulich wrote:
>> Reclaiming pages is pointless when the cache can already satisfy all
>> outstanding PoD entries, and doing reclaims in that case can be very
>> harmful to performance when that memory gets used by the guest, but
>> only to store zeroes there.
>>
>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>
> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
>
> Possibly worth mentioning a dd from /dev/zero as the most likely action
> to trigger this.
Well, I didn't want to because I think there are other means, like
mmap()-ing anonymous memory.
Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] x86/PoD: skip eager reclaim when possible
2016-05-10 13:44 [PATCH] x86/PoD: skip eager reclaim when possible Jan Beulich
2016-05-10 13:49 ` Jan Beulich
2016-05-10 13:50 ` Andrew Cooper
@ 2016-05-12 14:40 ` George Dunlap
2016-05-12 15:08 ` Jan Beulich
2 siblings, 1 reply; 8+ messages in thread
From: George Dunlap @ 2016-05-12 14:40 UTC (permalink / raw)
To: Jan Beulich, xen-devel; +Cc: George Dunlap
On 10/05/16 14:44, Jan Beulich wrote:
> Reclaiming pages is pointless when the cache can already satisfy all
> outstanding PoD entries, and doing reclaims in that case can be very
> harmful to performance when that memory gets used by the guest, but
> only to store zeroes there.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
Sorry for the delay. Just one question...
>
> --- a/xen/arch/x86/mm/p2m-pod.c
> +++ b/xen/arch/x86/mm/p2m-pod.c
> @@ -1027,7 +1027,6 @@ static void pod_eager_record(struct p2m_
> {
> struct pod_mrp_list *mrp = &p2m->pod.mrp;
>
> - ASSERT(mrp->list[mrp->idx] == INVALID_GFN);
> ASSERT(gfn != INVALID_GFN);
What's this for?
-George
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] x86/PoD: skip eager reclaim when possible
2016-05-12 14:40 ` George Dunlap
@ 2016-05-12 15:08 ` Jan Beulich
2016-05-12 15:19 ` George Dunlap
0 siblings, 1 reply; 8+ messages in thread
From: Jan Beulich @ 2016-05-12 15:08 UTC (permalink / raw)
To: George Dunlap; +Cc: George Dunlap, xen-devel
>>> On 12.05.16 at 16:40, <george.dunlap@citrix.com> wrote:
> On 10/05/16 14:44, Jan Beulich wrote:
>> Reclaiming pages is pointless when the cache can already satisfy all
>> outstanding PoD entries, and doing reclaims in that case can be very
>> harmful to performance when that memory gets used by the guest, but
>> only to store zeroes there.
>>
>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>
> Sorry for the delay. Just one question...
>
>>
>> --- a/xen/arch/x86/mm/p2m-pod.c
>> +++ b/xen/arch/x86/mm/p2m-pod.c
>> @@ -1027,7 +1027,6 @@ static void pod_eager_record(struct p2m_
>> {
>> struct pod_mrp_list *mrp = &p2m->pod.mrp;
>>
>> - ASSERT(mrp->list[mrp->idx] == INVALID_GFN);
>> ASSERT(gfn != INVALID_GFN);
>
> What's this for?
The deletion of the ASSERT()? Since we no longer always insert a
GFN through pod_eager_reclaim(), we also can no longer assume
all (used) entries hold a valid GFN.
Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] x86/PoD: skip eager reclaim when possible
2016-05-12 15:08 ` Jan Beulich
@ 2016-05-12 15:19 ` George Dunlap
0 siblings, 0 replies; 8+ messages in thread
From: George Dunlap @ 2016-05-12 15:19 UTC (permalink / raw)
To: Jan Beulich; +Cc: George Dunlap, xen-devel
On 12/05/16 16:08, Jan Beulich wrote:
>>>> On 12.05.16 at 16:40, <george.dunlap@citrix.com> wrote:
>> On 10/05/16 14:44, Jan Beulich wrote:
>>> Reclaiming pages is pointless when the cache can already satisfy all
>>> outstanding PoD entries, and doing reclaims in that case can be very
>>> harmful to performance when that memory gets used by the guest, but
>>> only to store zeroes there.
>>>
>>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>>
>> Sorry for the delay. Just one question...
>>
>>>
>>> --- a/xen/arch/x86/mm/p2m-pod.c
>>> +++ b/xen/arch/x86/mm/p2m-pod.c
>>> @@ -1027,7 +1027,6 @@ static void pod_eager_record(struct p2m_
>>> {
>>> struct pod_mrp_list *mrp = &p2m->pod.mrp;
>>>
>>> - ASSERT(mrp->list[mrp->idx] == INVALID_GFN);
>>> ASSERT(gfn != INVALID_GFN);
>>
>> What's this for?
>
> The deletion of the ASSERT()? Since we no longer always insert a
> GFN through pod_eager_reclaim(), we also can no longer assume
> all (used) entries hold a valid GFN.
Oh, right. Should have taken a closer look, sorry for the noise:
Reviewed-by: George Dunlap <george.dunlap@citrix.com>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2016-05-12 15:20 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-10 13:44 [PATCH] x86/PoD: skip eager reclaim when possible Jan Beulich
2016-05-10 13:49 ` Jan Beulich
2016-05-10 14:18 ` Wei Liu
2016-05-10 13:50 ` Andrew Cooper
2016-05-10 14:27 ` Jan Beulich
2016-05-12 14:40 ` George Dunlap
2016-05-12 15:08 ` Jan Beulich
2016-05-12 15:19 ` George Dunlap
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).