Use ZVCs for accurate writeback ratio determination
Subsystems (11)
cover Use ZVCs for accurate writeback ratio determination
The determination of the dirty ratio to determine writeback behavior is currently based on the number of total pages on the system.
However, not all pages in the system may be dirtied. Thus the ratio is always too low and can never reach 100%. The ratio may be particularly skewed if large hugepage allocations, slab allocations or device driver buffers make large sections of memory not available anymore. In that case we may get into a situation in which f.e. the background writeback ratio of 40% cannot be reached anymore which leads to undesired writeback behavior.
This patchset fixes that issue by determining the ratio based on the actual pages that may potentially be dirty. These are the pages on the active and the inactive list plus free pages.
The problem with those counts has so far been that it is expensive to calculate these because counts from multiple nodes and multiple zones will have to be summed up. This patchset makes these counters ZVC counters. This means that a current sum per zone, per node and for the whole system is always available via global variables and not expensive anymore to calculate.
The patchset results in some other good side effects:
- Removal of the various functions that sum up free, active and inactive page counts
- Cleanup of the functions that display information via the proc filesystem.
--
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>
RFC 1/8 Use ZVC for inactive and active counts
Use ZVC for nr_inactive and nr_active
The use of a ZVC for nr_inactive and nr_active allows a simplification of some counter operations. More ZVC functionality is used for sums etc in the following patches.
include/linux/mm_inline.h +6 -7
@@ -1,30 +1,29 @@ -static inline void add_page_to_active_list (struct zone *zone,struct page *page) {list_add (&page->lru, &zone->active_list); - zone->nr_active++; +__inc_zone_state (zone,NR_ACTIVE ); }static inline void add_page_to_inactive_list (struct zone *zone,struct page *page) {list_add (&page->lru, &zone->inactive_list); - zone->nr_inactive++; +__inc_zone_state (zone,NR_INACTIVE ); }static inline void del_page_from_active_list (struct zone *zone,struct page *page) {list_del (&page->lru); - zone->nr_active--; +__dec_zone_state (zone,NR_ACTIVE ); }static inline void del_page_from_inactive_list (struct zone *zone,struct page *page) {list_del (&page->lru); - zone->nr_inactive--; +__dec_zone_state (zone,NR_INACTIVE ); } static inline void
@@ -33,9 +32,9 @@ del_page_from_lru(struct zone *zone, strlist_del (&page->lru);if (PageActive (page)) {__ClearPageActive (page); - zone->nr_active--; +__dec_zone_state (zone,NR_ACTIVE ); }else { - zone->nr_inactive--; +__dec_zone_state (zone,NR_INACTIVE ); } }
include/linux/mmzone.h +2 -2
@@ -47,6 +47,8 @@ struct zone_padding {#endif enum zone_stat_item { +NR_INACTIVE , +NR_ACTIVE ,NR_ANON_PAGES ,/* Mapped anonymous pages */ NR_FILE_MAPPED ,/* pagecache pages mapped into pagetables. only modified from process context */
@@ -197,8 +199,6 @@ struct zone {struct list_head inactive_list;unsigned long nr_scan_active;unsigned long nr_scan_inactive; -unsigned long nr_active; -unsigned long nr_inactive;unsigned long pages_scanned;/* since last reclaim */ int all_unreclaimable;/* All pages pinned */
include/linux/vmstat.h +3 -0
@@ -186,6 +186,9 @@ void inc_zone_page_state(struct page *,void dec_zone_page_state (struct page *,enum zone_stat_item );extern void inc_zone_state (struct zone *,enum zone_stat_item ); +extern void __inc_zone_state (struct zone *,enum zone_stat_item ); +extern void dec_zone_state (struct zone *,enum zone_stat_item ); +extern void __dec_zone_state (struct zone *,enum zone_stat_item );void refresh_cpu_vm_stats (int );void refresh_vm_stats (void );
mm/vmscan.c +28 -23
143 lines not on this page · raw message
mm/vmstat.c +13 -15
@@ -19,12 +19,10 @@ void __get_zone_counts(unsigned long *acstruct zone *zones = pgdat->node_zones;int i; - *active =0 ; - *inactive =0 ; + *active =node_page_state (pgdat->node_id,NR_ACTIVE ); + *inactive =node_page_state (pgdat->node_id,NR_INACTIVE ); *free =0 ;for (i =0 ; i <MAX_NR_ZONES ; i++) { - *active += zones[i].nr_active; - *inactive += zones[i].nr_inactive; *free += zones[i].free_pages; } }
@@ -34,14 +32,12 @@ void get_zone_counts(unsigned long *acti {struct pglist_data *pgdat; - *active =0 ; - *inactive =0 ; + *active =global_page_state (NR_ACTIVE ); + *inactive =global_page_state (NR_INACTIVE ); *free =0 ;for_each_online_pgdat (pgdat) {unsigned long l, m, n;__get_zone_counts (&l, &m, &n, pgdat); - *active += l; - *inactive += m; *free += n; } }
@@ -239,7 +235,7 @@ EXPORT_SYMBOL(mod_zone_page_state);* in between and therefore the atomicity vs. interrupt cannot be exploited * in a useful way here. */ -static void __inc_zone_state (struct zone *zone,enum zone_stat_item item) +void __inc_zone_state (struct zone *zone,enum zone_stat_item item) {struct per_cpu_pageset *pcp =zone_pcp (zone,smp_processor_id ());s8 *p = pcp->vm_stat_diff + item;
@@ -260,9 +256,8 @@ void __inc_zone_page_state(struct page * }EXPORT_SYMBOL (__inc_zone_page_state); -void __dec_zone_page_state (struct page *page,enum zone_stat_item item) +void __dec_zone_state (struct zone *zone,enum zone_stat_item item) { -struct zone *zone =page_zone (page);struct per_cpu_pageset *pcp =zone_pcp (zone,smp_processor_id ());s8 *p = pcp->vm_stat_diff + item;
@@ -275,6 +270,11 @@ void __dec_zone_page_state(struct page * *p = overstep; } } + +void __dec_zone_page_state (struct page *page,enum zone_stat_item item) +{ +__dec_zone_state (page_zone (page), item); +}EXPORT_SYMBOL (__dec_zone_page_state);void inc_zone_state (struct zone *zone,enum zone_stat_item item)
@@ -454,6 +454,8 @@ const struct seq_operations fragmentatiostatic const char *const vmstat_text[] = {/* Zoned VM counters */ +"nr_active" , +"nr_inactive" ,"nr_anon_pages" ,"nr_mapped" ,"nr_file_pages" ,
@@ -529,8 +531,6 @@ static int zoneinfo_show(struct seq_file"\n min %lu" "\n low %lu" "\n high %lu" -"\n active %lu" -"\n inactive %lu" "\n scanned %lu (a: %lu i: %lu)" "\n spanned %lu" "\n present %lu",
@@ -538,8 +538,6 @@ static int zoneinfo_show(struct seq_file zone->pages_min, zone->pages_low, zone->pages_high, - zone->nr_active, - zone->nr_inactive, zone->pages_scanned, zone->nr_scan_active, zone->nr_scan_inactive, zone->spanned_pages,
mm/page_alloc.c +2 -4
@@ -1616,8 +1616,8 @@ void show_free_areas(void)K (zone->pages_min),K (zone->pages_low),K (zone->pages_high), -K (zone->nr_active), -K (zone->nr_inactive), +K (zone_page_state (zone,NR_ACTIVE )), +K (zone_page_state (zone,NR_INACTIVE )),K (zone->present_pages), zone->pages_scanned, (zone->all_unreclaimable ?"yes" :"no" )
@@ -2684,8 +2684,6 @@ static void __meminit free_area_init_corINIT_LIST_HEAD (&zone->inactive_list); zone->nr_scan_active =0 ; zone->nr_scan_inactive =0 ; - zone->nr_active =0 ; - zone->nr_inactive =0 ;zap_zone_vm_stats (zone);atomic_set (&zone->reclaim_in_progress,0 );if (!size)
--
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>
RFC 2/8 Use ZVC for free_pages
In reply to Christoph LameterUse ZVC for free_pages
This is again simplifies some of the VM counter calculations through the use of the ZVC consolidated counters.
include/linux/mmzone.h +1 -1
@@ -47,6 +47,7 @@ struct zone_padding {#endif enum zone_stat_item { +NR_FREE_PAGES ,NR_INACTIVE ,NR_ACTIVE ,NR_ANON_PAGES ,/* Mapped anonymous pages */
@@ -157,7 +158,6 @@ enum zone_type {struct zone {/* Fields commonly accessed by the page allocator */ -unsigned long free_pages;unsigned long pages_min, pages_low, pages_high;/* * We don't know if the memory that we're going to allocate will be freeable
mm/page_alloc.c +11 -23
@@ -395,7 +395,7 @@ static inline void __free_one_page(strucVM_BUG_ON (page_idx & (order_size -1 ));VM_BUG_ON (bad_range (zone, page)); - zone->free_pages += order_size; +__mod_zone_page_state (zone,NR_FREE_PAGES , order_size);while (order <MAX_ORDER -1 ) {unsigned long combined_idx;struct free_area *area;
@@ -631,7 +631,7 @@ static struct page *__rmqueue(struct zonlist_del (&page->lru);rmv_page_order (page); area->nr_free--; - zone->free_pages -=1UL << order; +__mod_zone_page_state (zone,NR_FREE_PAGES , - (1UL << order));expand (zone, page, order, current_order, area);return page; }
@@ -990,7 +990,8 @@ int zone_watermark_ok(struct zone *z, in {/* free_pages my go negative - that's OK */ unsigned long min = mark; -long free_pages = z->free_pages - (1 << order) +1 ; +long free_pages =zone_page_state (z,NR_FREE_PAGES ) + - (1 << order) +1 ;int o;if (alloc_flags &ALLOC_HIGH )
@@ -1445,13 +1446,7 @@ EXPORT_SYMBOL(free_pages);*/ unsigned int nr_free_pages (void ) { -unsigned int sum =0 ; -struct zone *zone; - -for_each_zone (zone) - sum += zone->free_pages; - -return sum; +return global_page_state (NR_FREE_PAGES ); }EXPORT_SYMBOL (nr_free_pages);
@@ -1459,13 +1454,7 @@ EXPORT_SYMBOL(nr_free_pages);#ifdef CONFIG_NUMA unsigned int nr_free_pages_pgdat (pg_data_t *pgdat) { -unsigned int sum =0 ; -enum zone_type i; - -for (i =0 ; i <MAX_NR_ZONES ; i++) - sum += pgdat->node_zones[i].free_pages; - -return sum; +return node_page_state (pgdat->node_id,NR_FREE_PAGES ); }#endif
@@ -1515,7 +1504,7 @@ void si_meminfo(struct sysinfo *val) { val->totalram = totalram_pages; val->sharedram =0 ; - val->freeram =nr_free_pages (); + val->freeram =global_page_state (NR_FREE_PAGES ); val->bufferram =nr_blockdev_pages (); val->totalhigh = totalhigh_pages; val->freehigh =nr_free_highpages ();
@@ -1530,7 +1519,7 @@ void si_meminfo_node(struct sysinfo *valpg_data_t *pgdat =NODE_DATA (nid); val->totalram = pgdat->node_present_pages; - val->freeram =nr_free_pages_pgdat (pgdat); + val->freeram =node_page_state (nid,NR_FREE_PAGES );#ifdef CONFIG_HIGHMEM val->totalhigh = pgdat->node_zones[ZONE_HIGHMEM ].present_pages; val->freehigh = pgdat->node_zones[ZONE_HIGHMEM ].free_pages;
@@ -1581,13 +1570,13 @@ void show_free_areas(void)get_zone_counts (&active, &inactive, &free); printk("Active:%lu inactive:%lu dirty:%lu writeback:%lu " - "unstable:%lu free:%u slab:%lu mapped:%lu pagetables:%lu\n", + "unstable:%lu free:%lu slab:%lu mapped:%lu pagetables:%lu\n", active, inactive, global_page_state(NR_FILE_DIRTY), global_page_state(NR_WRITEBACK), global_page_state(NR_UNSTABLE_NFS), - nr_free_pages(), + global_page_state(NR_FREE_PAGES), global_page_state(NR_SLAB_RECLAIMABLE) + global_page_state(NR_SLAB_UNRECLAIMABLE), global_page_state(NR_FILE_MAPPED),
@@ -1612,7 +1601,7 @@ void show_free_areas(void)" all_unreclaimable? %s" "\n" , zone->name, -K (zone->free_pages), +K (zone_page_state (zone,NR_FREE_PAGES )),K (zone->pages_min),K (zone->pages_low), K(zone->pages_high),
@@ -2675,7 +2664,6 @@ static void __meminit free_area_init_corspin_lock_init (&zone->lru_lock);zone_seqlock_init (zone); zone->zone_pgdat = pgdat; - zone->free_pages =0 ; zone->prev_priority =DEF_PRIORITY ;
mm/vmstat.c +4 -16
@@ -16,30 +16,17 @@void __get_zone_counts (unsigned long *active,unsigned long *inactive,unsigned long *free,struct pglist_data *pgdat) { -struct zone *zones = pgdat->node_zones; -int i; - *active =node_page_state (pgdat->node_id,NR_ACTIVE ); *inactive =node_page_state (pgdat->node_id,NR_INACTIVE ); - *free =0 ; -for (i =0 ; i <MAX_NR_ZONES ; i++) { - *free += zones[i].free_pages; - } + *free =node_page_state (pgdat->node_id,NR_FREE_PAGES ); }void get_zone_counts (unsigned long *active,unsigned long *inactive,unsigned long *free) { -struct pglist_data *pgdat; - *active =global_page_state (NR_ACTIVE ); *inactive =global_page_state (NR_INACTIVE ); - *free =0 ; -for_each_online_pgdat (pgdat) { -unsigned long l, m, n; -__get_zone_counts (&l, &m, &n, pgdat); - *free += n; - } + *free =global_page_state (NR_FREE_PAGES ); }#ifdef CONFIG_VM_EVENT_COUNTERS
@@ -454,6 +441,7 @@ const struct seq_operations fragmentatiostatic const char *const vmstat_text[] = {/* Zoned VM counters */ +"nr_free_pages" ,"nr_active" ,"nr_inactive" ,"nr_anon_pages" ,
@@ -534,7 +522,7 @@ static int zoneinfo_show(struct seq_file"\n scanned %lu (a: %lu i: %lu)" "\n spanned %lu" "\n present %lu" , - zone->free_pages, +zone_page_state (zone,NR_FREE_PAGES ), zone->pages_min, zone->pages_low, zone->pages_high,
--
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>
RFC 3/8 Reorder ZVCs according to cacheline
In reply to Christoph LameterReorder ZVCs so that the main counters are in the same cacheline.
The global and per zone counter sums are in arrays of longs. Reorder the ZVCs so that the most frequently used ZVCs are put into the same cacheline. That way calculations of the global, node and per zone vm state touches only a single cacheline. This is mostly important for 64 bit systems were one 128 byte cacheline takes only 8 longs.
include/linux/mmzone.h +5 -3
@@ -47,6 +47,7 @@ struct zone_padding {#endif enum zone_stat_item { +/* First 128 byte cacheline (assuming 64 bit words) */ NR_FREE_PAGES ,NR_INACTIVE ,NR_ACTIVE ,
@@ -54,11 +55,12 @@ enum zone_stat_item {NR_FILE_MAPPED ,/* pagecache pages mapped into pagetables. only modified from process context */ NR_FILE_PAGES , -NR_SLAB_RECLAIMABLE , -NR_SLAB_UNRECLAIMABLE , -NR_PAGETABLE ,/* used for pagetables */ NR_FILE_DIRTY ,NR_WRITEBACK , +/* Second 128 byte cacheline */ +NR_SLAB_RECLAIMABLE , +NR_SLAB_UNRECLAIMABLE , +NR_PAGETABLE ,/* used for pagetables */ NR_UNSTABLE_NFS ,/* NFS unstable pages */ NR_BOUNCE , NR_VMSCAN_WRITE,
mm/vmstat.c +2 -2
@@ -447,11 +447,11 @@ static const char * const vmstat_text[]"nr_anon_pages" ,"nr_mapped" ,"nr_file_pages" , +"nr_dirty" , +"nr_writeback" ,"nr_slab_reclaimable" ,"nr_slab_unreclaimable" ,"nr_page_table_pages" , -"nr_dirty" , -"nr_writeback" ,"nr_unstable" ,"nr_bounce" , "nr_vmscan_write",
--
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>
RFC 4/8 Drop free_pages()
In reply to Christoph LameterFurther simplification for nr_free_pages.
nr_free_pages is now a simple access to a global variable. Make it a macro instead of a function.
The nr_free_pages now requires vmstat.h to be included. There is one occurrence in power management where we need to add the include. Directly refrer to global_page_state() there to clarify why the #include was added.
include/linux/swap.h +4 -1
@@ -170,11 +170,14 @@ extern void swapin_readahead(swp_entry_textern unsigned long totalram_pages;extern unsigned long totalreserve_pages;extern long nr_swap_pages; -extern unsigned int nr_free_pages (void );extern unsigned int nr_free_pages_pgdat (pg_data_t *pgdat);extern unsigned int nr_free_buffer_pages (void );extern unsigned int nr_free_pagecache_pages (void ); +/* Definition of global_page_state not available yet */ +#define nr_free_pages () global_page_state(NR_FREE_PAGES) + +/* linux/mm/swap.c */ extern void FASTCALL (lru_cache_add (struct page *));extern void FASTCALL (lru_cache_add_active (struct page *));
mm/page_alloc.c +0 -10
@@ -1441,16 +1441,6 @@ fastcall void free_pages(unsigned long aEXPORT_SYMBOL (free_pages); -/* -* Total amount of free (allocatable) RAM: -*/ -unsigned int nr_free_pages (void ) -{ -return global_page_state (NR_FREE_PAGES ); -} - -EXPORT_SYMBOL (nr_free_pages); -#ifdef CONFIG_NUMA unsigned int nr_free_pages_pgdat (pg_data_t *pgdat) {
kernel/power/main.c +3 -1
@@ -20,6 +20,7 @@#include <linux/cpu.h> #include <linux/resume-trace.h> #include <linux/freezer.h> +#include <linux/vmstat.h> #include "power.h"
@@ -72,7 +73,8 @@ static int suspend_prepare(suspend_state goto Thaw; } -if ((free_pages =nr_free_pages ()) <FREE_PAGE_NUMBER ) { +if ((free_pages =global_page_state (NR_FREE_PAGES )) + <FREE_PAGE_NUMBER ) {pr_debug ("PM: free some memory\n" );shrink_all_memory (FREE_PAGE_NUMBER - free_pages);if (nr_free_pages () <FREE_PAGE_NUMBER ) {
--
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>
RFC 5/8 Drop nr_free_pages_pgdat()
In reply to Christoph LameterGet rid of nr_free_pages_pgdat()
Function is unnecessary now. We can use the summing features of the ZVCs to get the values we need.
arch/ia64/mm/init.c +1 -1
@@ -67,7 +67,7 @@ max_pgt_pages(void)#ifndef CONFIG_NUMA node_free_pages =nr_free_pages ();#else - node_free_pages =nr_free_pages_pgdat (NODE_DATA (numa_node_id ())); + node_free_pages =node_page_state (numa_node_id (),NR_FREE_PAGES );#endif max_pgt_pages = node_free_pages /PGT_FRACTION_OF_NODE_MEM ; max_pgt_pages =max (max_pgt_pages,MIN_PGT_PAGES );
include/linux/swap.h +0 -1
@@ -170,7 +170,6 @@ extern void swapin_readahead(swp_entry_textern unsigned long totalram_pages;extern unsigned long totalreserve_pages;extern long nr_swap_pages; -extern unsigned int nr_free_pages_pgdat (pg_data_t *pgdat);extern unsigned int nr_free_buffer_pages (void );extern unsigned int nr_free_pagecache_pages (void );
mm/page_alloc.c +0 -7
@@ -1441,13 +1441,6 @@ fastcall void free_pages(unsigned long aEXPORT_SYMBOL (free_pages); -#ifdef CONFIG_NUMA -unsigned int nr_free_pages_pgdat (pg_data_t *pgdat) -{ -return node_page_state (pgdat->node_id,NR_FREE_PAGES ); -} -#endif -static unsigned int nr_free_zone_pages (int offset) {/* Just pick one node, since fallback list is circular */
--
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>
RFC 6/8 Drop __get_zone_counts()
In reply to Christoph LameterGet rid of __get_zone_counts
Values are readily available via ZVC per node and global sums.
drivers/base/node.c +2 -7
@@ -40,13 +40,8 @@ static ssize_t node_read_meminfo(structint n;int nid = dev->id;struct sysinfo i; -unsigned long inactive; -unsigned long active; -unsigned long free;si_meminfo_node (&i, nid); -__get_zone_counts (&active, &inactive, &free,NODE_DATA (nid)); - n =sprintf (buf,"\n" "Node %d MemTotal: %8lu kB\n"
@@ -74,8 +69,8 @@ static ssize_t node_read_meminfo(struct nid,K (i.totalram), nid,K (i.freeram), nid,K (i.totalram - i.freeram), - nid,K (active), - nid,K (inactive), + nid,node_page_state (nid,NR_ACTIVE ), + nid,node_page_state (nid,NR_INACTIVE ), #ifdef CONFIG_HIGHMEM nid,K (i.totalhigh), nid, K(i.freehigh),
include/linux/mmzone.h +0 -2
@@ -444,8 +444,6 @@ typedef struct pglist_data {#include <linux/memory_hotplug.h> -void __get_zone_counts (unsigned long *active,unsigned long *inactive, -unsigned long *free,struct pglist_data *pgdat);void get_zone_counts (unsigned long *active,unsigned long *inactive,unsigned long *free);void build_all_zonelists (void );
mm/readahead.c +2 -6
@@ -575,10 +575,6 @@ void handle_ra_miss(struct address_space*/ unsigned long max_sane_readahead (unsigned long nr) { -unsigned long active; -unsigned long inactive; -unsigned long free; - -__get_zone_counts (&active, &inactive, &free,NODE_DATA (numa_node_id ())); -return min (nr, (inactive + free) /2 ); +return min (nr, (node_page_state (numa_node_id (),NR_INACTIVE ) + +node_page_state (numa_node_id (),NR_FREE_PAGES )) /2 ); }
mm/vmstat.c +0 -8
@@ -13,14 +13,6 @@#include <linux/module.h> #include <linux/cpu.h> -void __get_zone_counts (unsigned long *active,unsigned long *inactive, -unsigned long *free,struct pglist_data *pgdat) -{ - *active =node_page_state (pgdat->node_id,NR_ACTIVE ); - *inactive =node_page_state (pgdat->node_id,NR_INACTIVE ); - *free =node_page_state (pgdat->node_id,NR_FREE_PAGES ); -} -void get_zone_counts (unsigned long *active,unsigned long *inactive,unsigned long *free) {
--
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>
RFC 7/8 Drop get_zone_counts()
In reply to Christoph LameterGet rid of get_zone_counts
Values are available via ZVC sums.
fs/proc/proc_misc.c +2 -7
@@ -121,16 +121,11 @@ static int meminfo_read_proc(char *page, {struct sysinfo i;int len; -unsigned long inactive; -unsigned long active; -unsigned long free;unsigned long committed;unsigned long allowed;struct vmalloc_info vmi;long cached; -get_zone_counts (&active, &inactive, &free); -/* * display in kilobytes. */
@@ -187,8 +182,8 @@ static int meminfo_read_proc(char *page,K (i.bufferram),K (cached),K (total_swapcache_pages), -K (active), -K (inactive), +K (global_page_state (NR_ACTIVE )), +K (global_page_state (NR_INACTIVE )), #ifdef CONFIG_HIGHMEMK (i.totalhigh), K(i.freehigh),
mm/page_alloc.c +2 -7
@@ -1524,9 +1524,6 @@ void si_meminfo_node(struct sysinfo *valvoid show_free_areas (void ) {int cpu; -unsigned long active; -unsigned long inactive; -unsigned long free;struct zone *zone;for_each_zone (zone) {
@@ -1550,12 +1547,10 @@ void show_free_areas(void) } } -get_zone_counts (&active, &inactive, &free); - printk("Active:%lu inactive:%lu dirty:%lu writeback:%lu " "unstable:%lu free:%lu slab:%lu mapped:%lu pagetables:%lu\n", - active, - inactive, + global_page_state(NR_ACTIVE), + global_page_state(NR_INACTIVE), global_page_state(NR_FILE_DIRTY), global_page_state(NR_WRITEBACK), global_page_state(NR_UNSTABLE_NFS),
mm/vmstat.c +0 -8
@@ -13,14 +13,6 @@#include <linux/module.h> #include <linux/cpu.h> -void get_zone_counts (unsigned long *active, -unsigned long *inactive,unsigned long *free) -{ - *active =global_page_state (NR_ACTIVE ); - *inactive =global_page_state (NR_INACTIVE ); - *free =global_page_state (NR_FREE_PAGES ); -} -#ifdef CONFIG_VM_EVENT_COUNTERS DEFINE_PER_CPU(struct vm_event_state, vm_event_states) = {{0}};EXPORT_PER_CPU_SYMBOL (vm_event_states);
--
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>
RFC 8/8 Fix writeback calculation
In reply to Christoph LameterWe can use the global ZVC counters to establish the exact size of the LRU and the free pages. This allows a more accurate determination of the dirty ratio.
This patch will fix the broken ratio calculations if large amounts of memory are allocated to huge pags or other consumers that do not put the pages on to the LRU.
However, we are unable to use the accurate base in the case of HIGHMEM and an allocation excluding HIGHMEM pages. In that case just fall back to the old scheme.
mm/page-writeback.c +9 -2
@@ -128,7 +128,9 @@ get_dirty_limits(long *pbackground, longint unmapped_ratio;long background;long dirty; -unsigned long available_memory = vm_total_pages; +unsigned long available_memory =global_page_state (NR_FREE_PAGES ) + +global_page_state (NR_INACTIVE ) + +global_page_state (NR_ACTIVE );struct task_struct *tsk;#ifdef CONFIG_HIGHMEM
@@ -137,7 +139,12 @@ get_dirty_limits(long *pbackground, long* we exclude high memory from our count. */ if (mapping && !(mapping_gfp_mask (mapping) & __GFP_HIGHMEM)) - available_memory -= totalhigh_pages; +/* +* This is not as accurate as the non highmem calculation +* but it has worked for years. So let it be as it was. +* People know how to deal with it it seems. +*/ + available_memory = vm_total_pages - totalhigh_pages;#endif
--
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 11 lines · Christoph Lameter
The determination of the dirty ratio to determine writeback behavior is currently based on the number of total pages on the system.
However, not all pages in the system may be dirtied. Thus the ratio is always too low and can never reach 100%. The ratio may be particularly skewed if large hugepage allocations, slab allocations or device driver buffers make large sections of memory not available anymore. In that case we may get into a situation in which f.e. the background writeback ratio of 40% cannot be reached anymore which leads to undesired writeback behavior.
Quoted 3 lines
This patchset fixes that issue by determining the ratio based on the actual pages that may potentially be dirty. These are the pages on the active and the inactive list plus free pages.
So you no longer account for reclaimable slab allocations, which would be a significant change on some workloads. Any reason for that?
Signature · 8 lines
SUSE Labs, Novell Inc. Send instant messages to your online friends http://au.messenger.yahoo.com -- 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 3 lines · Nick Piggin
So you no longer account for reclaimable slab allocations, which would be a significant change on some workloads. Any reason for that?
We could add NR_SLAB_RECLAIMABLE if that is a factor. However, these pages cannot be dirtied. They may be reclaimed yes and then pages may become available again. However, that is a difficult process without slab defrag. Are you sure that these are significant?
--
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 10 lines · Christoph Lameter
Quoted 3 lines · Nick Piggin
So you no longer account for reclaimable slab allocations, which would be a significant change on some workloads. Any reason for that?
We could add
NR_SLAB_RECLAIMABLEif that is a factor. However, these pages cannot be dirtied. They may be reclaimed yes and then pages may become available again. However, that is a difficult process without slab defrag. Are you sure that these are significant?
I think so. I have seen systems that get very full of dcache/icache, and little to no pagecache. In that case it makes no sense to limit dirty pages to a potentially small amount.
Slab reclaim does work. It may not be perfect, but I don't think that should spill over into dirty page calculations. If anything we need to improve slab reclaimability estimates for that.
Signature · 8 lines
SUSE Labs, Novell Inc. Send instant messages to your online friends http://au.messenger.yahoo.com -- 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 5 lines · Nick Piggin
Quoted 4 lines
We could add
NR_SLAB_RECLAIMABLEif that is a factor. However, these pages cannot be dirtied. They may be reclaimed yes and then pages may become available again. However, that is a difficult process without slab defrag. Are you sure that these are significant?
Quoted 7 lines
I think so. I have seen systems that get very full of dcache/icache, and little to no pagecache. In that case it makes no sense to limit dirty pages to a potentially small amount.
Slab reclaim does work. It may not be perfect, but I don't think that should spill over into dirty page calculations. If anything we need to improve slab reclaimability estimates for that.
How about adding NR_SLAB_RECLAIMABLE / 2 to take the reclaim problems into account that may lead to many pages not be recoverable?
--
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>