[lc-checkins] CVS: linux/include/linux comp_cache.h,1.41,1.42
Status: Beta
Brought to you by:
nitin_sf
From: Rodrigo S. de C. <rc...@us...> - 2002-01-16 16:30:17
|
Update of /cvsroot/linuxcompressed/linux/include/linux In directory usw-pr-cvs1:/tmp/cvs-serv2268/include/linux Modified Files: comp_cache.h Log Message: Simple changes regarding hash tables and some cleanups. - no need to enter a power of 2 number for the maximum number of compressed pages any longer. It's not increasing the hash table size in a dynamic way, but that will be done soon. - hash table initialization was changed to allocate contiguous pages for it, what increases a lot related functions' performance. - swapin_vswap() has been deleted. Not needed. - comp_cache_free() was renamed to comp_cache_free_locked() and the page is passed as paremeter has to be locked. comp_cache_free() function was created to handle cases where the page is not yet locked. Index: comp_cache.h =================================================================== RCS file: /cvsroot/linuxcompressed/linux/include/linux/comp_cache.h,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -r1.41 -r1.42 *** comp_cache.h 2002/01/14 12:05:08 1.41 --- comp_cache.h 2002/01/16 16:30:11 1.42 *************** *** 2,6 **** * linux/mm/comp_cache.h * ! * Time-stamp: <2002-01-14 08:49:45 rcastro> * * Linux Virtual Memory Compressed Cache --- 2,6 ---- * linux/mm/comp_cache.h * ! * Time-stamp: <2002-01-14 16:42:11 rcastro> * * Linux Virtual Memory Compressed Cache *************** *** 28,31 **** --- 28,33 ---- #include <linux/WKcommon.h> + #define COMP_CACHE_VERSION "0.21pre7" + /* maximum compressed size of a page */ #define MAX_COMPRESSED_SIZE 4500 *************** *** 421,425 **** /* free.c */ ! inline void comp_cache_free(comp_cache_fragment_t *); #ifdef CONFIG_COMP_CACHE --- 423,429 ---- /* free.c */ ! inline int comp_cache_free(comp_cache_fragment_t *); ! int comp_cache_free_locked(comp_cache_fragment_t *); ! #ifdef CONFIG_COMP_CACHE *************** *** 435,447 **** comp_cache_t * find_and_lock_comp_page(swp_entry_t, comp_cache_fragment_t **); inline void check_all_fragments(comp_cache_t *); ! #define FRAGMENT_HASH_SIZE (CONFIG_COMP_CACHE_SIZE/8) ! #define fragment_hashfn(entry) ((SWP_OFFSET(entry) >> 2) & (FRAGMENT_HASH_SIZE - 1)) inline void add_fragment_to_hash_table(comp_cache_fragment_t *); inline void remove_fragment_from_hash_table(comp_cache_fragment_t *); - #define FREE_SPACE_INTERVAL 100 - #define FREE_SPACE_HASH_SIZE ((int) (PAGE_SIZE/FREE_SPACE_INTERVAL) + 2) static inline int free_space_hashfn(int free_space) { --- 439,456 ---- comp_cache_t * find_and_lock_comp_page(swp_entry_t, comp_cache_fragment_t **); inline void check_all_fragments(comp_cache_t *); + + extern unsigned int fragment_hash_size; ! static inline int fragment_hashfn(swp_entry_t entry) ! { ! return ((SWP_OFFSET(entry) >> 2) & (fragment_hash_size - 1)); ! } inline void add_fragment_to_hash_table(comp_cache_fragment_t *); inline void remove_fragment_from_hash_table(comp_cache_fragment_t *); + + extern unsigned int free_space_hash_size; + extern unsigned int free_space_interval; static inline int free_space_hashfn(int free_space) { *************** *** 449,455 **** return 0; ! free_space -= (free_space % FREE_SPACE_INTERVAL); ! return (free_space/FREE_SPACE_INTERVAL + 1); } --- 458,464 ---- return 0; ! free_space -= (free_space % free_space_interval); ! return (free_space/free_space_interval + 1); } |