diff options
Diffstat (limited to 'module/spl/spl-kmem.c')
-rw-r--r-- | module/spl/spl-kmem.c | 220 |
1 files changed, 0 insertions, 220 deletions
diff --git a/module/spl/spl-kmem.c b/module/spl/spl-kmem.c index 7626a2951..aeb1d2a06 100644 --- a/module/spl/spl-kmem.c +++ b/module/spl/spl-kmem.c @@ -101,44 +101,6 @@ module_param(spl_kmem_cache_kmem_limit, uint, 0644); MODULE_PARM_DESC(spl_kmem_cache_kmem_limit, "Objects less than N bytes use the kmalloc"); -/* - * The minimum amount of memory measured in pages to be free at all - * times on the system. This is similar to Linux's zone->pages_min - * multiplied by the number of zones and is sized based on that. - */ -pgcnt_t minfree = 0; -EXPORT_SYMBOL(minfree); - -/* - * The desired amount of memory measured in pages to be free at all - * times on the system. This is similar to Linux's zone->pages_low - * multiplied by the number of zones and is sized based on that. - * Assuming all zones are being used roughly equally, when we drop - * below this threshold asynchronous page reclamation is triggered. - */ -pgcnt_t desfree = 0; -EXPORT_SYMBOL(desfree); - -/* - * When above this amount of memory measures in pages the system is - * determined to have enough free memory. This is similar to Linux's - * zone->pages_high multiplied by the number of zones and is sized based - * on that. Assuming all zones are being used roughly equally, when - * asynchronous page reclamation reaches this threshold it stops. - */ -pgcnt_t lotsfree = 0; -EXPORT_SYMBOL(lotsfree); - -/* Unused always 0 in this implementation */ -pgcnt_t needfree = 0; -EXPORT_SYMBOL(needfree); - -pgcnt_t swapfs_minfree = 0; -EXPORT_SYMBOL(swapfs_minfree); - -pgcnt_t swapfs_reserve = 0; -EXPORT_SYMBOL(swapfs_reserve); - vmem_t *heap_arena = NULL; EXPORT_SYMBOL(heap_arena); @@ -148,101 +110,6 @@ EXPORT_SYMBOL(zio_alloc_arena); vmem_t *zio_arena = NULL; EXPORT_SYMBOL(zio_arena); -#ifdef HAVE_PGDAT_HELPERS -# ifndef HAVE_FIRST_ONLINE_PGDAT -first_online_pgdat_t first_online_pgdat_fn = SYMBOL_POISON; -EXPORT_SYMBOL(first_online_pgdat_fn); -# endif /* HAVE_FIRST_ONLINE_PGDAT */ - -# ifndef HAVE_NEXT_ONLINE_PGDAT -next_online_pgdat_t next_online_pgdat_fn = SYMBOL_POISON; -EXPORT_SYMBOL(next_online_pgdat_fn); -# endif /* HAVE_NEXT_ONLINE_PGDAT */ - -# ifndef HAVE_NEXT_ZONE -next_zone_t next_zone_fn = SYMBOL_POISON; -EXPORT_SYMBOL(next_zone_fn); -# endif /* HAVE_NEXT_ZONE */ - -#else /* HAVE_PGDAT_HELPERS */ - -# ifndef HAVE_PGDAT_LIST -struct pglist_data *pgdat_list_addr = SYMBOL_POISON; -EXPORT_SYMBOL(pgdat_list_addr); -# endif /* HAVE_PGDAT_LIST */ - -#endif /* HAVE_PGDAT_HELPERS */ - -#ifdef NEED_GET_ZONE_COUNTS -# ifndef HAVE_GET_ZONE_COUNTS -get_zone_counts_t get_zone_counts_fn = SYMBOL_POISON; -EXPORT_SYMBOL(get_zone_counts_fn); -# endif /* HAVE_GET_ZONE_COUNTS */ - -unsigned long -spl_global_page_state(spl_zone_stat_item_t item) -{ - unsigned long active; - unsigned long inactive; - unsigned long free; - - get_zone_counts(&active, &inactive, &free); - switch (item) { - case SPL_NR_FREE_PAGES: return free; - case SPL_NR_INACTIVE: return inactive; - case SPL_NR_ACTIVE: return active; - default: ASSERT(0); /* Unsupported */ - } - - return 0; -} -#else -# ifdef HAVE_GLOBAL_PAGE_STATE -unsigned long -spl_global_page_state(spl_zone_stat_item_t item) -{ - unsigned long pages = 0; - - switch (item) { - case SPL_NR_FREE_PAGES: -# ifdef HAVE_ZONE_STAT_ITEM_NR_FREE_PAGES - pages += global_page_state(NR_FREE_PAGES); -# endif - break; - case SPL_NR_INACTIVE: -# ifdef HAVE_ZONE_STAT_ITEM_NR_INACTIVE - pages += global_page_state(NR_INACTIVE); -# endif -# ifdef HAVE_ZONE_STAT_ITEM_NR_INACTIVE_ANON - pages += global_page_state(NR_INACTIVE_ANON); -# endif -# ifdef HAVE_ZONE_STAT_ITEM_NR_INACTIVE_FILE - pages += global_page_state(NR_INACTIVE_FILE); -# endif - break; - case SPL_NR_ACTIVE: -# ifdef HAVE_ZONE_STAT_ITEM_NR_ACTIVE - pages += global_page_state(NR_ACTIVE); -# endif -# ifdef HAVE_ZONE_STAT_ITEM_NR_ACTIVE_ANON - pages += global_page_state(NR_ACTIVE_ANON); -# endif -# ifdef HAVE_ZONE_STAT_ITEM_NR_ACTIVE_FILE - pages += global_page_state(NR_ACTIVE_FILE); -# endif - break; - default: - ASSERT(0); /* Unsupported */ - } - - return pages; -} -# else -# error "Both global_page_state() and get_zone_counts() unavailable" -# endif /* HAVE_GLOBAL_PAGE_STATE */ -#endif /* NEED_GET_ZONE_COUNTS */ -EXPORT_SYMBOL(spl_global_page_state); - #ifndef HAVE_SHRINK_DCACHE_MEMORY shrink_dcache_memory_t shrink_dcache_memory_fn = SYMBOL_POISON; EXPORT_SYMBOL(shrink_dcache_memory_fn); @@ -253,15 +120,6 @@ shrink_icache_memory_t shrink_icache_memory_fn = SYMBOL_POISON; EXPORT_SYMBOL(shrink_icache_memory_fn); #endif /* HAVE_SHRINK_ICACHE_MEMORY */ -pgcnt_t -spl_kmem_availrmem(void) -{ - /* The amount of easily available memory */ - return (spl_global_page_state(SPL_NR_FREE_PAGES) + - spl_global_page_state(SPL_NR_INACTIVE)); -} -EXPORT_SYMBOL(spl_kmem_availrmem); - size_t vmem_size(vmem_t *vmp, int typemask) { @@ -2458,90 +2316,12 @@ spl_kmem_fini_tracking(struct list_head *list, spinlock_t *lock) #define spl_kmem_fini_tracking(list, lock) #endif /* DEBUG_KMEM && DEBUG_KMEM_TRACKING */ -static void -spl_kmem_init_globals(void) -{ - struct zone *zone; - - /* For now all zones are includes, it may be wise to restrict - * this to normal and highmem zones if we see problems. */ - for_each_zone(zone) { - - if (!populated_zone(zone)) - continue; - - minfree += min_wmark_pages(zone); - desfree += low_wmark_pages(zone); - lotsfree += high_wmark_pages(zone); - } - - /* Solaris default values */ - swapfs_minfree = MAX(2*1024*1024 >> PAGE_SHIFT, physmem >> 3); - swapfs_reserve = MIN(4*1024*1024 >> PAGE_SHIFT, physmem >> 4); -} - /* * Called at module init when it is safe to use spl_kallsyms_lookup_name() */ int spl_kmem_init_kallsyms_lookup(void) { -#ifdef HAVE_PGDAT_HELPERS -# ifndef HAVE_FIRST_ONLINE_PGDAT - first_online_pgdat_fn = (first_online_pgdat_t) - spl_kallsyms_lookup_name("first_online_pgdat"); - if (!first_online_pgdat_fn) { - printk(KERN_ERR "Error: Unknown symbol first_online_pgdat\n"); - return -EFAULT; - } -# endif /* HAVE_FIRST_ONLINE_PGDAT */ - -# ifndef HAVE_NEXT_ONLINE_PGDAT - next_online_pgdat_fn = (next_online_pgdat_t) - spl_kallsyms_lookup_name("next_online_pgdat"); - if (!next_online_pgdat_fn) { - printk(KERN_ERR "Error: Unknown symbol next_online_pgdat\n"); - return -EFAULT; - } -# endif /* HAVE_NEXT_ONLINE_PGDAT */ - -# ifndef HAVE_NEXT_ZONE - next_zone_fn = (next_zone_t) - spl_kallsyms_lookup_name("next_zone"); - if (!next_zone_fn) { - printk(KERN_ERR "Error: Unknown symbol next_zone\n"); - return -EFAULT; - } -# endif /* HAVE_NEXT_ZONE */ - -#else /* HAVE_PGDAT_HELPERS */ - -# ifndef HAVE_PGDAT_LIST - pgdat_list_addr = *(struct pglist_data **) - spl_kallsyms_lookup_name("pgdat_list"); - if (!pgdat_list_addr) { - printk(KERN_ERR "Error: Unknown symbol pgdat_list\n"); - return -EFAULT; - } -# endif /* HAVE_PGDAT_LIST */ -#endif /* HAVE_PGDAT_HELPERS */ - -#if defined(NEED_GET_ZONE_COUNTS) && !defined(HAVE_GET_ZONE_COUNTS) - get_zone_counts_fn = (get_zone_counts_t) - spl_kallsyms_lookup_name("get_zone_counts"); - if (!get_zone_counts_fn) { - printk(KERN_ERR "Error: Unknown symbol get_zone_counts\n"); - return -EFAULT; - } -#endif /* NEED_GET_ZONE_COUNTS && !HAVE_GET_ZONE_COUNTS */ - - /* - * It is now safe to initialize the global tunings which rely on - * the use of the for_each_zone() macro. This macro in turns - * depends on the *_pgdat symbols which are now available. - */ - spl_kmem_init_globals(); - #ifndef HAVE_SHRINK_DCACHE_MEMORY /* When shrink_dcache_memory_fn == NULL support is disabled */ shrink_dcache_memory_fn = (shrink_dcache_memory_t) |