[lc-checkins] CVS: linux/include/linux comp_cache.h,1.82,1.83
Status: Beta
Brought to you by:
nitin_sf
From: Rodrigo S. de C. <rc...@us...> - 2002-06-25 14:34:11
|
Update of /cvsroot/linuxcompressed/linux/include/linux In directory usw-pr-cvs1:/tmp/cvs-serv13268/include/linux Modified Files: comp_cache.h Log Message: Feature o Implemented support for resizing the compressed cache on demand. The user defines the maximum compressed cache size and compressed cache will grow up to this size if necessary. Only then it will start swapping out fragments. And when the compressed cache entries start to get empty, their pages will be released to the system, decreasing compressed cache size. Still have to solve some issues about resizing vswap. o Changed most of the calls from comp_cache_free_locked() to comp_cache_free(), in order to release the page if necessary. Only calls from writeout functions were not changed since we don't want to use those pages to shrink the compressed cache. Bug fixes o Fixed potential oops in comp_cache_use_address(). If the ptes cannot be set to the new address, we would access a null variable (fragment). o Fixed bug in swap in process for virtual swap addresses. While allocating a new page, that virtual swap address might get unused (it gained a real address or vswap table got shrunk), what could lead to a BUG() in comp_cache_swp_duplicate(). Other o Some comments added to functions in adaptivity.c o Updated Configure.help for CONFIG_COMP_CACHE Index: comp_cache.h =================================================================== RCS file: /cvsroot/linuxcompressed/linux/include/linux/comp_cache.h,v retrieving revision 1.82 retrieving revision 1.83 diff -C2 -r1.82 -r1.83 *** comp_cache.h 20 Jun 2002 14:28:49 -0000 1.82 --- comp_cache.h 25 Jun 2002 14:34:07 -0000 1.83 *************** *** 2,6 **** * linux/mm/comp_cache.h * ! * Time-stamp: <2002-06-20 11:15:27 rcastro> * * Linux Virtual Memory Compressed Cache --- 2,6 ---- * linux/mm/comp_cache.h * ! * Time-stamp: <2002-06-23 12:35:16 rcastro> * * Linux Virtual Memory Compressed Cache *************** *** 29,33 **** #include <linux/WKcommon.h> ! #define COMP_CACHE_VERSION "0.23pre7" /* maximum compressed size of a page */ --- 29,33 ---- #include <linux/WKcommon.h> ! #define COMP_CACHE_VERSION "0.23pre8" /* maximum compressed size of a page */ *************** *** 36,40 **** #define NUM_VSWAP_ENTRIES (3 * num_comp_pages) ! extern unsigned long num_comp_pages, num_fragments, num_swapper_fragments, new_num_comp_pages, max_num_comp_pages, zone_num_comp_pages; struct pte_list { --- 36,40 ---- #define NUM_VSWAP_ENTRIES (3 * num_comp_pages) ! extern unsigned long num_comp_pages, num_fragments, num_swapper_fragments, new_num_comp_pages, min_num_comp_pages, max_num_comp_pages, zone_num_comp_pages; struct pte_list { *************** *** 99,110 **** /* adaptivity.c */ #ifdef CONFIG_COMP_CACHE ! int shrink_comp_cache(struct comp_cache_page *); ! inline void grow_comp_cache(zone_t *, int); void adapt_comp_cache(void); #else ! static inline int shrink_comp_cache(struct comp_cache_page * comp_page) { return 0; } static inline void grow_comp_cache(zone_t * zone, int nr_pages) { } #endif /* swapout.c */ extern struct list_head swp_free_buffer_head; --- 99,118 ---- /* adaptivity.c */ #ifdef CONFIG_COMP_CACHE ! int shrink_comp_cache(struct comp_cache_page *, int); ! int grow_comp_cache(int); void adapt_comp_cache(void); #else ! static inline int shrink_comp_cache(struct comp_cache_page * comp_page, int check_further) { return 0; } static inline void grow_comp_cache(zone_t * zone, int nr_pages) { } #endif + #ifdef CONFIG_COMP_DEMAND_RESIZE + int grow_on_demand(void); + int shrink_on_demand(struct comp_cache_page *); + #else + static inline int grow_on_demand(void) { return 0; } + static inline int shrink_on_demand(struct comp_cache_page * comp_page) { return 0; } + #endif + /* swapout.c */ extern struct list_head swp_free_buffer_head; *************** *** 381,390 **** #define COMP_CACHE_SWP_TYPE MAX_SWAPFILES ! #define VSWAP_RESERVED ((struct comp_cache_fragment *) 0xffffffff) #ifdef CONFIG_COMP_CACHE #define vswap_info_struct(p) (p == &swap_info[COMP_CACHE_SWP_TYPE]) #define vswap_address(entry) (SWP_TYPE(entry) == COMP_CACHE_SWP_TYPE) ! #define reserved(offset) (vswap_address[offset]->fragment == VSWAP_RESERVED) int comp_cache_swp_duplicate(swp_entry_t); --- 389,403 ---- #define COMP_CACHE_SWP_TYPE MAX_SWAPFILES ! #define VSWAP_RESERVED ((struct comp_cache_fragment *) 0xffffffff) ! #define VSWAP_FREEING ((struct comp_cache_fragment *) 0xfffffffe) ! ! #define VSWAP_ALLOCATING ((struct page *) 0xffffffff) #ifdef CONFIG_COMP_CACHE #define vswap_info_struct(p) (p == &swap_info[COMP_CACHE_SWP_TYPE]) #define vswap_address(entry) (SWP_TYPE(entry) == COMP_CACHE_SWP_TYPE) ! #define reserved(offset) (vswap_address[offset]->fragment == VSWAP_RESERVED) ! #define freeing(offset) (vswap_address[offset]->fragment == VSWAP_FREEING) ! #define allocating(offset) (vswap_address[offset]->swap_cache_page == VSWAP_ALLOCATING) int comp_cache_swp_duplicate(swp_entry_t); *************** *** 394,397 **** --- 407,413 ---- inline int comp_cache_available_space(void); + + inline void set_vswap_allocating(swp_entry_t entry); + inline void clear_vswap_allocating(swp_entry_t entry); extern void FASTCALL(add_pte_vswap(pte_t *, swp_entry_t)); |