Skip to contentSkip to conversation

Fix and Enhance deactive_page

PATCH In review Minchan Kim 2 participants 4 messages May 3, 2011 Memory management

lore
Share & tools
lore
#0 lore raw

v2 cover Fix and Enhance deactive_page

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 [email protected]. 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:"[email protected]"> [email protected] </a>

#1 lore raw

PATCH v2 1/2 Check PageUnevictable in lru_deactivate_fn

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.

---
 mm/swap.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
mm/swap.c +3 -0
index a83ec5a..2e9656d 100644
@@ -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;
Signature · 8 lines
1.7.1

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  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:"[email protected]"> [email protected] </a>
#2 lore raw

PATCH v2 2/2 Filter unevictable page out in deactivate_page

In reply to 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)

---
 mm/swap.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
mm/swap.c +9 -0
index 2e9656d..e121ceb 100644
@@ -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);
 
Signature · 8 lines
1.7.1

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  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:"[email protected]"> [email protected] </a>
Reviewed-by on v2 2/2
#3 lore raw

Re: [PATCH v2 2/2] Filter unevictable page out in deactivate_page

Quoted 7 lines · 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)

Signature · 8 lines
All rights reversed

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  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:"[email protected]"> [email protected] </a>