Skip to contentSkip to conversation

vmscan: Make move_active_pages_to_lru more generic

PATCH In review Minchan Kim 3 participants 6 messages Nov 21, 2010 – Nov 22, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vmscan: Make move_active_pages_to_lru more generic

Now move_active_pages_to_lru can move pages into active or inactive. if it moves the pages into inactive, it itself can clear PG_acive. It makes the function more generic.

Cc Wu Fengguang <[email protected]>
Cc Rik van Riel <[email protected]>
Cc KOSAKI Motohiro <[email protected]>
Cc Johannes Weiner <[email protected]>
---
 mm/vmscan.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
mm/vmscan.c +4 -1
index aa4f1cb..bd408b3 100644
@@ -1457,6 +1457,10 @@ static void move_active_pages_to_lru(struct zone *zone,
 		VM_BUG_ON(PageLRU(page));
 		SetPageLRU(page);
 
+		/* we are de-activating */
+		if (!is_active_lru(lru))
+			ClearPageActive(page);
+
 		list_move(&page->lru, &zone->lru[lru].list);
 		mem_cgroup_add_lru_list(page, lru);
 		pgmoved++;
@@ -1543,7 +1547,6 @@ static void shrink_active_list(unsigned long nr_pages, struct zone *zone,
 			}
 		}
 
-		ClearPageActive(page);  /* we are de-activating */
 		list_add(&page->lru, &l_inactive);
 	}
 
Signature · 1 line
1.7.0.4
#1 lore raw
Quoted 9 lines · Minchan Kim

Now move_active_pages_to_lru can move pages into active or inactive. if it moves the pages into inactive, it itself can clear PG_acive. It makes the function more generic.

mm/vmscan.c +0 -0
index aa4f1cb..bd408b3 100644

mm/vmscan.c static void move_active_pages_to_lru(struct zone *zone, · line 1463

Quoted 7 lines
mm/vmscan.c +4 -0
@@ -1457,6 +1457,10 @@ static void move_active_pages_to_lru(struct zone *zone,
  		VM_BUG_ON(PageLRU(page));
  		SetPageLRU(page);
 
+		/* we are de-activating */
+		if (!is_active_lru(lru))
+			ClearPageActive(page);
+

Does that mean we also want code to ensure that pages have the PG_active bit set when we add them to an active list?

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 policy in Canada: sign http://dissolvethecrtc.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#2 lore raw
Quoted 15 lines · Rik van Riel
Quoted 14 lines · Minchan Kim

Now move_active_pages_to_lru can move pages into active or inactive. if it moves the pages into inactive, it itself can clear PG_acive. It makes the function more generic.

mm/vmscan.c +0 -0
index aa4f1cb..bd408b3 100644
@@ -1457,6 +1457,10 @@ static void move_active_pages_to_lru(struct zone
 *zone,
                VM_BUG_ON(PageLRU(page));
                SetPageLRU(page);
 
Quoted 7 lines

mm/vmscan.c static void move_active_pages_to_lru(struct zone *zone, · line 1463

Quoted 4 lines
mm/vmscan.c +4 -0
+               /* we are de-activating */
+               if (!is_active_lru(lru))
+                       ClearPageActive(page);
+

Does that mean we also want code to ensure that pages have the PG_active bit set when we add them to an active list?

Yes. the function name is move_"active"_pages_to_lru. So caller have to make sure pages have PG_active.

Quoted 4 lines

--
All rights reversed

Signature · 9 lines
Kind regards,
Minchan Kim

--
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 policy in Canada: sign http://dissolvethecrtc.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Acked-by
#3 lore raw
Quoted 24 lines · Minchan Kim
Quoted 15 lines · Rik van Riel
Quoted 14 lines · Minchan Kim

Now move_active_pages_to_lru can move pages into active or inactive. if it moves the pages into inactive, it itself can clear PG_acive. It makes the function more generic.

mm/vmscan.c +0 -0
index aa4f1cb..bd408b3 100644
@@ -1457,6 +1457,10 @@ static void move_active_pages_to_lru(struct zone
 *zone,
                VM_BUG_ON(PageLRU(page));
                SetPageLRU(page);
 
Quoted 7 lines

mm/vmscan.c static void move_active_pages_to_lru(struct zone *zone, · line 1463

Quoted 4 lines
mm/vmscan.c +4 -0
+               /* we are de-activating */
+               if (!is_active_lru(lru))
+                       ClearPageActive(page);
+

Does that mean we also want code to ensure that pages have the PG_active bit set when we add them to an active list?

Quoted 2 lines

Yes. the function name is move_"active"_pages_to_lru. So caller have to make sure pages have PG_active.

Good point.

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 policy in Canada: sign http://dissolvethecrtc.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#4 lore raw
In reply to Minchan Kim
Quoted 3 lines · Minchan Kim

Now move_active_pages_to_lru can move pages into active or inactive. if it moves the pages into inactive, it itself can clear PG_acive. It makes the function more generic.

Do you plan to use this "more generic" function? Because the patch in itself makes code slightly less efficient. It adds one "if" test, and moves one operation into the spin lock.

Thanks,
Fengguang

--
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 policy in Canada: sign http://dissolvethecrtc.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#5 lore raw

Hi Wu,

Quoted 8 lines · Wu Fengguang
Quoted 3 lines · Minchan Kim

Now move_active_pages_to_lru can move pages into active or inactive. if it moves the pages into inactive, it itself can clear PG_acive. It makes the function more generic.

Do you plan to use this "more generic" function? Because the patch in itself makes code slightly less efficient. It adds one "if" test, and moves one operation into the spin lock.

I tried to use it in my deactivate page series but couldn't use it due some problem.
So I don't have a plan to use it. It's just my preference(and I hope others think like me :) )

I hope function itself would be generic and clear because some people in future might use it and reference it.
If my change makes big cost, I am not against you. otherwise, I hope move_active_pages_to_lru become self-contained.

Quoted 4 lines

Thanks,
Fengguang

Signature · 9 lines
Kind regards,
Minchan Kim

--
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 policy in Canada: sign http://dissolvethecrtc.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>