[lc-checkins] CVS: linux/include/linux comp_cache.h,1.44,1.45
Status: Beta
Brought to you by:
nitin_sf
From: Rodrigo S. de C. <rc...@us...> - 2002-02-07 21:07:29
|
Update of /cvsroot/linuxcompressed/linux/include/linux In directory usw-pr-cvs1:/tmp/cvs-serv13905/include/linux Modified Files: comp_cache.h Log Message: This version features the adaptable vswap implementation. It's the first version and have to be improved, but it seems stable though. One of the improvements is to deal with many shrink and grows in a row (what I think it's stable but not completely functional). And we still have to deal with a possible find_vma failure, what will cause a BUG() in the current code. - created vswap_alloc_and_init(), like init_comp_page(), but allocates the page too. - now {grow,shrink}_comp_cache() checks also if the vswap needs to be shrunk or grown, using vswap_needs_to_{grow,shrink}(). - grow_vswap() is a very simple function. It allocates the new vswap table, copies the pointer to the vswap entries, allocate the new vswap entries and that's it. - shrink_vswap() is a complex function. It tries to compact all the used vswap entries and only when we could do it (it may be done at once, depends on the page locks), we effectively shrink the cache. Index: comp_cache.h =================================================================== RCS file: /cvsroot/linuxcompressed/linux/include/linux/comp_cache.h,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -r1.44 -r1.45 *** comp_cache.h 31 Jan 2002 21:08:16 -0000 1.44 --- comp_cache.h 7 Feb 2002 21:07:24 -0000 1.45 *************** *** 2,6 **** * linux/mm/comp_cache.h * ! * Time-stamp: <2002-01-31 18:07:29 rcastro> * * Linux Virtual Memory Compressed Cache --- 2,6 ---- * linux/mm/comp_cache.h * ! * Time-stamp: <2002-02-06 16:52:24 rcastro> * * Linux Virtual Memory Compressed Cache *************** *** 28,37 **** #include <linux/WKcommon.h> ! #define COMP_CACHE_VERSION "0.22pre1" /* maximum compressed size of a page */ #define MAX_COMPRESSED_SIZE 4500 ! #define NUM_VSWAP_ENTRIES 3 * max_num_comp_pages extern unsigned long real_num_comp_pages, new_num_comp_pages, max_num_comp_pages; --- 28,37 ---- #include <linux/WKcommon.h> ! #define COMP_CACHE_VERSION "0.22pre2" /* maximum compressed size of a page */ #define MAX_COMPRESSED_SIZE 4500 ! #define NUM_VSWAP_ENTRIES (3 * real_num_comp_pages) extern unsigned long real_num_comp_pages, new_num_comp_pages, max_num_comp_pages; *************** *** 348,354 **** }; - extern struct list_head vswap_address_free_head, vswap_address_used_head; extern struct vswap_address ** vswap_address; extern unsigned long estimated_free_space; #define COMP_CACHE_SWP_TYPE MAX_SWAPFILES --- 348,361 ---- }; extern struct vswap_address ** vswap_address; + extern struct list_head vswap_address_free_head; + extern struct list_head vswap_address_used_head; + extern unsigned long estimated_free_space; + extern long estimated_pages; + + extern unsigned long vswap_current_num_entries; + extern unsigned long vswap_num_used_entries; + extern unsigned int vswap_last_used; #define COMP_CACHE_SWP_TYPE MAX_SWAPFILES *************** *** 356,360 **** #ifdef CONFIG_COMP_CACHE - #define vswap_address_available() (!list_empty(&vswap_address_free_head)) #define vswap_info_struct(p) (p == &swap_info[COMP_CACHE_SWP_TYPE]) #define vswap_address(entry) (SWP_TYPE(entry) == COMP_CACHE_SWP_TYPE) --- 363,366 ---- *************** *** 376,379 **** --- 382,387 ---- inline void del_swap_cache_page_vswap(struct page *); + void vswap_alloc_and_init(struct vswap_address **, int); + #else *************** *** 397,402 **** /* free.c */ ! inline int comp_cache_free(comp_cache_fragment_t *); ! int comp_cache_free_locked(comp_cache_fragment_t *); #ifdef CONFIG_COMP_CACHE --- 405,410 ---- /* free.c */ ! inline void comp_cache_free(comp_cache_fragment_t *); ! void comp_cache_free_locked(comp_cache_fragment_t *); #ifdef CONFIG_COMP_CACHE *************** *** 455,460 **** extern comp_cache_fragment_t ** fragment_hash; ! extern unsigned int fragment_hash_size; ! extern unsigned int fragment_hash_used; extern unsigned int fragment_hash_order; --- 463,468 ---- extern comp_cache_fragment_t ** fragment_hash; ! extern unsigned long fragment_hash_size; ! extern unsigned long fragment_hash_used; extern unsigned int fragment_hash_order; *************** *** 491,495 **** comp_cache_t * search_comp_page_free_space(int); ! comp_cache_fragment_t ** create_fragment_hash(unsigned int *, unsigned int *); extern struct list_head lru_queue; --- 499,503 ---- comp_cache_t * search_comp_page_free_space(int); ! comp_cache_fragment_t ** create_fragment_hash(unsigned long *, unsigned int *); extern struct list_head lru_queue; |