void ccwcache_cleanup (void) { int cachind; /* Shrink the caches, if available */ for ( cachind = 0; cachind < CCW_NUMBER_CACHES; cachind ++ ) { if ( ccw_cache[cachind] ) { if ( kmem_cache_shrink(ccw_cache[cachind]) == 0 ) { ccw_cache[cachind] = NULL; } kmem_cache_destroy(ccw_cache[cachind]); } } debug_unregister( debug_area ); }
void ccwcache_cleanup (void) { int cachind; /* Shrink the caches, if available */ for ( cachind = 0; cachind < CCW_NUMBER_CACHES; cachind ++ ) { if ( ccw_cache[cachind] ) { #if 0 /* this is useless and could cause an OOPS in the worst case */ if ( kmem_cache_shrink(ccw_cache[cachind]) == 0 ) { ccw_cache[cachind] = NULL; } #endif kmem_cache_destroy(ccw_cache[cachind]); } } debug_unregister( debug_area ); }
/* * This is called from kswapd when we think we need some * more memory, but aren't really sure how much. So we * carefully try to free a _bit_ of our dcache, but not * too much. * * Priority: * 0 - very urgent: shrink everything * ... * 6 - base-level: try to shrink a bit. */ int shrink_dcache_memory(int priority, unsigned int gfp_mask) { int count = 0; /* * Nasty deadlock avoidance. * * ext2_new_block->getblk->GFP->shrink_dcache_memory->prune_dcache-> * prune_one_dentry->dput->dentry_iput->iput->inode->i_sb->s_op-> * put_inode->ext2_discard_prealloc->ext2_free_blocks->lock_super-> * DEADLOCK. * * We should make sure we don't hold the superblock lock over * block allocations, but for now: */ if (!(gfp_mask & __GFP_FS)) return 0; count = dentry_stat.nr_unused / priority; prune_dcache(count); return kmem_cache_shrink(dentry_cache); }
static int __do_suspend(void *ignore) { int err; extern void time_resume(void); BUG_ON(smp_processor_id() != 0); BUG_ON(in_interrupt()); #if defined(__i386__) || defined(__x86_64__) if (xen_feature(XENFEAT_auto_translated_physmap)) { printk(KERN_WARNING "Cannot suspend in " "auto_translated_physmap mode.\n"); return -EOPNOTSUPP; } #endif err = smp_suspend(); if (err) return err; xenbus_suspend(); preempt_disable(); #ifdef __i386__ kmem_cache_shrink(pgd_cache); #endif mm_pin_all(); local_irq_disable(); preempt_enable(); gnttab_suspend(); pre_suspend(); /* * We'll stop somewhere inside this hypercall. When it returns, * we'll start resuming after the restore. */ HYPERVISOR_suspend(virt_to_mfn(xen_start_info)); shutting_down = SHUTDOWN_INVALID; post_suspend(); gnttab_resume(); irq_resume(); time_resume(); switch_idle_mm(); local_irq_enable(); xencons_resume(); xenbus_resume(); smp_resume(); return err; }
acpi_status acpi_os_purge_cache(acpi_cache_t * cache) { kmem_cache_shrink(cache); return (AE_OK); }
static int __do_suspend(void *ignore) { int i, j, k, fpp, err; extern unsigned long max_pfn; extern unsigned long *pfn_to_mfn_frame_list_list; extern unsigned long *pfn_to_mfn_frame_list[]; extern void time_resume(void); BUG_ON(smp_processor_id() != 0); BUG_ON(in_interrupt()); if (xen_feature(XENFEAT_auto_translated_physmap)) { printk(KERN_WARNING "Cannot suspend in " "auto_translated_physmap mode.\n"); return -EOPNOTSUPP; } err = smp_suspend(); if (err) return err; xenbus_suspend(); preempt_disable(); #ifdef __i386__ kmem_cache_shrink(pgd_cache); #endif mm_pin_all(); __cli(); preempt_enable(); gnttab_suspend(); HYPERVISOR_shared_info = (shared_info_t *)empty_zero_page; clear_fixmap(FIX_SHARED_INFO); xen_start_info->store_mfn = mfn_to_pfn(xen_start_info->store_mfn); xen_start_info->console_mfn = mfn_to_pfn(xen_start_info->console_mfn); /* * We'll stop somewhere inside this hypercall. When it returns, * we'll start resuming after the restore. */ HYPERVISOR_suspend(virt_to_mfn(xen_start_info)); shutting_down = SHUTDOWN_INVALID; set_fixmap(FIX_SHARED_INFO, xen_start_info->shared_info); HYPERVISOR_shared_info = (shared_info_t *)fix_to_virt(FIX_SHARED_INFO); memset(empty_zero_page, 0, PAGE_SIZE); HYPERVISOR_shared_info->arch.pfn_to_mfn_frame_list_list = virt_to_mfn(pfn_to_mfn_frame_list_list); fpp = PAGE_SIZE/sizeof(unsigned long); for (i = 0, j = 0, k = -1; i < max_pfn; i += fpp, j++) { if ((j % fpp) == 0) { k++; pfn_to_mfn_frame_list_list[k] = virt_to_mfn(pfn_to_mfn_frame_list[k]); j = 0; } pfn_to_mfn_frame_list[k][j] = virt_to_mfn(&phys_to_machine_mapping[i]); } HYPERVISOR_shared_info->arch.max_pfn = max_pfn; gnttab_resume(); irq_resume(); time_resume(); switch_idle_mm(); __sti(); xencons_resume(); xenbus_resume(); smp_resume(); return err; }
static void i915_global_context_shrink(void) { kmem_cache_shrink(global.slab_ce); }