All of lore.kernel.org
 help / color / mirror / Atom feed
* Why frontswap and cleancache make copies in tmem?
@ 2014-02-16 22:14 Jinchun Kim
  2014-02-17 11:38 ` George Dunlap
  0 siblings, 1 reply; 4+ messages in thread
From: Jinchun Kim @ 2014-02-16 22:14 UTC (permalink / raw)
  To: xen-devel


[-- Attachment #1.1: Type: text/plain, Size: 966 bytes --]

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 ...

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 wondering if there is any specific reason not to copy the pages to tmem.

Thanks.

[-- Attachment #1.2: Type: text/html, Size: 1411 bytes --]

[-- Attachment #2: 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] 4+ messages in thread

* Re: Why frontswap and cleancache make copies in tmem?
  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
  0 siblings, 1 reply; 4+ messages in thread
From: George Dunlap @ 2014-02-17 11:38 UTC (permalink / raw)
  To: Jinchun Kim; +Cc: Boris Ostrovsky, xen-devel

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 ...
>
> 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
> 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.)

 -George

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Why frontswap and cleancache make copies in tmem?
  2014-02-17 11:38 ` George Dunlap
@ 2014-02-17 11:40   ` George Dunlap
  2014-02-17 12:23     ` Bob Liu
  0 siblings, 1 reply; 4+ messages in thread
From: George Dunlap @ 2014-02-17 11:40 UTC (permalink / raw)
  To: Jinchun Kim; +Cc: Boris Ostrovsky, xen-devel

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 ...
>>
>> 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
>> 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Why frontswap and cleancache make copies in tmem?
  2014-02-17 11:40   ` George Dunlap
@ 2014-02-17 12:23     ` Bob Liu
  0 siblings, 0 replies; 4+ messages in thread
From: Bob Liu @ 2014-02-17 12:23 UTC (permalink / raw)
  To: George Dunlap, Jinchun Kim; +Cc: Boris Ostrovsky, xen-devel


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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-02-17 12:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.