move ClearPageActive from move_active_pages() to shrink_active_list()
Subsystems (3)
PATCH 1/5 move ClearPageActive from move_active_pages() to shrink_active_list()
This patch series are several vmscan cleanups.
===================
Subject: [PATCH] move ClearPageActive from move_active_pages() to shrink_active_list()
The mvoe_active_pages_to_lru() function is called under irq disabled and ClearPageActive() doesn't need irq disabling.
Then, this patch move it into shrink_active_list().
--- mm/vmscan.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
mm/vmscan.c +1 -4
@@ -1230,10 +1230,6 @@ static void move_active_pages_to_lru(strVM_BUG_ON (PageLRU (page));SetPageLRU (page); -VM_BUG_ON (!PageActive (page)); -if (!is_active_lru (lru)) -ClearPageActive (page);/* we are de-activating */ -list_move (&page->lru, &zone->lru[lru].list);mem_cgroup_add_lru_list (page, lru); pgmoved++;
@@ -1315,6 +1311,7 @@ static void shrink_active_list(unsigned } } +ClearPageActive (page);/* we are de-activating */ list_add (&page->lru, &l_inactive); }
--
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/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 2/5 Kill unnecessary page flag test
Subject: [PATCH] Kill unnecessary page flag test
The page_lru() already evaluate PageActive() and PageSwapBacked(). We don't need to re-evaluate it.
--- mm/vmscan.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
mm/vmscan.c +2 -2
@@ -1160,8 +1160,8 @@ static unsigned long shrink_inactive_lisSetPageLRU (page); lru =page_lru (page);add_page_to_lru_list (zone, page, lru); -if (PageActive (page)) { -int file = !!page_is_file_cache (page); +if (is_active_lru (lru)) { +int file = !!is_file_lru (lru); reclaim_stat->recent_rotated[file]++; }if (!pagevec_add (&pvec, page)) {
--
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/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 3/5 Kill unnecessary prefetch
In reply to KOSAKI MotohiroSubject: Kill unnecessary prefetch
The pages in the list passed move_active_pages_to_lru() are already touched by shrink_active_list(). IOW the prefetch in move_active_pages_to_lru() don't populate any cache. it's pointless.
This patch remove it.
--- mm/vmscan.c | 1 - 1 file changed, 1 deletion(-)
mm/vmscan.c +0 -1
@@ -1225,7 +1225,6 @@ static void move_active_pages_to_lru(strwhile (!list_empty (list)) { page =lru_to_page (list); -prefetchw_prev_lru_page (page, list, flags);VM_BUG_ON (PageLRU (page));SetPageLRU (page);
--
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/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 4/5 Use add_page_to_lru_list() helper function
In reply to KOSAKI MotohiroSubject: Use add_page_to_lru_list() helper function
add_page_to_lru_list() is equivalent to
- add lru list (global)
- add lru list (mem-cgroup)
- modify zone stat
We can use it.
--- mm/vmscan.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
mm/vmscan.c +2 -3
@@ -1225,12 +1225,12 @@ static void move_active_pages_to_lru(strwhile (!list_empty (list)) { page =lru_to_page (list); +list_del (&page->lru);VM_BUG_ON (PageLRU (page));SetPageLRU (page); -list_move (&page->lru, &zone->lru[lru].list); -mem_cgroup_add_lru_list (page, lru); +add_page_to_lru_list (zone, page, lru); pgmoved++;if (!pagevec_add (&pvec, page) ||list_empty (list)) {
@@ -1241,7 +1241,6 @@ static void move_active_pages_to_lru(strspin_lock_irq (&zone->lru_lock); } } -__mod_zone_page_state (zone,NR_LRU_BASE + lru, pgmoved);if (!is_active_lru (lru))__count_vm_events (PGDEACTIVATE , pgmoved); }
--
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/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 5/5 move PGDEACTIVATE modification to shrink_active_list()
In reply to KOSAKI MotohiroSubject: move PGDEACTIVATE modification to shrink_active_list()
Pgmoved accounting in move_active_pages_to_lru() doesn't make any sense. it can be calculated in irq enabled area.
This patch move #-of-deactivating-pages calcution to shrink_active_list().
--- mm/vmscan.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
mm/vmscan.c +3 -4
@@ -1217,7 +1217,6 @@ static void move_active_pages_to_lru(str struct list_head *list, enum lru_list lru) { -unsigned long pgmoved =0 ;struct pagevec pvec;struct page *page;
@@ -1231,7 +1230,6 @@ static void move_active_pages_to_lru(strSetPageLRU (page);add_page_to_lru_list (zone, page, lru); - pgmoved++;if (!pagevec_add (&pvec, page) ||list_empty (list)) {spin_unlock_irq (&zone->lru_lock);
@@ -1241,8 +1239,6 @@ static void move_active_pages_to_lru(strspin_lock_irq (&zone->lru_lock); } } -if (!is_active_lru (lru)) -__count_vm_events (PGDEACTIVATE , pgmoved); } static void shrink_active_list(unsigned long nr_pages, struct zone *zone,
@@ -1257,6 +1253,7 @@ static void shrink_active_list(unsignedstruct page *page;struct zone_reclaim_stat *reclaim_stat =get_reclaim_stat (zone, sc);unsigned long nr_rotated =0 ; +unsigned long nr_deactivate =0 ;lru_add_drain ();spin_lock_irq (&zone->lru_lock);
@@ -1311,6 +1308,7 @@ static void shrink_active_list(unsignedClearPageActive (page);/* we are de-activating */ list_add (&page->lru, &l_inactive); + nr_deactivate++; }/*
@@ -1324,6 +1322,7 @@ static void shrink_active_list(unsigned* get_scan_ratio. */ reclaim_stat->recent_rotated[!!file] += nr_rotated; +__count_vm_events (PGDEACTIVATE , nr_deactivate);move_active_pages_to_lru (zone, &l_active,LRU_ACTIVE + file *LRU_FILE );
--
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/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 1 line · KOSAKI Motohiro
This patch series are several vmscan cleanups.
--
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/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 4/5] Use add_page_to_lru_list() helper function
In reply to KOSAKI MotohiroQuoted 34 lines · KOSAKI Motohiro
Subject: Use
add_page_to_lru_list()helper function
add_page_to_lru_list()is equivalent to
- add lru list (global)
- add lru list (mem-cgroup)
- modify zone statWe can use it.
Signed-off-by KOSAKI Motohiro <[email protected]>--- mm/vmscan.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)Index:
b/mm/vmscan.c
===================================================================mm/vmscan.c +2
-2@@ -1225,12 +1225,12 @@ static void move_active_pages_to_lru(strwhile (!list_empty (list)) { page =lru_to_page (list); +list_del (&page->lru);VM_BUG_ON (PageLRU (page));SetPageLRU (page); -list_move (&page->lru, &zone->lru[lru].list); -mem_cgroup_add_lru_list (page, lru); +add_page_to_lru_list (zone, page, lru); pgmoved++;if (!pagevec_add (&pvec, page) ||list_empty (list)) {
mm/vmscan.c static void move_active_pages_to_lru(str · line 1246
Quoted 7 lines
mm/vmscan.c +0
-1@@ -1241,7 +1241,6 @@ static void move_active_pages_to_lru(strspin_lock_irq (&zone->lru_lock); } } -__mod_zone_page_state (zone,NR_LRU_BASE + lru, pgmoved);if (!is_active_lru (lru))__count_vm_events (PGDEACTIVATE , pgmoved); }
This is a net loss, you introduce pgmoved calls to __inc_zone_state, instead of the one __mod_zone_page_state() call.
--
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/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 4/5] Use add_page_to_lru_list() helper function
Quoted 11 lines
mm/vmscan.c static void move_active_pages_to_lru(str · line 1246
Quoted 8 lines
mm/vmscan.c +0
-1@@ -1241,7 +1241,6 @@ static void move_active_pages_to_lru(strspin_lock_irq (&zone->lru_lock); } } -__mod_zone_page_state (zone,NR_LRU_BASE + lru, pgmoved);if (!is_active_lru (lru))__count_vm_events (PGDEACTIVATE , pgmoved); }This is a net loss, you introduce pgmoved calls to
__inc_zone_state, instead of the one__mod_zone_page_state()call.
max pgmoved is 32. 32 times __inc_zone_state() make 0 or 1 time atomic operation (not much than two).
I don't think it reduce performance.
--
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/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 4/5] Use add_page_to_lru_list() helper function
Quoted 12 lines · KOSAKI Motohiro
Quoted 11 lines
mm/vmscan.c static void move_active_pages_to_lru(str · line 1246
Quoted 8 lines
mm/vmscan.c +0
-1@@ -1241,7 +1241,6 @@ static void move_active_pages_to_lru(strspin_lock_irq (&zone->lru_lock); } } -__mod_zone_page_state (zone,NR_LRU_BASE + lru, pgmoved);if (!is_active_lru (lru))__count_vm_events (PGDEACTIVATE , pgmoved); }This is a net loss, you introduce pgmoved calls to
__inc_zone_state, instead of the one__mod_zone_page_state()call.
Quoted 3 lines
max pgmoved is 32. 32 times
__inc_zone_state()make 0 or 1 time atomic operation (not much than two).
I don't think it reduce performance.
its not just atomics, count calls and branches too. It simply adds a ton of code for no particular reason.
--
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/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 4/5] Use add_page_to_lru_list() helper function
Quoted 13 lines · KOSAKI Motohiro
Quoted 12 lines
Quoted 11 lines
mm/vmscan.c static void move_active_pages_to_lru(str · line 1246
Quoted 8 lines
mm/vmscan.c +0
-1@@ -1241,7 +1241,6 @@ static void move_active_pages_to_lru(strspin_lock_irq (&zone->lru_lock); } } -__mod_zone_page_state (zone,NR_LRU_BASE + lru, pgmoved);if (!is_active_lru (lru))__count_vm_events (PGDEACTIVATE , pgmoved); }This is a net loss, you introduce pgmoved calls to
__inc_zone_state, instead of the one__mod_zone_page_state()call.
Quoted 6 lines
Quoted 3 lines
max pgmoved is 32. 32 times
__inc_zone_state()make 0 or 1 time atomic operation (not much than two).
I don't think it reduce performance.its not just atomics, count calls and branches too. It simply adds a ton of code for no particular reason.
hm, I don't think it's tons penalty. I mean vmscan makes tons cache miss and function calling penalty is hidden by it.
But, I agreed this patch doesn't have strong motivation. I can drop this.
Andrew, Can you please drop this patch?
--
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/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>