linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 04/12] mm, thp, tmpfs: split huge page when moving from page cache to swap
@ 2013-10-15  0:12 Ning Qu
  2013-10-15 10:33 ` Kirill A. Shutemov
  0 siblings, 1 reply; 3+ messages in thread
From: Ning Qu @ 2013-10-15  0:12 UTC (permalink / raw)
  To: Andrea Arcangeli, Andrew Morton, Kirill A. Shutemov, Hugh Dickins
  Cc: Al Viro, Hugh Dickins, Wu Fengguang, Jan Kara, Mel Gorman,
	linux-mm, Andi Kleen, Matthew Wilcox, Hillf Danton, Dave Hansen,
	Alexander Shishkin, linux-fsdevel, linux-kernel, Ning Qu

in shmem_writepage, we have to split the huge page when moving pages
from page cache to swap because we don't support huge page in swap
yet.

Signed-off-by: Ning Qu <quning@gmail.com>
---
 mm/shmem.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/mm/shmem.c b/mm/shmem.c
index 8fe17dd..68a0e1d 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -898,6 +898,13 @@ static int shmem_writepage(struct page *page, struct writeback_control *wbc)
 	swp_entry_t swap;
 	pgoff_t index;
 
+	/* TODO: we have to break the huge page at this point,
+	 * since we have no idea how to recover a huge page from
+	 * swap.
+	 */
+	if (PageTransCompound(page))
+		split_huge_page(compound_trans_head(page));
+
 	BUG_ON(!PageLocked(page));
 	mapping = page->mapping;
 	index = page->index;
@@ -946,7 +953,7 @@ static int shmem_writepage(struct page *page, struct writeback_control *wbc)
 			if (shmem_falloc)
 				goto redirty;
 		}
-		clear_highpage(page);
+		clear_pagecache_page(page);
 		flush_dcache_page(page);
 		SetPageUptodate(page);
 	}
-- 
1.8.4



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

* RE: [PATCH 04/12] mm, thp, tmpfs: split huge page when moving from page cache to swap
  2013-10-15  0:12 [PATCH 04/12] mm, thp, tmpfs: split huge page when moving from page cache to swap Ning Qu
@ 2013-10-15 10:33 ` Kirill A. Shutemov
  2013-10-15 19:00   ` Ning Qu
  0 siblings, 1 reply; 3+ messages in thread
From: Kirill A. Shutemov @ 2013-10-15 10:33 UTC (permalink / raw)
  To: Ning Qu
  Cc: Andrea Arcangeli, Andrew Morton, Kirill A. Shutemov,
	Hugh Dickins, Al Viro, Hugh Dickins, Wu Fengguang, Jan Kara,
	Mel Gorman, linux-mm, Andi Kleen, Matthew Wilcox, Hillf Danton,
	Dave Hansen, Alexander Shishkin, linux-fsdevel, linux-kernel,
	Ning Qu

Ning Qu wrote:
> in shmem_writepage, we have to split the huge page when moving pages
> from page cache to swap because we don't support huge page in swap
> yet.
> 
> Signed-off-by: Ning Qu <quning@gmail.com>
> ---
>  mm/shmem.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/mm/shmem.c b/mm/shmem.c
> index 8fe17dd..68a0e1d 100644
> --- a/mm/shmem.c
> +++ b/mm/shmem.c
> @@ -898,6 +898,13 @@ static int shmem_writepage(struct page *page, struct writeback_control *wbc)
>  	swp_entry_t swap;
>  	pgoff_t index;
>  
> +	/* TODO: we have to break the huge page at this point,
> +	 * since we have no idea how to recover a huge page from
> +	 * swap.
> +	 */
> +	if (PageTransCompound(page))
> +		split_huge_page(compound_trans_head(page));
> +

After the split you handle here only first small page of the huge page.
Is it what we want to do? Should we swap out all small pages of the huge
page?

-- 
 Kirill A. Shutemov

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

* Re: [PATCH 04/12] mm, thp, tmpfs: split huge page when moving from page cache to swap
  2013-10-15 10:33 ` Kirill A. Shutemov
@ 2013-10-15 19:00   ` Ning Qu
  0 siblings, 0 replies; 3+ messages in thread
From: Ning Qu @ 2013-10-15 19:00 UTC (permalink / raw)
  To: Kirill A. Shutemov
  Cc: Andrea Arcangeli, Andrew Morton, Hugh Dickins, Al Viro,
	Wu Fengguang, Jan Kara, Mel Gorman, linux-mm, Andi Kleen,
	Matthew Wilcox, Hillf Danton, Dave Hansen, Alexander Shishkin,
	linux-fsdevel, linux-kernel

Let me take another look at that logic. Thanks!
Best wishes,
-- 
Ning Qu (曲宁) | Software Engineer | quning@google.com | +1-408-418-6066


On Tue, Oct 15, 2013 at 3:33 AM, Kirill A. Shutemov
<kirill.shutemov@linux.intel.com> wrote:
> Ning Qu wrote:
>> in shmem_writepage, we have to split the huge page when moving pages
>> from page cache to swap because we don't support huge page in swap
>> yet.
>>
>> Signed-off-by: Ning Qu <quning@gmail.com>
>> ---
>>  mm/shmem.c | 9 ++++++++-
>>  1 file changed, 8 insertions(+), 1 deletion(-)
>>
>> diff --git a/mm/shmem.c b/mm/shmem.c
>> index 8fe17dd..68a0e1d 100644
>> --- a/mm/shmem.c
>> +++ b/mm/shmem.c
>> @@ -898,6 +898,13 @@ static int shmem_writepage(struct page *page, struct writeback_control *wbc)
>>       swp_entry_t swap;
>>       pgoff_t index;
>>
>> +     /* TODO: we have to break the huge page at this point,
>> +      * since we have no idea how to recover a huge page from
>> +      * swap.
>> +      */
>> +     if (PageTransCompound(page))
>> +             split_huge_page(compound_trans_head(page));
>> +
>
> After the split you handle here only first small page of the huge page.
> Is it what we want to do? Should we swap out all small pages of the huge
> page?
>
> --
>  Kirill A. Shutemov

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

end of thread, other threads:[~2013-10-15 19:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-15  0:12 [PATCH 04/12] mm, thp, tmpfs: split huge page when moving from page cache to swap Ning Qu
2013-10-15 10:33 ` Kirill A. Shutemov
2013-10-15 19:00   ` Ning Qu

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