linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] Fix and Enhance deactive_page
@ 2011-05-03 14:48 Minchan Kim
  2011-05-03 14:48 ` [PATCH v2 1/2] Check PageUnevictable in lru_deactivate_fn Minchan Kim
  2011-05-03 14:48 ` [PATCH v2 2/2] Filter unevictable page out in deactivate_page Minchan Kim
  0 siblings, 2 replies; 4+ messages in thread
From: Minchan Kim @ 2011-05-03 14:48 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-mm, LKML, KAMEZAWA Hiroyuki, Johannes Weiner, Rik van Riel,
	KOSAKI Motohiro, Mel Gorman, Ying Han, Minchan Kim

A few days ago, Ying reported a problem.
http://marc.info/?l=linux-mm&m=130403310601663&w=2
After I and Ying dive in problem, We found deactive_page
has a problem. Apparently, It's a BUG so 
[1/2] is fix of the problem and [2/2] is enhancement for 
helping CPU.

* v2
  - add Reviewed-by signs
  - Fix typo

Minchan Kim (2):
  [1/2] Check PageUnevictable in lru_deactivate_fn
  [2/2] Filter unevictable page out in deactivate_page

 mm/swap.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* [PATCH v2 1/2] Check PageUnevictable in lru_deactivate_fn
  2011-05-03 14:48 [PATCH v2 0/2] Fix and Enhance deactive_page Minchan Kim
@ 2011-05-03 14:48 ` Minchan Kim
  2011-05-03 14:48 ` [PATCH v2 2/2] Filter unevictable page out in deactivate_page Minchan Kim
  1 sibling, 0 replies; 4+ messages in thread
From: Minchan Kim @ 2011-05-03 14:48 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-mm, LKML, KAMEZAWA Hiroyuki, Johannes Weiner, Rik van Riel,
	KOSAKI Motohiro, Mel Gorman, Ying Han, Minchan Kim

The lru_deactivate_fn should not move page which in on unevictable lru
into inactive list. Otherwise, we can meet BUG when we use isolate_lru_pages
as __isolate_lru_page could return -EINVAL.
It's really BUG and let's fix it.

Reported-by: Ying Han <yinghan@google.com>
Tested-by: Ying Han <yinghan@google.com>
Reviewed-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Reviewed-by: Rik van Riel<riel@redhat.com>
Signed-off-by: Minchan Kim <minchan.kim@gmail.com>
---
 mm/swap.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/mm/swap.c b/mm/swap.c
index a83ec5a..2e9656d 100644
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -429,6 +429,9 @@ static void lru_deactivate_fn(struct page *page, void *arg)
 	if (!PageLRU(page))
 		return;
 
+	if (PageUnevictable(page))
+		return;
+
 	/* Some processes are using the page */
 	if (page_mapped(page))
 		return;
-- 
1.7.1

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* [PATCH v2 2/2] Filter unevictable page out in deactivate_page
  2011-05-03 14:48 [PATCH v2 0/2] Fix and Enhance deactive_page Minchan Kim
  2011-05-03 14:48 ` [PATCH v2 1/2] Check PageUnevictable in lru_deactivate_fn Minchan Kim
@ 2011-05-03 14:48 ` Minchan Kim
  2011-05-03 14:50   ` Rik van Riel
  1 sibling, 1 reply; 4+ messages in thread
From: Minchan Kim @ 2011-05-03 14:48 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-mm, LKML, KAMEZAWA Hiroyuki, Johannes Weiner, Rik van Riel,
	KOSAKI Motohiro, Mel Gorman, Ying Han, Minchan Kim

It's pointless that deactive_page's pagevec operation about
unevictable page as it's nop.
This patch removes unnecessary overhead which might be a bit problem
in case that there are many unevictable page in system(ex, mprotect workload)

Reviewed-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Signed-off-by: Minchan Kim <minchan.kim@gmail.com>
---
 mm/swap.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/mm/swap.c b/mm/swap.c
index 2e9656d..e121ceb 100644
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -511,6 +511,15 @@ static void drain_cpu_pagevecs(int cpu)
  */
 void deactivate_page(struct page *page)
 {
+
+	/*
+	 * In workload which system has many unevictable page(ex, mprotect),
+	 * unevictable page deactivation for accelerating reclaim
+	 * is pointless.
+	 */
+	if (PageUnevictable(page))
+		return;
+
 	if (likely(get_page_unless_zero(page))) {
 		struct pagevec *pvec = &get_cpu_var(lru_deactivate_pvecs);
 
-- 
1.7.1

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH v2 2/2] Filter unevictable page out in deactivate_page
  2011-05-03 14:48 ` [PATCH v2 2/2] Filter unevictable page out in deactivate_page Minchan Kim
@ 2011-05-03 14:50   ` Rik van Riel
  0 siblings, 0 replies; 4+ messages in thread
From: Rik van Riel @ 2011-05-03 14:50 UTC (permalink / raw)
  To: Minchan Kim
  Cc: Andrew Morton, linux-mm, LKML, KAMEZAWA Hiroyuki, Johannes Weiner,
	KOSAKI Motohiro, Mel Gorman, Ying Han

On 05/03/2011 10:48 AM, Minchan Kim wrote:
> It's pointless that deactive_page's pagevec operation about
> unevictable page as it's nop.
> This patch removes unnecessary overhead which might be a bit problem
> in case that there are many unevictable page in system(ex, mprotect workload)
>
> Reviewed-by: KOSAKI Motohiro<kosaki.motohiro@jp.fujitsu.com>
> Signed-off-by: Minchan Kim<minchan.kim@gmail.com>

Reviewed-by: Rik van Riel<riel@redhat.com>

-- 
All rights reversed

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

end of thread, other threads:[~2011-05-03 14:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-03 14:48 [PATCH v2 0/2] Fix and Enhance deactive_page Minchan Kim
2011-05-03 14:48 ` [PATCH v2 1/2] Check PageUnevictable in lru_deactivate_fn Minchan Kim
2011-05-03 14:48 ` [PATCH v2 2/2] Filter unevictable page out in deactivate_page Minchan Kim
2011-05-03 14:50   ` Rik van Riel

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