Account the number of isolate pages
Subsystems (8)
cover Account the number of isolate pages
Hi
This patch series have following three patches.
[1/3] Rename pgmoved variable in shrink_active_list() [2/3] mm: shrink_inactive_lis() nr_scan accounting fix fix [3/3] add isolate pages vmstat
[1/3] and [2/3] are trivial code neating. [3/3] is the heart of this fix.
--
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 1/3 Rename pgmoved variable in shrink_active_list()
Subject: [PATCH] Rename pgmoved variable in shrink_active_list()
Currently, pgmoved variable have two meanings. it cause harder reviewing a bit. This patch separate it.
--- mm/vmscan.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
mm/vmscan.c +8 -8
@@ -1239,7 +1239,7 @@ static void move_active_pages_to_lru(strstatic void shrink_active_list (unsigned long nr_pages,struct zone *zone,struct scan_control *sc,int priority,int file) { -unsigned long pgmoved; +unsigned long nr_taken;unsigned long pgscanned;unsigned long vm_flags;LIST_HEAD (l_hold);/* The pages which were snipped off */
@@ -1247,10 +1247,11 @@ static void shrink_active_list(unsignedLIST_HEAD (l_inactive);struct page *page;struct zone_reclaim_stat *reclaim_stat =get_reclaim_stat (zone, sc); +unsigned long nr_rotated =0 ;lru_add_drain ();spin_lock_irq (&zone->lru_lock); - pgmoved = sc->isolate_pages (nr_pages, &l_hold, &pgscanned, sc->order, + nr_taken = sc->isolate_pages (nr_pages, &l_hold, &pgscanned, sc->order,ISOLATE_ACTIVE , zone, sc->mem_cgroup,1 , file);/*
@@ -1260,16 +1261,15 @@ static void shrink_active_list(unsignedif (scanning_global_lru (sc)) { zone->pages_scanned += pgscanned; } - reclaim_stat->recent_scanned[!!file] += pgmoved; + reclaim_stat->recent_scanned[!!file] += nr_taken;__count_zone_vm_events (PGREFILL , zone, pgscanned);if (file) -__mod_zone_page_state (zone,NR_ACTIVE_FILE , -pgmoved); +__mod_zone_page_state (zone,NR_ACTIVE_FILE , -nr_taken);else -__mod_zone_page_state (zone,NR_ACTIVE_ANON , -pgmoved); +__mod_zone_page_state (zone,NR_ACTIVE_ANON , -nr_taken);spin_unlock_irq (&zone->lru_lock); - pgmoved =0 ;/* count referenced (mapping) mapped pages */ while (!list_empty (&l_hold)) {cond_resched (); page =lru_to_page (&l_hold);
@@ -1283,7 +1283,7 @@ static void shrink_active_list(unsigned/* page_referenced clears PageReferenced */ if (page_mapping_inuse (page) &&page_referenced (page,0 , sc->mem_cgroup, &vm_flags)) { - pgmoved++; + nr_rotated++;/* * Identify referenced, file-backed active pages and * give them one more trip around the active list. So
@@ -1312,7 +1312,7 @@ static void shrink_active_list(unsigned* helps balance scan pressure between file and anonymous pages in * get_scan_ratio. */ - reclaim_stat->recent_rotated[!!file] += pgmoved; + reclaim_stat->recent_rotated[!!file] += nr_rotated;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>
PATCH 2/3 mm: shrink_inactive_lis() nr_scan accounting fix fix
In reply to KOSAKI MotohiroSubject: [PATCH] mm: shrink_inactive_lis() nr_scan accounting fix fix
If sc->isolate_pages() return 0, we don't need to call shrink_page_list(). In past days, shrink_inactive_list() handled it properly.
But commit fb8d14e1 (three years ago commit!) breaked it. current shrink_inactive_list() always call shrink_page_list() although isolate_pages() return 0.
This patch restore proper return value check.
Requirements:
o "nr_taken == 0" condition should stay before calling shrink_page_list().
o "nr_taken == 0" condition should stay after nr_scan related statistics modification.
--- mm/vmscan.c | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-)
mm/vmscan.c +18 -12
@@ -1071,6 +1071,20 @@ static unsigned long shrink_inactive_lis nr_taken = sc->isolate_pages (sc->swap_cluster_max, &page_list, &nr_scan, sc->order, mode, zone, sc->mem_cgroup,0 , file); + +if (scanning_global_lru (sc)) { + zone->pages_scanned += nr_scan; +if (current_is_kswapd ()) +__count_zone_vm_events (PGSCAN_KSWAPD , zone, + nr_scan); +else +__count_zone_vm_events (PGSCAN_DIRECT , zone, + nr_scan); + } + +if (nr_taken ==0 ) + goto done; + nr_active =clear_active_flags (&page_list, count);__count_vm_events (PGDEACTIVATE , nr_active);
@@ -1083,8 +1097,6 @@ static unsigned long shrink_inactive_lis__mod_zone_page_state (zone,NR_INACTIVE_ANON , -count[LRU_INACTIVE_ANON ]); -if (scanning_global_lru (sc)) - zone->pages_scanned += nr_scan; reclaim_stat->recent_scanned[0 ] += count[LRU_INACTIVE_ANON ]; reclaim_stat->recent_scanned[0 ] += count[LRU_ACTIVE_ANON ];
@@ -1118,18 +1130,12 @@ static unsigned long shrink_inactive_lis } nr_reclaimed += nr_freed; +local_irq_disable (); -if (current_is_kswapd ()) { -__count_zone_vm_events (PGSCAN_KSWAPD , zone, nr_scan); +if (current_is_kswapd ())__count_vm_events (KSWAPD_STEAL , nr_freed); - }else if (scanning_global_lru (sc)) -__count_zone_vm_events (PGSCAN_DIRECT , zone, nr_scan); -__count_zone_vm_events (PGSTEAL , zone, nr_freed); -if (nr_taken ==0 ) - goto done; -spin_lock (&zone->lru_lock);/* * Put back any unfreeable pages.
@@ -1159,9 +1165,9 @@ static unsigned long shrink_inactive_lis } } }while (nr_scanned < max_scan); -spin_unlock (&zone->lru_lock); + done: -local_irq_enable (); +spin_unlock_irq (&zone->lru_lock);pagevec_release (&pvec);return nr_reclaimed; }
--
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/3 add isolate pages vmstat
In reply to KOSAKI MotohiroChangeLog
Since v5
- Rewrote the description
- Treat page migration
Since v4
- Changed displaing order in show_free_areas() (as Wu's suggested)
Since v3
- Fixed misaccount page bug when lumby reclaim occur
Since v2
- Separated IsolateLRU field to Isolated(anon) and Isolated(file)
Since v1
- Renamed IsolatePages to IsolatedLRU
==================================
Subject: [PATCH] add isolate pages vmstat
If the system is running a heavy load of processes then concurrent reclaim can isolate a large numbe of pages from the LRU. /proc/meminfo and the output generated for an OOM do not show how many pages were isolated.
This patch shows the information about isolated pages.
reproduce way
-----------------------
% ./hackbench 140 process 1000
=> OOM occur
active_anon:146 inactive_anon:0 isolated_anon:49245
active_file:79 inactive_file:18 isolated_file:113 unevictable:0 dirty:0 writeback:0 unstable:0 buffer:39 free:370 slab_reclaimable:309 slab_unreclaimable:5492 mapped:53 shmem:15 pagetables:28140 bounce:0
--- drivers/base/node.c | 4 ++++ fs/proc/meminfo.c | 4 ++++ include/linux/mmzone.h | 2 ++ mm/migrate.c | 11 +++++++++++ mm/page_alloc.c | 12 +++++++++--- mm/vmscan.c | 12 +++++++++++- mm/vmstat.c | 2 ++ 7 files changed, 43 insertions(+), 4 deletions(-)
fs/proc/meminfo.c +4 -0
@@ -65,6 +65,8 @@ static int meminfo_proc_show(struct seq_"Active(file): %8lu kB\n" "Inactive(file): %8lu kB\n" "Unevictable: %8lu kB\n" +"Isolated(anon): %8lu kB\n" +"Isolated(file): %8lu kB\n" "Mlocked: %8lu kB\n" #ifdef CONFIG_HIGHMEM"HighTotal: %8lu kB\n"
@@ -110,6 +112,8 @@ static int meminfo_proc_show(struct seq_K (pages[LRU_ACTIVE_FILE ]),K (pages[LRU_INACTIVE_FILE ]),K (pages[LRU_UNEVICTABLE ]), +K (global_page_state (NR_ISOLATED_ANON )), +K (global_page_state (NR_ISOLATED_FILE )),K (global_page_state (NR_MLOCK )), #ifdef CONFIG_HIGHMEM K(i.totalhigh),
include/linux/mmzone.h +2 -0
@@ -100,6 +100,8 @@ enum zone_stat_item {NR_BOUNCE ,NR_VMSCAN_WRITE ,NR_WRITEBACK_TEMP ,/* Writeback using temporary buffers */ +NR_ISOLATED_ANON ,/* Temporary isolated pages from anon lru */ +NR_ISOLATED_FILE ,/* Temporary isolated pages from file lru */ NR_SHMEM ,/* shmem pages (included tmpfs/GEM pages) */ #ifdef CONFIG_NUMA NUMA_HIT, /* allocated in intended node */
mm/page_alloc.c +9 -3
@@ -2115,16 +2115,18 @@ void show_free_areas(void) } } - printk("Active_anon:%lu active_file:%lu inactive_anon:%lu\n" - " inactive_file:%lu" + printk("active_anon:%lu inactive_anon:%lu isolated_anon:%lu\n" + " active_file:%lu inactive_file:%lu isolated_file:%lu\n" " unevictable:%lu" " dirty:%lu writeback:%lu unstable:%lu buffer:%lu\n" " free:%lu slab_reclaimable:%lu slab_unreclaimable:%lu\n" " mapped:%lu shmem:%lu pagetables:%lu bounce:%lu\n", global_page_state(NR_ACTIVE_ANON), - global_page_state(NR_ACTIVE_FILE), global_page_state(NR_INACTIVE_ANON), + global_page_state(NR_ISOLATED_ANON), + global_page_state(NR_ACTIVE_FILE), global_page_state(NR_INACTIVE_FILE), + global_page_state(NR_ISOLATED_FILE), global_page_state(NR_UNEVICTABLE), global_page_state(NR_FILE_DIRTY), global_page_state(NR_WRITEBACK),
@@ -2152,6 +2154,8 @@ void show_free_areas(void)" active_file:%lukB" " inactive_file:%lukB" " unevictable:%lukB" +" isolated(anon):%lukB" +" isolated(file):%lukB" " present:%lukB" " mlocked:%lukB" " dirty:%lukB"
@@ -2178,6 +2182,8 @@ void show_free_areas(void)K (zone_page_state (zone,NR_ACTIVE_FILE )),K (zone_page_state (zone,NR_INACTIVE_FILE )),K (zone_page_state (zone,NR_UNEVICTABLE )), +K (zone_page_state (zone,NR_ISOLATED_ANON )), +K (zone_page_state (zone,NR_ISOLATED_FILE )),K (zone->present_pages),K (zone_page_state (zone,NR_MLOCK )), K(zone_page_state(zone, NR_FILE_DIRTY)),
mm/vmscan.c +11 -1
@@ -1067,6 +1067,8 @@ static unsigned long shrink_inactive_lisunsigned long nr_active;unsigned int count[NR_LRU_LISTS ] = {0 , };int mode = lumpy_reclaim ?ISOLATE_BOTH :ISOLATE_INACTIVE ; +unsigned long nr_anon; +unsigned long nr_file; nr_taken = sc->isolate_pages(sc->swap_cluster_max, &page_list, &nr_scan, sc->order, mode,
@@ -1097,6 +1099,10 @@ static unsigned long shrink_inactive_lis__mod_zone_page_state (zone,NR_INACTIVE_ANON , -count[LRU_INACTIVE_ANON ]); + nr_anon = count[LRU_ACTIVE_ANON ] + count[LRU_INACTIVE_ANON ]; + nr_file = count[LRU_ACTIVE_FILE ] + count[LRU_INACTIVE_FILE ]; +__mod_zone_page_state (zone,NR_ISOLATED_ANON , nr_anon); +__mod_zone_page_state (zone,NR_ISOLATED_FILE , nr_file); reclaim_stat->recent_scanned[0 ] += count[LRU_INACTIVE_ANON ]; reclaim_stat->recent_scanned[0 ] += count[LRU_ACTIVE_ANON ];
@@ -1164,6 +1170,9 @@ static unsigned long shrink_inactive_lisspin_lock_irq (&zone->lru_lock); } } +__mod_zone_page_state (zone,NR_ISOLATED_ANON , -nr_anon); +__mod_zone_page_state (zone,NR_ISOLATED_FILE , -nr_file); + }while (nr_scanned < max_scan); done:
@@ -1274,6 +1283,7 @@ static void shrink_active_list(unsigned__mod_zone_page_state (zone,NR_ACTIVE_FILE , -nr_taken); else __mod_zone_page_state(zone, NR_ACTIVE_ANON, -nr_taken); +__mod_zone_page_state (zone,NR_ISOLATED_ANON + file, nr_taken);spin_unlock_irq (&zone->lru_lock);while (!list_empty (&l_hold)) {
@@ -1324,7 +1334,7 @@ static void shrink_active_list(unsigned LRU_ACTIVE + file * LRU_FILE);move_active_pages_to_lru (zone, &l_inactive,LRU_BASE + file *LRU_FILE ); - +__mod_zone_page_state (zone,NR_ISOLATED_ANON + file, -nr_taken);spin_unlock_irq (&zone->lru_lock); }
mm/vmstat.c +2 -0
@@ -644,6 +644,8 @@ static const char * const vmstat_text[]"nr_bounce" ,"nr_vmscan_write" ,"nr_writeback_temp" , +"nr_isolated_anon" , +"nr_isolated_file" ,"nr_shmem" , #ifdef CONFIG_NUMA "numa_hit",
drivers/base/node.c +4 -0
@@ -73,6 +73,8 @@ static ssize_t node_read_meminfo(struct"Node %d Active(file): %8lu kB\n" "Node %d Inactive(file): %8lu kB\n" "Node %d Unevictable: %8lu kB\n" +"Node %d Isolated(anon): %8lu kB\n" +"Node %d Isolated(file): %8lu kB\n" "Node %d Mlocked: %8lu kB\n" #ifdef CONFIG_HIGHMEM"Node %d HighTotal: %8lu kB\n"
@@ -106,6 +108,8 @@ static ssize_t node_read_meminfo(struct nid,K (node_page_state (nid,NR_ACTIVE_FILE )), nid,K (node_page_state (nid,NR_INACTIVE_FILE )), nid,K (node_page_state (nid,NR_UNEVICTABLE )), + nid,K (node_page_state (nid,NR_ISOLATED_ANON )), + nid,K (node_page_state (nid,NR_ISOLATED_FILE )), nid,K (node_page_state (nid,NR_MLOCK )), #ifdef CONFIG_HIGHMEM nid, K(i.totalhigh),
mm/migrate.c +11 -0
@@ -67,6 +67,8 @@ int putback_lru_pages(struct list_head *list_for_each_entry_safe (page, page2, l, lru) {list_del (&page->lru); +dec_zone_page_state (page,NR_ISOLATED_ANON + + !!page_is_file_cache (page));putback_lru_page (page); count++; }
@@ -696,6 +698,8 @@ unlock:* restored. */ list_del (&page->lru); +dec_zone_page_state (page,NR_ISOLATED_ANON + + !!page_is_file_cache (page));putback_lru_page (page); }
@@ -740,6 +744,13 @@ int migrate_pages(struct list_head *fromstruct page *page2;int swapwrite = current->flags &PF_SWAPWRITE ;int rc; +int flags; + +local_irq_save (flags); +list_for_each_entry (page, from, lru) +__inc_zone_page_state (page,NR_ISOLATED_ANON + + !!page_is_file_cache (page)); +local_irq_restore (flags);if (!swapwrite) current->flags |=PF_SWAPWRITE ;
--
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 1/3] Rename pgmoved variable in shrink_active_list()
In reply to KOSAKI MotohiroQuoted 7 lines · KOSAKI Motohiro
Subject: [PATCH] Rename pgmoved variable in
shrink_active_list()Currently, pgmoved variable have two meanings. it cause harder reviewing a bit. This patch separate it.
Signed-off-by KOSAKI Motohiro <[email protected]>
Signature · 7 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/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 2/3] mm: shrink_inactive_lis() nr_scan accounting fix fix
In reply to KOSAKI MotohiroQuoted 11 lines · KOSAKI Motohiro
Subject: [PATCH] mm:
shrink_inactive_lis()nr_scanaccounting fix fixIf
sc->isolate_pages()return 0, we don't need to callshrink_page_list(). In past days,shrink_inactive_list()handled it properly.But commit
fb8d14e1(three years ago commit!) breaked it. currentshrink_inactive_list()always callshrink_page_list()althoughisolate_pages()return 0.This patch restore proper return value check.
Quoted 8 lines
Requirements:
o "nr_taken== 0" condition should stay before callingshrink_page_list().
o "nr_taken== 0" condition should stay afternr_scanrelated statistics modification.Cc Wu Fengguang <[email protected]>Signed-off-by KOSAKI Motohiro <[email protected]>
Signature · 7 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/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Andrew Morton
maintainerRe: [PATCH 1/3] Rename pgmoved variable in shrink_active_list()
In reply to KOSAKI Motohiromm/vmscan.c static void shrink_active_list(unsigned · line 1270
Quoted 6 lines · On Thu, 16 Jul 2009 09:52:34 +0900 (JST) KOSAKI Motohiro…
mm/vmscan.c +2
-2if (file) -__mod_zone_page_state (zone,NR_ACTIVE_FILE , -pgmoved); +__mod_zone_page_state (zone,NR_ACTIVE_FILE , -nr_taken);else -__mod_zone_page_state (zone,NR_ACTIVE_ANON , -pgmoved); +__mod_zone_page_state (zone,NR_ACTIVE_ANON , -nr_taken);
we could have used __sub_zone_page_state() there.
--
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>
Andrew Morton
maintainerRe: [PATCH 3/3] add isolate pages vmstat
In reply to KOSAKI MotohiroQuoted 54 lines · On Thu, 16 Jul 2009 09:55:47 +0900 (JST) KOSAKI Motohiro…
ChangeLog
Since v5
- Rewrote the description
- Treat page migration
Since v4
- Changed displaing order inshow_free_areas()(as Wu's suggested)
Since v3
- Fixed misaccount page bug when lumby reclaim occur
Since v2
- Separated IsolateLRU field to Isolated(anon) and Isolated(file)
Since v1
- Renamed IsolatePages to IsolatedLRU==================================
Subject: [PATCH] add isolate pages vmstatIf the system is running a heavy load of processes then concurrent reclaim can isolate a large numbe of pages from the LRU.
/proc/meminfoand the output generated for an OOM do not show how many pages were isolated.This patch shows the information about isolated pages.
reproduce way
-----------------------
% ./hackbench 140 process 1000
=> OOM occuractive_anon:146 inactive_anon:0 isolated_anon:49245
active_file:79 inactive_file:18 isolated_file:113 unevictable:0 dirty:0 writeback:0 unstable:0 buffer:39 free:370 slab_reclaimable:309 slab_unreclaimable:5492 mapped:53 shmem:15 pagetables:28140 bounce:0Signed-off-by KOSAKI Motohiro <[email protected]>Acked-by Rik van Riel <[email protected]>Acked-by Wu Fengguang <[email protected]>Reviewed-by Minchan Kim <[email protected]>--- drivers/base/node.c | 4 ++++ fs/proc/meminfo.c | 4 ++++ include/linux/mmzone.h | 2 ++ mm/migrate.c | 11 +++++++++++ mm/page_alloc.c | 12 +++++++++--- mm/vmscan.c | 12 +++++++++++- mm/vmstat.c | 2 ++ 7 files changed, 43 insertions(+), 4 deletions(-)Index:
b/fs/proc/meminfo.c
===================================================================
fs/proc/meminfo.c static int meminfo_proc_show(struct seq_ · line 70
Quoted 6 lines
fs/proc/meminfo.c +2
-0@@ -65,6 +65,8 @@ static int meminfo_proc_show(struct seq_"Active(file): %8lu kB\n" "Inactive(file): %8lu kB\n" "Unevictable: %8lu kB\n" +"Isolated(anon): %8lu kB\n" +"Isolated(file): %8lu kB\n" "Mlocked: %8lu kB\n"
Are these counters really important enough to justify being present in /proc/meminfo? They seem fairly low-level developer-only details. Perhaps relegate them to /proc/vmstat?
Quoted 93 lines
fs/proc/meminfo.c +2
-0#ifdef CONFIG_HIGHMEM "HighTotal: %8lu kB\n" @@ -110,6 +112,8 @@ static int meminfo_proc_show(struct seq_K (pages[LRU_ACTIVE_FILE ]),K (pages[LRU_INACTIVE_FILE ]),K (pages[LRU_UNEVICTABLE ]), +K (global_page_state (NR_ISOLATED_ANON )), +K (global_page_state (NR_ISOLATED_FILE )),K (global_page_state (NR_MLOCK )), #ifdef CONFIG_HIGHMEM K(i.totalhigh),Index:
b/include/linux/mmzone.h
===================================================================include/linux/mmzone.h +2
-0@@ -100,6 +100,8 @@ enum zone_stat_item {NR_BOUNCE ,NR_VMSCAN_WRITE ,NR_WRITEBACK_TEMP ,/* Writeback using temporary buffers */ +NR_ISOLATED_ANON ,/* Temporary isolated pages from anon lru */ +NR_ISOLATED_FILE ,/* Temporary isolated pages from file lru */ NR_SHMEM ,/* shmem pages (included tmpfs/GEM pages) */ #ifdef CONFIG_NUMA NUMA_HIT, /* allocated in intended node */Index:
b/mm/page_alloc.c
===================================================================mm/page_alloc.c +9
-3@@ -2115,16 +2115,18 @@ void show_free_areas(void) } } - printk("Active_anon:%lu active_file:%lu inactive_anon:%lu\n" - " inactive_file:%lu" + printk("active_anon:%lu inactive_anon:%lu isolated_anon:%lu\n" + " active_file:%lu inactive_file:%lu isolated_file:%lu\n" " unevictable:%lu" " dirty:%lu writeback:%lu unstable:%lu buffer:%lu\n" " free:%lu slab_reclaimable:%lu slab_unreclaimable:%lu\n" " mapped:%lu shmem:%lu pagetables:%lu bounce:%lu\n", global_page_state(NR_ACTIVE_ANON), - global_page_state(NR_ACTIVE_FILE), global_page_state(NR_INACTIVE_ANON), + global_page_state(NR_ISOLATED_ANON), + global_page_state(NR_ACTIVE_FILE), global_page_state(NR_INACTIVE_FILE), + global_page_state(NR_ISOLATED_FILE), global_page_state(NR_UNEVICTABLE), global_page_state(NR_FILE_DIRTY), global_page_state(NR_WRITEBACK),@@ -2152,6 +2154,8 @@ void show_free_areas(void)" active_file:%lukB" " inactive_file:%lukB" " unevictable:%lukB" +" isolated(anon):%lukB" +" isolated(file):%lukB" " present:%lukB" " mlocked:%lukB" " dirty:%lukB" @@ -2178,6 +2182,8 @@ void show_free_areas(void)K (zone_page_state (zone,NR_ACTIVE_FILE )),K (zone_page_state (zone,NR_INACTIVE_FILE )),K (zone_page_state (zone,NR_UNEVICTABLE )), +K (zone_page_state (zone,NR_ISOLATED_ANON )), +K (zone_page_state (zone,NR_ISOLATED_FILE )),K (zone->present_pages),K (zone_page_state (zone,NR_MLOCK )), K(zone_page_state(zone, NR_FILE_DIRTY)),Index:
b/mm/vmscan.c
===================================================================mm/vmscan.c +6
-0@@ -1067,6 +1067,8 @@ static unsigned long shrink_inactive_lisunsigned long nr_active;unsigned int count[NR_LRU_LISTS ] = {0 , };int mode = lumpy_reclaim ?ISOLATE_BOTH :ISOLATE_INACTIVE ; +unsigned long nr_anon; +unsigned long nr_file; nr_taken = sc->isolate_pages(sc->swap_cluster_max, &page_list, &nr_scan, sc->order, mode,@@ -1097,6 +1099,10 @@ static unsigned long shrink_inactive_lis__mod_zone_page_state (zone,NR_INACTIVE_ANON , -count[LRU_INACTIVE_ANON ]); + nr_anon = count[LRU_ACTIVE_ANON ] + count[LRU_INACTIVE_ANON ]; + nr_file = count[LRU_ACTIVE_FILE ] + count[LRU_INACTIVE_FILE ]; +__mod_zone_page_state (zone,NR_ISOLATED_ANON , nr_anon); +__mod_zone_page_state (zone,NR_ISOLATED_FILE , nr_file); reclaim_stat->recent_scanned[0 ] += count[LRU_INACTIVE_ANON ]; reclaim_stat->recent_scanned[0 ] += count[LRU_ACTIVE_ANON ];
mm/vmscan.c static unsigned long shrink_inactive_lis · line 1176
Quoted 7 lines
mm/vmscan.c +3
-0@@ -1164,6 +1170,9 @@ static unsigned long shrink_inactive_lisspin_lock_irq (&zone->lru_lock); } } +__mod_zone_page_state (zone,NR_ISOLATED_ANON , -nr_anon); +__mod_zone_page_state (zone,NR_ISOLATED_FILE , -nr_file); + }while (nr_scanned < max_scan);
This is a non-trivial amount of extra stuff. Do we really need it?
Re: [PATCH 1/3] Rename pgmoved variable in shrink_active_list()
In reply to KOSAKI MotohiroLooks good to me.
Quoted 7 lines · KOSAKI Motohiro
Subject: [PATCH] Rename pgmoved variable in
shrink_active_list()Currently, pgmoved variable have two meanings. it cause harder reviewing a bit. This patch separate it.
Signed-off-by KOSAKI Motohiro <[email protected]>
Signature · 8 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/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 1/3] Rename pgmoved variable in shrink_active_list()
In reply to Andrew MortonQuoted 10 lines · Andrew Morton
Quoted 6 lines · On Thu, 16 Jul 2009 09:52:34 +0900 (JST) KOSAKI Motohiro…
if (file)
-__mod_zone_page_state(zone, NR_ACTIVE_FILE, -pgmoved);
+__mod_zone_page_state(zone, NR_ACTIVE_FILE, -nr_taken); else
-__mod_zone_page_state(zone, NR_ACTIVE_ANON, -pgmoved);
+__mod_zone_page_state(zone, NR_ACTIVE_ANON, -nr_taken);we could have used
__sub_zone_page_state()there.
Yes. It can be changed all at once by separate patches. :)
Signature · 2 lines
Kind regards, Minchan Kim
Re: [PATCH 2/3] mm: shrink_inactive_lis() nr_scan accounting fix fix
In reply to KOSAKI MotohiroGood.
I decided making patch like this since I knew this problem. You are too diligent :)
Thanks for good attitude.
Quoted 11 lines · KOSAKI Motohiro
Subject: [PATCH] mm:
shrink_inactive_lis()nr_scanaccounting fix fixIf
sc->isolate_pages()return 0, we don't need to callshrink_page_list(). In past days,shrink_inactive_list()handled it properly.But commit
fb8d14e1(three years ago commit!) breaked it. currentshrink_inactive_list()always callshrink_page_list()althoughisolate_pages()return 0.This patch restore proper return value check.
Quoted 8 lines
Requirements:
o "nr_taken== 0" condition should stay before callingshrink_page_list().
o "nr_taken== 0" condition should stay afternr_scanrelated statistics modification.Cc Wu Fengguang <[email protected]>Signed-off-by KOSAKI Motohiro <[email protected]>
Signature · 8 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/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 3/3] add isolate pages vmstat
In reply to Andrew MortonT24gVGh1LCBKdWwgMTYsIDIwMDkgYXQgMTI6MTYgUE0sIEFuZHJldwpNb3J0b248YWtwbUBsaW51 eC1mb3VuZGF0aW9uLm9yZz4gd3JvdGU6Cj4gT24gVGh1LCAxNiBKdWwgMjAwOSAwOTo1NTo0NyAr MDkwMCAoSlNUKSBLT1NBS0kgTW90b2hpcm8gPGtvc2FraS5tb3RvaGlyb0BqcC5mdWppdHN1LmNv bT4gd3JvdGU6Cj4KPj4gQ2hhbmdlTG9nCj4+IMKgIFNpbmNlIHY1Cj4+IMKgIMKgLSBSZXdyb3Rl IHRoZSBkZXNjcmlwdGlvbgo+PiDCoCDCoC0gVHJlYXQgcGFnZSBtaWdyYXRpb24KPj4gwqAgU2lu Y2UgdjQKPj4gwqAgwqAtIENoYW5nZWQgZGlzcGxhaW5nIG9yZGVyIGluIHNob3dfZnJlZV9hcmVh cygpIChhcyBXdSdzIHN1Z2dlc3RlZCkKPj4gwqAgU2luY2UgdjMKPj4gwqAgwqAtIEZpeGVkIG1p c2FjY291bnQgcGFnZSBidWcgd2hlbiBsdW1ieSByZWNsYWltIG9jY3VyCj4+IMKgIFNpbmNlIHYy Cj4+IMKgIMKgLSBTZXBhcmF0ZWQgSXNvbGF0ZUxSVSBmaWVsZCB0byBJc29sYXRlZChhbm9uKSBh bmQgSXNvbGF0ZWQoZmlsZSkKPj4gwqAgU2luY2UgdjEKPj4gwqAgwqAtIFJlbmFtZWQgSXNvbGF0 ZVBhZ2VzIHRvIEl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b2xhdGVkIHBhdGNoZXMgYXJlIGJhc2VkIG9u IGlzb2xhdGlvbiBjb3VudGVyLgoKU28sIEkgdGhpbmsgd2UgbmVlZCB0aGlzIHVudGlsIG5vdy4K SWYgd2UgY2FuIHNvbHZlIHRoZSBwcm9ibGVtIHdpdGggZGlmZmVyZW50IG1ldGhvZCwgdGhlbiB3 ZSBjYW4gZHJvcCB0aGlzLgoKLS0gCktpbmQgcmVnYXJkcywKTWluY2hhbiBLaW0K
--
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 1/3] Rename pgmoved variable in shrink_active_list()
In reply to Andrew MortonQuoted 10 lines · On Thu, 16 Jul 2009 09:52:34 +0900 (JST) KOSAKI Motohiro…
Review
Quoted 7 lines
(quoted diff) +2
-2if (file) - __mod_zone_page_state(zone, NR_ACTIVE_FILE, -pgmoved); + __mod_zone_page_state(zone, NR_ACTIVE_FILE, -nr_taken); else - __mod_zone_page_state(zone, NR_ACTIVE_ANON, -pgmoved); + __mod_zone_page_state(zone, NR_ACTIVE_ANON, -nr_taken);we could have used
__sub_zone_page_state()there.
__add_zone_page_state() and __sub_zone_page_state() are no user.
Instead, we can remove it?
==============================================
Subject: Kill __{add,sub}_zone_page_state()
Currently, __add_zone_page_state() and __sub_zone_page_state() are unused. This patch remove it.
--- include/linux/vmstat.h | 5 ----- 1 file changed, 5 deletions(-)
include/linux/vmstat.h +0 -5
@@ -210,11 +210,6 @@ extern void zone_statistics(struct zone#endif /* CONFIG_NUMA */ -#define __add_zone_page_state (__z, __i, __d) \ - __mod_zone_page_state(__z, __i, __d) -#define __sub_zone_page_state (__z, __i, __d) \ - __mod_zone_page_state(__z, __i,-(__d)) -#define add_zone_page_state (__z, __i, __d) mod_zone_page_state(__z, __i, __d)#define sub_zone_page_state (__z, __i, __d) mod_zone_page_state(__z, __i, -(__d))
--
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 3/3] add isolate pages vmstat
In reply to Andrew MortonQuoted 11 lines
Quoted 11 lines
reproduce way
-----------------------
% ./hackbench 140 process 1000
=> OOM occuractive_anon:146 inactive_anon:0 isolated_anon:49245
active_file:79 inactive_file:18 isolated_file:113 unevictable:0 dirty:0 writeback:0 unstable:0 buffer:39 free:370 slab_reclaimable:309 slab_unreclaimable:5492 mapped:53 shmem:15 pagetables:28140 bounce:0
Quoted 10 lines
mm/vmscan.c static unsigned long shrink_inactive_lis · line 1176
Quoted 8 lines
mm/vmscan.c +3
-0@@ -1164,6 +1170,9 @@ static unsigned long shrink_inactive_lisspin_lock_irq (&zone->lru_lock); } } +__mod_zone_page_state (zone,NR_ISOLATED_ANON , -nr_anon); +__mod_zone_page_state (zone,NR_ISOLATED_FILE , -nr_file); + }while (nr_scanned < max_scan);This is a non-trivial amount of extra stuff. Do we really need it?
In general, Administrator really hate large amount unaccounted memory. Recent msgctl11 discussion, We faced it isolate pages about 1/3 system memory.
Ahtough Rik's patch is applied, vmscan can isolate >1GB memory.
That's my point.
--
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>
Andrew Morton
maintainerRe: [PATCH 1/3] Rename pgmoved variable in shrink_active_list()
In reply to KOSAKI Motohiroinclude/linux/vmstat.h extern void zone_statistics(struct zone · line 217
Quoted 5 lines · On Thu, 16 Jul 2009 13:22:30 +0900 (JST) KOSAKI Motohiro…
include/linux/vmstat.h +0
-5-#define __add_zone_page_state (__z, __i, __d) \ - __mod_zone_page_state(__z, __i, __d) -#define __sub_zone_page_state (__z, __i, __d) \ - __mod_zone_page_state(__z, __i,-(__d)) -
yeah, whatever, I don't think they add a lot of value personally.
I guess they're a _bit_ clearer than doing __sub_zone_page_state() with a negated argument. Shrug.
--
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 1/3] Rename pgmoved variable in shrink_active_list()
Quoted 10 lines · On Thu, 16 Jul 2009 13:22:30 +0900 (JST) KOSAKI Motohiro…
include/linux/vmstat.h extern void zone_statistics(struct zone · line 217
Quoted 6 lines
include/linux/vmstat.h +0
-5-#define __add_zone_page_state (__z, __i, __d) \ - __mod_zone_page_state(__z, __i, __d) -#define __sub_zone_page_state (__z, __i, __d) \ - __mod_zone_page_state(__z, __i,-(__d)) -yeah, whatever, I don't think they add a lot of value personally.
Quoted 2 lines
I guess they're a _bit_ clearer than doing
__sub_zone_page_state()with a negated argument. Shrug.
OK, I've catched your point.
I'll make all caller replacing patches.
Thanks.
--
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 1/3] Rename pgmoved variable in shrink_active_list()
Quoted 10 lines
Quoted 10 lines · On Thu, 16 Jul 2009 13:22:30 +0900 (JST) KOSAKI Motohiro…
include/linux/vmstat.h extern void zone_statistics(struct zone · line 217
Quoted 6 lines
include/linux/vmstat.h +0
-5-#define __add_zone_page_state (__z, __i, __d) \ - __mod_zone_page_state(__z, __i, __d) -#define __sub_zone_page_state (__z, __i, __d) \ - __mod_zone_page_state(__z, __i,-(__d)) -yeah, whatever, I don't think they add a lot of value personally.
Quoted 5 lines
Quoted 2 lines
I guess they're a _bit_ clearer than doing
__sub_zone_page_state()with a negated argument. Shrug.OK, I've catched your point.
I'll make all caller replacing patches.
Please drop last mail. I was confused ;-)
--
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>
Andrew Morton
maintainerRe: [PATCH 1/3] Rename pgmoved variable in shrink_active_list()
In reply to KOSAKI MotohiroQuoted 10 lines · On Thu, 16 Jul 2009 13:38:21 +0900 (JST) KOSAKI Motohiro…
Quoted 10 lines · On Thu, 16 Jul 2009 13:22:30 +0900 (JST) KOSAKI Motohiro…
include/linux/vmstat.h extern void zone_statistics(struct zone · line 217
Quoted 6 lines
include/linux/vmstat.h +0
-5-#define __add_zone_page_state (__z, __i, __d) \ - __mod_zone_page_state(__z, __i, __d) -#define __sub_zone_page_state (__z, __i, __d) \ - __mod_zone_page_state(__z, __i,-(__d)) -yeah, whatever, I don't think they add a lot of value personally.
Quoted 4 lines
Quoted 2 lines
I guess they're a _bit_ clearer than doing
__sub_zone_page_state()with a negated argument. Shrug.OK, I've catched your point.
I don't think I have a point ;)
Quoted 1 line
I'll make all caller replacing patches.
Well, if you guys think it's worth it, sure.
--
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 1/3] Rename pgmoved variable in shrink_active_list()
In reply to KOSAKI MotohiroQuoted 6 lines · KOSAKI Motohiro
Subject: [PATCH] Rename pgmoved variable in
shrink_active_list()Currently, pgmoved variable have two meanings. it cause harder reviewing a bit. This patch separate it.
Signed-off-by KOSAKI Motohiro <[email protected]>
--
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 2/3] mm: shrink_inactive_lis() nr_scan accounting fix fix
In reply to KOSAKI MotohiroQuoted 9 lines · KOSAKI Motohiro
Subject: [PATCH] mm:
shrink_inactive_lis()nr_scanaccounting fix fixIf
sc->isolate_pages()return 0, we don't need to callshrink_page_list(). In past days,shrink_inactive_list()handled it properly.But commit
fb8d14e1(three years ago commit!) breaked it. currentshrink_inactive_list()always callshrink_page_list()althoughisolate_pages()return 0.This patch restore proper return value check.
Patch looks good, but there is another minor problem..
Quoted 24 lines
Requirements:
o "nr_taken== 0" condition should stay before callingshrink_page_list().
o "nr_taken== 0" condition should stay afternr_scanrelated statistics modification.Cc Wu Fengguang <[email protected]>Signed-off-by KOSAKI Motohiro <[email protected]>--- mm/vmscan.c | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-)Index:
b/mm/vmscan.c
===================================================================mm/vmscan.c +3
-0@@ -1071,6 +1071,20 @@ static unsigned long shrink_inactive_lis nr_taken = sc->isolate_pages (sc->swap_cluster_max, &page_list, &nr_scan, sc->order, mode, zone, sc->mem_cgroup,0 , file); + +if (scanning_global_lru (sc)) { + zone->pages_scanned += nr_scan;
mm/vmscan.c static unsigned long shrink_inactive_lis · line 1086
Quoted 10 lines
mm/vmscan.c +10
-0+if (current_is_kswapd ()) +__count_zone_vm_events (PGSCAN_KSWAPD , zone, + nr_scan); +else +__count_zone_vm_events (PGSCAN_DIRECT , zone, + nr_scan); + } + +if (nr_taken ==0 ) + goto done;
Not a newly introduced problem, but this early break might under scan the list, if (max_scan > swap_cluster_max). Luckily the only two callers all call with (max_scan <= swap_cluster_max).
What shall we do? The comprehensive solution may be to
- remove the big do-while loop
- replace sc->swap_cluster_max => max_scan
- take care in the callers to not passing small max_scan values
Or to simply make this function more robust like this?
--- mm/vmscan.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
mm/vmscan.c +7 -6
@@ -1098,7 +1098,7 @@ static unsigned long shrink_inactive_lislru_add_drain ();spin_lock_irq (&zone->lru_lock); - do { +while (nr_scanned < max_scan) {struct page *page;unsigned long nr_taken;unsigned long nr_scan;
@@ -1112,6 +1112,7 @@ static unsigned long shrink_inactive_lis nr_taken = sc->isolate_pages (sc->swap_cluster_max, &page_list, &nr_scan, sc->order, mode, zone, sc->mem_cgroup,0 , file); + nr_scanned += nr_scan;if (scanning_global_lru (sc)) { zone->pages_scanned += nr_scan;
@@ -1123,8 +1124,10 @@ static unsigned long shrink_inactive_lis nr_scan); } -if (nr_taken ==0 ) - goto done; +if (nr_taken ==0 ) { +cond_resched_lock (&zone->lru_lock); +continue ; + } nr_active =clear_active_flags (&page_list, count);__count_vm_events (PGDEACTIVATE , nr_active);
@@ -1150,7 +1153,6 @@ static unsigned long shrink_inactive_lisspin_unlock_irq (&zone->lru_lock); - nr_scanned += nr_scan; nr_freed =shrink_page_list (&page_list, sc,PAGEOUT_IO_ASYNC );/*
@@ -1212,9 +1214,8 @@ static unsigned long shrink_inactive_lis__mod_zone_page_state (zone,NR_ISOLATED_ANON , -nr_anon);__mod_zone_page_state (zone,NR_ISOLATED_FILE , -nr_file); - }while (nr_scanned < max_scan); + } -done:spin_unlock_irq (&zone->lru_lock);pagevec_release (&pvec);return nr_reclaimed;
--
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 1/3] Rename pgmoved variable in shrink_active_list()
In reply to KOSAKI MotohiroRe: [PATCH 3/3] add isolate pages vmstat
In reply to KOSAKI Motohiromm/migrate.c int putback_lru_pages(struct list_head * · line 74
Quoted 13 lines · KOSAKI Motohiro
Index:
b/mm/migrate.c
===================================================================mm/migrate.c +2
-0@@ -67,6 +67,8 @@ int putback_lru_pages(struct list_head *list_for_each_entry_safe (page, page2, l, lru) {list_del (&page->lru); +dec_zone_page_state (page,NR_ISOLATED_ANON + + !!page_is_file_cache (page));putback_lru_page (page); count++; }
ok.
mm/migrate.c unlock: · line 705
Quoted 9 lines
mm/migrate.c +2
-0@@ -696,6 +698,8 @@ unlock:* restored. */ list_del (&page->lru); +dec_zone_page_state (page,NR_ISOLATED_ANON + + !!page_is_file_cache (page));putback_lru_page (page); }
ok.
mm/migrate.c int migrate_pages(struct list_head *from · line 754
Quoted 12 lines
mm/migrate.c +7
-0@@ -740,6 +744,13 @@ int migrate_pages(struct list_head *fromstruct page *page2;int swapwrite = current->flags &PF_SWAPWRITE ;int rc; +int flags; + +local_irq_save (flags); +list_for_each_entry (page, from, lru) +__inc_zone_page_state (page,NR_ISOLATED_ANON + + !!page_is_file_cache (page)); +local_irq_restore (flags);
Why do a separate pass over all the migrates pages? Can you add the _inc_xx somewhere after the page was isolated from the lru by calling try_to_unmap()?
--
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 1/3] Rename pgmoved variable in shrink_active_list()
In reply to KOSAKI MotohiroQuoted 7 lines · KOSAKI Motohiro
Subject: [PATCH] Rename pgmoved variable in
shrink_active_list()Currently, pgmoved variable have two meanings. it cause harder reviewing a bit. This patch separate it.
Signed-off-by KOSAKI Motohiro <[email protected]>
Below are just minor suggestions regarding the changed code.
Quoted 31 lines
--- mm/vmscan.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)Index:
b/mm/vmscan.c
===================================================================mm/vmscan.c +3
-2@@ -1239,7 +1239,7 @@ static void move_active_pages_to_lru(strstatic void shrink_active_list (unsigned long nr_pages,struct zone *zone,struct scan_control *sc,int priority,int file) { -unsigned long pgmoved; +unsigned long nr_taken;unsigned long pgscanned;unsigned long vm_flags;LIST_HEAD (l_hold);/* The pages which were snipped off */ @@ -1247,10 +1247,11 @@ static void shrink_active_list(unsignedLIST_HEAD (l_inactive);struct page *page;struct zone_reclaim_stat *reclaim_stat =get_reclaim_stat (zone, sc); +unsigned long nr_rotated =0 ;lru_add_drain ();spin_lock_irq (&zone->lru_lock); - pgmoved = sc->isolate_pages (nr_pages, &l_hold, &pgscanned, sc->order, + nr_taken = sc->isolate_pages (nr_pages, &l_hold, &pgscanned, sc->order,ISOLATE_ACTIVE , zone, sc->mem_cgroup,1 , file);/*
mm/vmscan.c static void shrink_active_list(unsigned · line 1264
Quoted 5 lines
mm/vmscan.c +1
-1@@ -1260,16 +1261,15 @@ static void shrink_active_list(unsignedif (scanning_global_lru (sc)) { zone->pages_scanned += pgscanned; } - reclaim_stat->recent_scanned[!!file] += pgmoved; + reclaim_stat->recent_scanned[!!file] += nr_taken;
Hm, file is a boolean already, the double negation can probably be dropped.
mm/vmscan.c static void shrink_active_list(unsigned · line 1270
Quoted 7 lines
mm/vmscan.c +2
-2__count_zone_vm_events (PGREFILL , zone, pgscanned);if (file) -__mod_zone_page_state (zone,NR_ACTIVE_FILE , -pgmoved); +__mod_zone_page_state (zone,NR_ACTIVE_FILE , -nr_taken);else -__mod_zone_page_state (zone,NR_ACTIVE_ANON , -pgmoved); +__mod_zone_page_state (zone,NR_ACTIVE_ANON , -nr_taken);
Should perhaps be in another patch, but we could use
__mod_zone_page_state(zone, LRU_ACTIVE + file * LRU_FILE);
like in the call to move_active_pages_to_lru().
Quoted 16 lines
mm/vmscan.c +1
-2spin_unlock_irq (&zone->lru_lock); - pgmoved =0 ;/* count referenced (mapping) mapped pages */ while (!list_empty (&l_hold)) {cond_resched (); page =lru_to_page (&l_hold);@@ -1283,7 +1283,7 @@ static void shrink_active_list(unsigned/* page_referenced clears PageReferenced */ if (page_mapping_inuse (page) &&page_referenced (page,0 , sc->mem_cgroup, &vm_flags)) { - pgmoved++; + nr_rotated++;/* * Identify referenced, file-backed active pages and * give them one more trip around the active list. So
mm/vmscan.c static void shrink_active_list(unsigned · line 1315
Quoted 5 lines
mm/vmscan.c +1
-1@@ -1312,7 +1312,7 @@ static void shrink_active_list(unsigned* helps balance scan pressure between file and anonymous pages in * get_scan_ratio. */ - reclaim_stat->recent_rotated[!!file] += pgmoved; + reclaim_stat->recent_rotated[!!file] += nr_rotated;
file is boolean.
There is one more double negation in isolate_pages_global() that can be dropped as well. If you agree, I can submit all those changes in separate patches.
Hannes
Re: [PATCH 2/3] mm: shrink_inactive_lis() nr_scan accounting fix fix
In reply to Wu FengguangQuoted 10 lines
Not a newly introduced problem, but this early break might under scan the list, if (
max_scan>swap_cluster_max). Luckily the only two callers all call with (max_scan<=swap_cluster_max).What shall we do? The comprehensive solution may be to
- remove the big do-while loop
- replacesc->swap_cluster_max=>max_scan
- take care in the callers to not passing smallmax_scanvaluesOr to simply make this function more robust like this?
Sorry, I haven't catch your point. Can you please tell me your worried scenario?
--
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 1/3] Rename pgmoved variable in shrink_active_list()
In reply to Johannes WeinerQuoted 91 lines · KOSAKI Motohiro
Quoted 7 lines
Subject: [PATCH] Rename pgmoved variable in
shrink_active_list()Currently, pgmoved variable have two meanings. it cause harder reviewing a bit. This patch separate it.
Signed-off-by KOSAKI Motohiro <[email protected]>Reviewed-by Johannes Weiner <[email protected]>Below are just minor suggestions regarding the changed code.
Quoted 31 lines
--- mm/vmscan.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)Index:
b/mm/vmscan.c
===================================================================mm/vmscan.c +3
-2@@ -1239,7 +1239,7 @@ static void move_active_pages_to_lru(strstatic void shrink_active_list (unsigned long nr_pages,struct zone *zone,struct scan_control *sc,int priority,int file) { -unsigned long pgmoved; +unsigned long nr_taken;unsigned long pgscanned;unsigned long vm_flags;LIST_HEAD (l_hold);/* The pages which were snipped off */ @@ -1247,10 +1247,11 @@ static void shrink_active_list(unsignedLIST_HEAD (l_inactive);struct page *page;struct zone_reclaim_stat *reclaim_stat =get_reclaim_stat (zone, sc); +unsigned long nr_rotated =0 ;lru_add_drain ();spin_lock_irq (&zone->lru_lock); - pgmoved = sc->isolate_pages (nr_pages, &l_hold, &pgscanned, sc->order, + nr_taken = sc->isolate_pages (nr_pages, &l_hold, &pgscanned, sc->order,ISOLATE_ACTIVE , zone, sc->mem_cgroup,1 , file);/* mm/vmscan.c static void shrink_active_list(unsigned · line 1264
Quoted 5 lines
mm/vmscan.c +1
-1@@ -1260,16 +1261,15 @@ static void shrink_active_list(unsignedif (scanning_global_lru (sc)) { zone->pages_scanned += pgscanned; } - reclaim_stat->recent_scanned[!!file] += pgmoved; + reclaim_stat->recent_scanned[!!file] += nr_taken;Hm, file is a boolean already, the double negation can probably be dropped.
mm/vmscan.c static void shrink_active_list(unsigned · line 1270
Quoted 7 lines
mm/vmscan.c +2
-2__count_zone_vm_events (PGREFILL , zone, pgscanned);if (file) -__mod_zone_page_state (zone,NR_ACTIVE_FILE , -pgmoved); +__mod_zone_page_state (zone,NR_ACTIVE_FILE , -nr_taken);else -__mod_zone_page_state (zone,NR_ACTIVE_ANON , -pgmoved); +__mod_zone_page_state (zone,NR_ACTIVE_ANON , -nr_taken);Should perhaps be in another patch, but we could use
__mod_zone_page_state(zone, LRU_ACTIVE + file * LRU_FILE);like in the call to
move_active_pages_to_lru().Quoted 16 lines
mm/vmscan.c +1
-2spin_unlock_irq (&zone->lru_lock); - pgmoved =0 ;/* count referenced (mapping) mapped pages */ while (!list_empty (&l_hold)) {cond_resched (); page =lru_to_page (&l_hold);@@ -1283,7 +1283,7 @@ static void shrink_active_list(unsigned/* page_referenced clears PageReferenced */ if (page_mapping_inuse (page) &&page_referenced (page,0 , sc->mem_cgroup, &vm_flags)) { - pgmoved++; + nr_rotated++;/* * Identify referenced, file-backed active pages and * give them one more trip around the active list. So mm/vmscan.c static void shrink_active_list(unsigned · line 1315
Quoted 5 lines
mm/vmscan.c +1
-1@@ -1312,7 +1312,7 @@ static void shrink_active_list(unsigned* helps balance scan pressure between file and anonymous pages in * get_scan_ratio. */ - reclaim_stat->recent_rotated[!!file] += pgmoved; + reclaim_stat->recent_rotated[!!file] += nr_rotated;file is boolean.
Quoted 3 lines
There is one more double negation in
isolate_pages_global()that can be dropped as well. If you agree, I can submit all those changes in separate patches.
Yeah, thanks please.
--
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 3/3] add isolate pages vmstat
In reply to Christoph LameterQuoted 8 lines
Quoted 8 lines
mm/migrate.c +4
-0@@ -740,6 +744,13 @@ int migrate_pages(struct list_head *fromstruct page *page2;int swapwrite = current->flags &PF_SWAPWRITE ;int rc; +int flags; + +local_irq_save (flags); +list_for_each_entry (page, from, lru)
Quoted 8 lines
mm/migrate.c int migrate_pages(struct list_head *from · line 754
Quoted 4 lines
mm/migrate.c +3
-0+__inc_zone_page_state (page,NR_ISOLATED_ANON + + !!page_is_file_cache (page)); +local_irq_restore (flags);Why do a separate pass over all the migrates pages? Can you add the
_inc_xxsomewhere after the page was isolated from the lru by callingtry_to_unmap()?
calling try_to_unmap()? the pages are isolated before calling migrate_pages(). migrate_pages() have multiple caller. then I put this __inc_xx into top of migrate_pages().
--
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 3/3] add isolate pages vmstat
Quoted 7 lines · KOSAKI Motohiro
Quoted 3 lines
Why do a separate pass over all the migrates pages? Can you add the
_inc_xxsomewhere after the page was isolated from the lru by callingtry_to_unmap()?calling
try_to_unmap()? the pages are isolated before callingmigrate_pages().migrate_pages()have multiple caller. then I put this__inc_xxinto top ofmigrate_pages().
Then put the inc_xxx's where the pages are isolated.
--
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 3/3] add isolate pages vmstat
Quoted 11 lines · KOSAKI Motohiro
Quoted 8 lines
Quoted 4 lines
Why do a separate pass over all the migrates pages? Can you add the
_inc_xxsomewhere after the page was isolated from the lru by callingtry_to_unmap()?calling
try_to_unmap()? the pages are isolated before callingmigrate_pages().migrate_pages()have multiple caller. then I put this__inc_xxinto top ofmigrate_pages().Then put the inc_xxx's where the pages are isolated.
Is there any benefit? Why do we need sprinkle __inc_xx to many place?
--
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 3/3] add isolate pages vmstat
Quoted 6 lines · KOSAKI Motohiro
Quoted 6 lines · KOSAKI Motohiro
Quoted 5 lines
Quoted 4 lines
Why do a separate pass over all the migrates pages? Can you add the
_inc_xxsomewhere after the page was isolated from the lru by callingtry_to_unmap()?
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
calling
try_to_unmap()? the pages are isolated before callingmigrate_pages().migrate_pages()have multiple caller. then I put this__inc_xxinto top ofmigrate_pages().Then put the inc_xxx's where the pages are isolated.
Is there any benefit? Why do we need sprinkle
__inc_xxto many place?
Its only needed in one place where the pages are isolated.
--
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 3/3] add isolate pages vmstat
Quoted 12 lines · KOSAKI Motohiro
Quoted 11 lines
Quoted 11 lines · KOSAKI Motohiro
Quoted 8 lines
Quoted 4 lines
Why do a separate pass over all the migrates pages? Can you add the
_inc_xxsomewhere after the page was isolated from the lru by callingtry_to_unmap()?calling
try_to_unmap()? the pages are isolated before callingmigrate_pages().migrate_pages()have multiple caller. then I put this__inc_xxinto top ofmigrate_pages().
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
Then put the inc_xxx's where the pages are isolated.
Is there any benefit? Why do we need sprinkle
__inc_xxto many place?Its only needed in one place where the pages are isolated.
Umm.. I haven't understand this benefit. but I guess I can do that. I'll think it later deeply.
--
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>