From: Jinchun Kim Subject: Why frontswap and cleancache make copies in tmem? Date: Sun, 16 Feb 2014 16:14:17 -0600 Message-ID: <930C8A66-3F17-4F3B-8419-82B3DBF5713B@gmail.com> Mime-Version: 1.0 (Mac OS X Mail 7.1 \(1827\)) Content-Type: multipart/mixed; boundary="===============9188465868276551646==" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org --===============9188465868276551646== Content-Type: multipart/alternative; boundary="Apple-Mail=_1F0FD316-72CB-4AF4-974F-82083CF14421" --Apple-Mail=_1F0FD316-72CB-4AF4-974F-82083CF14421 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=windows-1252 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=20 [Documentation/vm/frontswap.txt] A =93store=94 will copy the page to transcendent memory =85. A =93load=94 will copy the page, if found, from transcendent memory into = kernel memory ... [Documentation/vm/cleancache.txt] A =93put_page=94 will copy a page (presumably about-to-be-evicted) page = into cleancache ... A =93get_page=94 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=92t 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.= --Apple-Mail=_1F0FD316-72CB-4AF4-974F-82083CF14421 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=windows-1252 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 =93store=94 will copy the page to transcendent = memory =85.
A =93load=94 will copy the page, = if found, from transcendent memory into kernel memory = ...

[Documentation/vm/cleancache.txt]
<= div>A =93put_page=94 will copy a page (presumably = about-to-be-evicted) page into cleancache ...
A =93get_page=94 = 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=92t 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.
= --Apple-Mail=_1F0FD316-72CB-4AF4-974F-82083CF14421-- --===============9188465868276551646== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --===============9188465868276551646==--