From: Bob Liu <bob.liu@oracle.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: Bob Liu <lliubbo@gmail.com>,
keir@xen.org, ian.campbell@citrix.com,
George.Dunlap@eu.citrix.com, andrew.cooper3@citrix.com,
xen-devel@lists.xenproject.org
Subject: Re: [PATCH v2 1/3] xen: delay page scrubbing to allocation path
Date: Tue, 01 Jul 2014 16:12:22 +0800 [thread overview]
Message-ID: <53B26D66.8020503@oracle.com> (raw)
In-Reply-To: <53B1A4CC020000780001EA6D@mail.emea.novell.com>
On 06/30/2014 11:56 PM, Jan Beulich wrote:
>>>> On 30.06.14 at 15:39, <lliubbo@gmail.com> wrote:
>> --- a/xen/common/page_alloc.c
>> +++ b/xen/common/page_alloc.c
>> @@ -711,6 +711,12 @@ static struct page_info *alloc_heap_pages(
>>
>> for ( i = 0; i < (1 << order); i++ )
>> {
>> + if ( test_bit(_PGC_need_scrub, &pg[i].count_info) )
>> + {
>> + scrub_one_page(&pg[i]);
>> + pg[i].count_info &= ~PGC_need_scrub;
>> + }
>> +
>
> heap_lock is still being held here - scrubbing should be done after it
> was dropped (or else you re-introduce the same latency problem to
> other paths now needing to wait for the scrubbing to complete).
>
I see, now it only avoids this case e.g don't scrub all 4Tb when a 4Tb
chunk found for a request of a single page.
Anyway I will move the scrubbing out of spinlock in next version.
>> @@ -876,6 +882,15 @@ static void free_heap_pages(
>> midsize_alloc_zone_pages = max(
>> midsize_alloc_zone_pages, total_avail_pages / MIDSIZE_ALLOC_FRAC);
>>
>> + if ( need_scrub )
>> + {
>> + if ( !tainted )
>> + {
>> + for ( i = 0; i < (1 << order); i++ )
>> + pg[i].count_info |= PGC_need_scrub;
>> + }
>> + }
>
> Two if()s like these should be folded into one.
>
Will be fixed.
>> @@ -889,6 +904,17 @@ static void free_heap_pages(
>> (PFN_ORDER(pg-mask) != order) ||
>> (phys_to_nid(page_to_maddr(pg-mask)) != node) )
>> break;
>> + /* If we need scrub, only merge with PGC_need_scrub pages */
>> + if ( need_scrub )
>> + {
>> + if ( !test_bit(_PGC_need_scrub, &(pg-mask)->count_info) )
>> + break;
>> + }
>> + else
>> + {
>> + if ( test_bit(_PGC_need_scrub, &(pg-mask)->count_info) )
>> + break;
>> + }
>
> You're setting PGC_need_scrub on each 4k page anyway (which
> is debatable), hence there's no need to look at the passed in
> need_scrub flag here: Just check whether both chunks have the
> flag set the same. Same below.
>
Right, thanks for your suggestion.
>> @@ -1535,7 +1571,7 @@ void free_xenheap_pages(void *v, unsigned int order)
>>
>> memguard_guard_range(v, 1 << (order + PAGE_SHIFT));
>>
>> - free_heap_pages(virt_to_page(v), order);
>> + free_heap_pages(virt_to_page(v), order, 1);
>
> Why?
>
Sorry, a mistake here and will be fixed.
>> @@ -1588,11 +1624,10 @@ void free_xenheap_pages(void *v, unsigned int order)
>>
>> for ( i = 0; i < (1u << order); i++ )
>> {
>> - scrub_one_page(&pg[i]);
>> pg[i].count_info &= ~PGC_xen_heap;
>> }
>>
>> - free_heap_pages(pg, order);
>> + free_heap_pages(pg, order, 1);
>
> The flags needs to be 1 here, but I don't see why you also pass 1 in
> the other free_xenheap_pages() incarnation above.
>
>> @@ -1745,24 +1780,20 @@ void free_domheap_pages(struct page_info *pg, unsigned int order)
>> * domain has died we assume responsibility for erasure.
>> */
>> if ( unlikely(d->is_dying) )
>> - for ( i = 0; i < (1 << order); i++ )
>> - scrub_one_page(&pg[i]);
>> -
>> - free_heap_pages(pg, order);
>> + free_heap_pages(pg, order, 1);
>> + else
>> + free_heap_pages(pg, order, 0);
>> }
>> else if ( unlikely(d == dom_cow) )
>> {
>> ASSERT(order == 0);
>> - scrub_one_page(pg);
>> - free_heap_pages(pg, 0);
>> + free_heap_pages(pg, 0, 1);
>> drop_dom_ref = 0;
>> }
>> else
>> {
>> /* Freeing anonymous domain-heap pages. */
>> - for ( i = 0; i < (1 << order); i++ )
>> - scrub_one_page(&pg[i]);
>> - free_heap_pages(pg, order);
>> + free_heap_pages(pg, order, 1);
>> drop_dom_ref = 0;
>> }
>>
>
> This hunk is patching no longer existing code (see commit daa4b800
> "slightly consolidate code in free_domheap_pages()").
>
I'll rebase this patch to an newer version after that commit.
Thanks again.
--
Regards,
-Bob
next prev parent reply other threads:[~2014-07-01 8:12 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-30 13:39 [PATCH v2 1/3] xen: delay page scrubbing to allocation path Bob Liu
2014-06-30 13:39 ` [PATCH v2 2/3] xen: introduce function merge_free_trunks Bob Liu
2014-06-30 15:58 ` Jan Beulich
2014-07-01 8:14 ` Bob Liu
2014-07-01 8:27 ` Jan Beulich
2014-06-30 13:39 ` [PATCH v2 3/3] xen: use idle vcpus to scrub pages Bob Liu
2014-07-01 9:12 ` Jan Beulich
2014-07-01 12:25 ` Bob Liu
2014-07-01 12:59 ` Jan Beulich
2014-07-02 6:27 ` Bob Liu
2014-07-07 12:20 ` Bob Liu
2014-07-15 9:16 ` Bob Liu
2014-07-23 0:38 ` Konrad Rzeszutek Wilk
2014-07-23 1:30 ` Bob Liu
2014-07-23 7:28 ` Jan Beulich
2014-07-24 2:08 ` Bob Liu
2014-07-24 6:24 ` Jan Beulich
2014-07-25 0:42 ` Bob Liu
2014-07-25 6:51 ` Jan Beulich
2014-07-25 7:28 ` Bob Liu
2014-07-25 7:36 ` Jan Beulich
2014-07-25 8:18 ` Bob Liu
2014-07-25 8:28 ` Jan Beulich
2014-06-30 15:56 ` [PATCH v2 1/3] xen: delay page scrubbing to allocation path Jan Beulich
2014-07-01 8:12 ` Bob Liu [this message]
-- strict thread matches above, loose matches on Subject: below --
2014-06-30 13:39 Bob Liu
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=53B26D66.8020503@oracle.com \
--to=bob.liu@oracle.com \
--cc=George.Dunlap@eu.citrix.com \
--cc=JBeulich@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=ian.campbell@citrix.com \
--cc=keir@xen.org \
--cc=lliubbo@gmail.com \
--cc=xen-devel@lists.xenproject.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).