xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Bob Liu <bob.liu@oracle.com>
To: George Dunlap <George.Dunlap@eu.citrix.com>,
	Jinchun Kim <cienlux@gmail.com>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>,
	"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>
Subject: Re: Why frontswap and cleancache make copies in tmem?
Date: Mon, 17 Feb 2014 20:23:35 +0800	[thread overview]
Message-ID: <5301FF47.1040008@oracle.com> (raw)
In-Reply-To: <CAFLBxZac8PTv-4qK-Z9sWv2PtbXsyMohdH=UhzRzO31n2BFu8g@mail.gmail.com>


On 02/17/2014 07:40 PM, George Dunlap wrote:
> On Mon, Feb 17, 2014 at 11:38 AM, George Dunlap
> <George.Dunlap@eu.citrix.com> wrote:
>> On Sun, Feb 16, 2014 at 10:14 PM, Jinchun Kim <cienlux@gmail.com> wrote:
>>> Hi, All.
>>>
>>> While I was digging tmem and its source code, I found suspicious things
>>> about frontswap and cleancache.
>>> When the guest OS wants to evict either a dirty or clean page, frontswap and
>>> cleancache will store it in tmem.
>>> The linux kernel document tells that
>>>
>>> [Documentation/vm/frontswap.txt]
>>> A "store" will copy the page to transcendent memory ....
>>> A "load" will copy the page, if found, from transcendent memory into kernel
>>> memory ...
>>>
>>> [Documentation/vm/cleancache.txt]
>>> A "put_page" will copy a page (presumably about-to-be-evicted) page into
>>> cleancache ...
>>> A "get_page" will copy the page, if found, from cleancache into kernel
>>> memory ...
>>>

Jinchun, I'm glad you are interested with tmem.

>>> My colleagues and I think copying the page is not necessary (especially for
>>> cleancache) because both kernel memory and tmem have same data. Why don't we
>>> just change the pointer to the page and let it belong to tmem? We were

No, kernel memory won't have the data any more.
For cleancache, the data exist only in tmem and the disk storage.

It's impossible to 'change the pointer to the page and let it belong to
tmem', because the page need to be reclaimed by guest os.
One possible way is to allocate a new page and return it to guest os, so
that we can let the original page belong to tmem instead of copy data.
But by this way, there is also some map/unmap cost and will make tmem
more complicated.

Welcome any ideas about making tmem better.

>>> wondering if there is any specific reason not to copy the pages to tmem.
>>
>> Konrad / Boris?  (Sorry, I can't remember the other person who's been
>> sending tmem patches recently.)
> 
> Oh, it was Bob Liu. :-)
> 

George, thanks for your cc.

-- 
Regards,
-Bob

      reply	other threads:[~2014-02-17 12:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-16 22:14 Why frontswap and cleancache make copies in tmem? Jinchun Kim
2014-02-17 11:38 ` George Dunlap
2014-02-17 11:40   ` George Dunlap
2014-02-17 12:23     ` Bob Liu [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=5301FF47.1040008@oracle.com \
    --to=bob.liu@oracle.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=cienlux@gmail.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).