kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dor Laor <dlaor@redhat.com>
To: Lucas Meneghel Rodrigues <lmr@redhat.com>
Cc: Jiri Zupka <jzupka@redhat.com>,
	kvm@vger.kernel.org, autotest@test.kernel.org,
	Lukas Doktor <ldoktor@redhat.com>
Subject: Re: [KVM-AUTOTEST PATCH 1/2] Add KSM test
Date: Wed, 30 Sep 2009 14:23:13 +0200	[thread overview]
Message-ID: <4AC34DB1.2070205@redhat.com> (raw)
In-Reply-To: <1254239454.8179.11.camel@localhost.localdomain>

On 09/29/2009 05:50 PM, Lucas Meneghel Rodrigues wrote:
> On Fri, 2009-09-25 at 05:22 -0400, Jiri Zupka wrote:
>> ----- "Dor Laor"<dlaor@redhat.com>  wrote:
>>
>>> On 09/16/2009 04:09 PM, Jiri Zupka wrote:
>>>>
>>>> ----- "Dor Laor"<dlaor@redhat.com>   wrote:
>>>>
>>>>> On 09/15/2009 09:58 PM, Jiri Zupka wrote:
>>>>>>> After a quick review I have the following questions:
>>>>>>> 1. Why did you implement the guest tool in 'c' and not in
>>> python?
>>>>>>>      Python is much simpler and you can share some code with the
>>>>> server.
>>>>>>>      This 'test protocol' would also be easier to understand this
>>>>> way.
>>>>>>
>>>>>> We need speed and the precise control of allocate memory in
>>> pages.
>>>>>>
>>>>>>> 2. IMHO there is no need to use select, you can do blocking
>>> read.
>>>>>>
>>>>>> We replace socket communication by interactive program
>>> communication
>>>>> via ssh/telnet
>>>>>>
>>>>>>> 3. Also you can use plain malloc without the more complex ( a
>>> bit)
>>>>> mmap.
>>>>>>
>>>>>> We need address exactly the memory pages. We can't allow shift of
>>>>> the data in memory.
>>>>>
>>>>> You can use the tmpfs+dd idea instead of the specific program as I
>>>>> detailed before. Maybe some other binary can be used. My intention
>>> is
>>>>> to
>>>>> simplify the test/environment as much as possible.
>>>>>
>>>>
>>>> We need compatibility with others system, like Windows etc..
>>>> We want to add support for others system in next version
>>>
>>> KSM is a host feature and should be agnostic to the guest.
>>> Also I don't think your code will compile on windows...
>>
>> Yes, I think you have true.
>
> First of all, sorry, I am doing the best I can to review carefully all
> the patch queue, and as KSM is a more involved feature that I am not
> very familiar with, I need a bit more time to review it!
>
>> But because we need generate special data to pages in memory.
>> We need use script on guest side of test. Because communication
>> over ssh is to slow to transfer lot of GB of special data to guests.
>>
>> We can use optimized C program which is 10x and more faster than
>> python script on native system. Heavy load of virtual guest can
>> make some performance problem.
>
> About code compiling under windows, I guess making a native windows c or
> c++ program is an option, I generally agree with your reasoning, this
> case seems to be better covered with a c program. Will get into it in
> more detail ASAP...
>
>> We can use tmpfs but with python script to generate special data.
>> We can't use dd with random because we need test some special case.
>> (change only last 96B of page etc.. )
>>
>>
>> What do you think about it?


I think it can be done with some simple scripting and it will be fast 
enough and more importantly, easier to understand and to change in the 
future.

Here is a short example for creating lots of identical pages that 
contain '0' apart for the last two bytes. If you'll run it in a single 
guest you should expect to save lots of memory. Then you can change the 
last bytes to random value and see the memory consumption grow:
[Remember to cancel the guest swap to keep it in the guest ram]

dd if=/dev/zero of=template  count=1 bs=4094
echo '1' >> template
cp template large_file
for ((i=0;i<10;i++)) do dd if=large_file of=large_file conv=notrunc 
oflag=append > /dev/null 2>&1 ; done

It creates a 4k*2^10 file with identical pages (since it's on tmpfs with 
no swap)

Can you try it? It should be far simpler than the original option.

Thanks,
Dor

  reply	other threads:[~2009-09-30 12:23 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <830286859.775301253870289468.JavaMail.root@zmail05.collab.prod.int.phx2.redhat.com>
2009-09-25  9:22 ` [KVM-AUTOTEST PATCH 1/2] Add KSM test Jiri Zupka
2009-09-29 15:50   ` Lucas Meneghel Rodrigues
2009-09-30 12:23     ` Dor Laor [this message]
     [not found] <83259492.232221253106465155.JavaMail.root@zmail05.collab.prod.int.phx2.redhat.com>
2009-09-16 13:09 ` Jiri Zupka
2009-09-16 13:21   ` Dor Laor
     [not found] <1785968988.186531253041095308.JavaMail.root@zmail05.collab.prod.int.phx2.redhat.com>
2009-09-15 18:58 ` Jiri Zupka
2009-09-16  8:56   ` Dor Laor
2009-08-31  9:29 [KVM-AUTOTEST PATCH 0/2] " Lukáš Doktor
2009-08-31  9:35 ` [KVM-AUTOTEST PATCH 1/2] " Lukáš Doktor
2009-09-01  8:49   ` Lukáš Doktor
2009-09-07 12:03   ` Dor Laor

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=4AC34DB1.2070205@redhat.com \
    --to=dlaor@redhat.com \
    --cc=autotest@test.kernel.org \
    --cc=jzupka@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=ldoktor@redhat.com \
    --cc=lmr@redhat.com \
    /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).