Re: [PATCH] mm: vmscam: check page order in isolating lru pages

From: Hillf Danton
Date: Sat Dec 31 2011 - 09:55:32 EST


On Fri, Dec 30, 2011 at 1:35 AM, KOSAKI Motohiro
<kosaki.motohiro@xxxxxxxxx> wrote:
> (12/29/11 7:45 AM), Hillf Danton wrote:
>>
>> Before we try to isolate physically contiguous pages, check for page order
>> is
>> added, and if the reclaim order is no larger than page order, we should
>> give up
>> the attempt.
>>
>> Signed-off-by: Hillf Danton<dhillf@xxxxxxxxx>
>> Cc: Michal Hocko<mhocko@xxxxxxx>
>> Cc: KAMEZAWA Hiroyuki<kamezawa.hiroyu@xxxxxxxxxxxxxx>
>> Cc: Andrew Morton<akpm@xxxxxxxxxxxxxxxxxxxx>
>> Cc: David Rientjes<rientjes@xxxxxxxxxx>
>> Cc: Hugh Dickins<hughd@xxxxxxxxxx>
>> ---
>>
>> --- a/mm/vmscan.c    Thu Dec 29 20:20:16 2011
>> +++ b/mm/vmscan.c    Thu Dec 29 20:28:14 2011
>> @@ -1162,6 +1162,7 @@ static unsigned long isolate_lru_pages(u
>> Â Â Â Â Â Â Â Âunsigned long end_pfn;
>> Â Â Â Â Â Â Â Âunsigned long page_pfn;
>> Â Â Â Â Â Â Â Âint zone_id;
>> + Â Â Â Â Â Â Â unsigned int isolated_pages = 0;
>>
>> Â Â Â Â Â Â Â Âpage = lru_to_page(src);
>> Â Â Â Â Â Â Â Âprefetchw_prev_lru_page(page, src, flags);
>> @@ -1172,7 +1173,7 @@ static unsigned long isolate_lru_pages(u
>> Â Â Â Â Â Â Â Âcase 0:
>> Â Â Â Â Â Â Â Â Â Â Â Âmem_cgroup_lru_del(page);
>> Â Â Â Â Â Â Â Â Â Â Â Âlist_move(&page->lru, dst);
>> - Â Â Â Â Â Â Â Â Â Â Â nr_taken += hpage_nr_pages(page);
>> + Â Â Â Â Â Â Â Â Â Â Â isolated_pages = hpage_nr_pages(page);
>> Â Â Â Â Â Â Â Â Â Â Â Âbreak;
>>
>> Â Â Â Â Â Â Â Âcase -EBUSY:
>> @@ -1184,8 +1185,11 @@ static unsigned long isolate_lru_pages(u
>> Â Â Â Â Â Â Â Â Â Â Â ÂBUG();
>> Â Â Â Â Â Â Â Â}
>>
>> + Â Â Â Â Â Â Â nr_taken += isolated_pages;
>> Â Â Â Â Â Â Â Âif (!order)
>> Â Â Â Â Â Â Â Â Â Â Â Âcontinue;
>> + Â Â Â Â Â Â Â if (isolated_pages != 1&& Âisolated_pages>= (1<< Âorder))
>> + Â Â Â Â Â Â Â Â Â Â Â continue;
>
>
> strange space alignment. and I don't think we need "isolated_pages != 1"
> check.
>
> Otherwise, Looks good to me.
>
> Acked-by: KOSAKI Motohiro <kosaki.motohiro@xxxxxxxxxxxxxx>
>

Hi KOSAKI

It is re-prepared and please review again.
1, changelog is updated,
2, the check for page order is refined,
3, comment is also added.

Thanks
Hillf

===cut please===
From: Hillf Danton <dhillf@xxxxxxxxx>
Subject: [PATCH] mm: vmscam: check page order in isolating lru pages

Before try to isolate physically contiguous pages, check for page order is
added, and if it is not regular page, we should give up the attempt.

Signed-off-by: Hillf Danton <dhillf@xxxxxxxxx>
Acked-by: KOSAKI Motohiro <kosaki.motohiro@xxxxxxxxxxxxxx>
Cc: Michal Hocko <mhocko@xxxxxxx>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx>
Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Cc: David Rientjes <rientjes@xxxxxxxxxx>
Cc: Hugh Dickins <hughd@xxxxxxxxxx>
Cc: Andrea Arcangeli <aarcange@xxxxxxxxxx>
Cc: Mel Gorman <mgorman@xxxxxxx>
---

--- a/mm/vmscan.c Thu Dec 29 20:20:16 2011
+++ b/mm/vmscan.c Sat Dec 31 22:44:16 2011
@@ -1162,6 +1162,7 @@ static unsigned long isolate_lru_pages(u
unsigned long end_pfn;
unsigned long page_pfn;
int zone_id;
+ unsigned int isolated_pages = 1;

page = lru_to_page(src);
prefetchw_prev_lru_page(page, src, flags);
@@ -1172,7 +1173,7 @@ static unsigned long isolate_lru_pages(u
case 0:
mem_cgroup_lru_del(page);
list_move(&page->lru, dst);
- nr_taken += hpage_nr_pages(page);
+ isolated_pages = hpage_nr_pages(page);
break;

case -EBUSY:
@@ -1184,8 +1185,12 @@ static unsigned long isolate_lru_pages(u
BUG();
}

+ nr_taken += isolated_pages;
if (!order)
continue;
+ /* try pfn-based isolation only for regular page */
+ if (isolated_pages != 1)
+ continue;

/*
* Attempt to take all pages in the order aligned region
@@ -1227,7 +1232,6 @@ static unsigned long isolate_lru_pages(u
break;

if (__isolate_lru_page(cursor_page, mode, file) == 0) {
- unsigned int isolated_pages;

mem_cgroup_lru_del(cursor_page);
list_move(&cursor_page->lru, dst);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/