From: Boris Ostrovsky <boris.ostrovsky@oracle.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: tim@xen.org, sstabellini@kernel.org, wei.liu2@citrix.com,
George.Dunlap@eu.citrix.com, andrew.cooper3@citrix.com,
ian.jackson@eu.citrix.com, xen-devel@lists.xen.org
Subject: Re: [PATCH v2 2/9] mm: Place unscrubbed pages at the end of pagelist
Date: Tue, 4 Apr 2017 11:39:56 -0400 [thread overview]
Message-ID: <be42b99f-3305-1f20-7f8d-8a40e6f7e33c@oracle.com> (raw)
In-Reply-To: <58E3D7F5020000780014CBD9@prv-mh.provo.novell.com>
On 04/04/2017 11:29 AM, Jan Beulich wrote:
>>>> On 04.04.17 at 17:14, <boris.ostrovsky@oracle.com> wrote:
>> On 04/04/2017 10:46 AM, Jan Beulich wrote:
>>>> @@ -933,6 +952,10 @@ static bool_t can_merge(struct page_info *buddy, unsigned int node,
>>>> (phys_to_nid(page_to_maddr(buddy)) != node) )
>>>> return false;
>>>>
>>>> + if ( need_scrub !=
>>>> + !!test_bit(_PGC_need_scrub, &buddy->count_info) )
>>>> + return false;
>>> I don't think leaving the tree in a state where larger order chunks
>>> don't become available for allocation right away is going to be
>>> acceptable. Hence with this issue being dealt with only in patch 7
>>> as it seems, you should state clearly and visibly that (at least)
>>> patches 2...7 should only be committed together.
>> The dirty pages are available for allocation as result of this patch but
>> they might not be merged with higher orders (which is what this check is
>> for)
> The individual chunks are available for allocation, but not the
> combined one (for a suitably high order request). Or am I
> missing something?
Correct, but this is not changed by any later patch (including patch 7).
We only merge with a buddy with the same level of cleanliness (so to
speak ;-))
>
>>>> @@ -952,9 +977,10 @@ static struct page_info *merge_chunks(struct page_info *pg, unsigned int node,
>>>> {
>>>> /* Merge with predecessor block? */
>>>> buddy = pg - mask;
>>>> - if ( !can_merge(buddy, node, order) )
>>>> + if ( !can_merge(buddy, node, order, need_scrub) )
>>>> break;
>>>>
>>>> + pg->count_info &= ~PGC_need_scrub;
>>>> pg = buddy;
>>>> page_list_del(pg, &heap(node, zone, order));
>>>> }
>>>> @@ -962,9 +988,10 @@ static struct page_info *merge_chunks(struct page_info *pg, unsigned int node,
>>>> {
>>>> /* Merge with successor block? */
>>>> buddy = pg + mask;
>>>> - if ( !can_merge(buddy, node, order) )
>>>> + if ( !can_merge(buddy, node, order, need_scrub) )
>>>> break;
>>>>
>>>> + buddy->count_info &= ~PGC_need_scrub;
>>>> page_list_del(buddy, &heap(node, zone, order));
>>>> }
>>> For both of these, how come you can / want to clear the need-scrub
>>> flag? Wouldn't it be better for each individual page to retain it, so
>>> when encountering a higher-order one you know which pages need
>>> scrubbing and which don't? Couldn't that also be used to avoid
>>> suppressing their merging here right away?
>> I am trying to avoid having to keep dirty bit for each page since a
>> buddy is either fully clean or fully dirty. That way we shouldn't need
>> to walk the list and clear the bit. (I, in fact, suspect that there may
>> be other state bits/fields that we might be able to keep at a buddy only)
> But as said - at the expense of not being able to merge early. I
> consider this a serious limitation.
What do you mean by "early"? At freeing time?
But then we will always have to scan the buddy during allocation to see
if any pages are dirty.
>
>>>> --- a/xen/include/asm-x86/mm.h
>>>> +++ b/xen/include/asm-x86/mm.h
>>>> @@ -233,6 +233,10 @@ struct page_info
>>>> #define PGC_count_width PG_shift(9)
>>>> #define PGC_count_mask ((1UL<<PGC_count_width)-1)
>>>>
>>>> +/* Page needs to be scrubbed */
>>>> +#define _PGC_need_scrub PG_shift(10)
>>>> +#define PGC_need_scrub PG_mask(1, 10)
>>> So why not a new PGC_state_dirty instead of this independent
>>> flag? Pages other than PGC_state_free should never make it
>>> to the scrubber, so the flag is meaningless for all other
>>> PGC_state_*.
>> Wouldn't doing this require possibly making two checks ---
>> page_state_is(pg, free) || page_state_is(pg, dirty)?
> Well, your goal would normally be to first look for pages not
> needing scrubbing anyway, so quite likely you'd do two
> passes anyway. But of course much depends on whether to
> merge early or late.
Again, I need to understand what you consider "early" and "late".
-boris
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2017-04-04 15:39 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-03 16:50 [PATCH v2 0/9] Memory scrubbing from idle loop Boris Ostrovsky
2017-04-03 16:50 ` [PATCH v2 1/9] mm: Separate free page chunk merging into its own routine Boris Ostrovsky
2017-04-04 11:16 ` Jan Beulich
2017-04-04 13:48 ` Boris Ostrovsky
2017-04-04 14:01 ` Jan Beulich
2017-04-04 14:23 ` Boris Ostrovsky
2017-04-03 16:50 ` [PATCH v2 2/9] mm: Place unscrubbed pages at the end of pagelist Boris Ostrovsky
2017-04-04 14:46 ` Jan Beulich
2017-04-04 15:14 ` Boris Ostrovsky
2017-04-04 15:29 ` Jan Beulich
2017-04-04 15:39 ` Boris Ostrovsky [this message]
2017-04-04 15:50 ` Jan Beulich
2017-04-04 16:22 ` Boris Ostrovsky
2017-04-03 16:50 ` [PATCH v2 3/9] mm: Scrub pages in alloc_heap_pages() if needed Boris Ostrovsky
2017-04-03 16:50 ` [PATCH v2 4/9] mm: Scrub memory from idle loop Boris Ostrovsky
2017-04-12 16:11 ` Jan Beulich
2017-04-03 16:50 ` [PATCH v2 5/9] mm: Do not discard already-scrubbed pages softirqs are pending Boris Ostrovsky
2017-04-13 15:41 ` Jan Beulich
2017-04-13 16:46 ` Boris Ostrovsky
2017-04-03 16:50 ` [PATCH v2 6/9] spinlock: Introduce spin_lock_cb() Boris Ostrovsky
2017-04-13 15:46 ` Jan Beulich
2017-04-13 16:55 ` Boris Ostrovsky
2017-04-18 6:49 ` Jan Beulich
2017-04-18 12:32 ` Boris Ostrovsky
2017-04-18 12:43 ` Jan Beulich
2017-04-18 13:14 ` Boris Ostrovsky
2017-04-03 16:50 ` [PATCH v2 7/9] mm: Keep pages available for allocation while scrubbing Boris Ostrovsky
2017-04-13 15:59 ` Jan Beulich
2017-04-03 16:50 ` [PATCH v2 8/9] mm: Print number of unscrubbed pages in 'H' debug handler Boris Ostrovsky
2017-04-03 16:50 ` [PATCH v2 9/9] mm: Make sure pages are scrubbed Boris Ostrovsky
2017-04-04 15:21 ` [PATCH v2 0/9] Memory scrubbing from idle loop George Dunlap
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=be42b99f-3305-1f20-7f8d-8a40e6f7e33c@oracle.com \
--to=boris.ostrovsky@oracle.com \
--cc=George.Dunlap@eu.citrix.com \
--cc=JBeulich@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=sstabellini@kernel.org \
--cc=tim@xen.org \
--cc=wei.liu2@citrix.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 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).