[lc-checkins] CVS: linux/include/linux comp_cache.h,1.37,1.38
Status: Beta
Brought to you by:
nitin_sf
From: Rodrigo S. de C. <rc...@us...> - 2002-01-04 22:24:10
|
Update of /cvsroot/linuxcompressed/linux/include/linux In directory usw-pr-cvs1:/tmp/cvs-serv25332/include/linux Modified Files: comp_cache.h Log Message: Some changes regarding code optimization. These modifications have improved a lot some tests (fillmem) we performed to test our current code. - hash function changed to be arch-independent (by using SWP_OFFSET) and also has been improved (shifting one position to the left). - hash table size is in function of COMP_CACHE_CACHE_SIZE. It was set to a static value and that hurts performance pretty badly for bigger sizes of compressed cache. This change breaks the kernel parameter compsize=, but I don't know if it's worth to add a variable to hold the hash table size since the macro that uses this value (fragment_hashfn) is called many times. - now the option in kernel config menu warns about the need of having a maximum size of compressed cache as a power of two number for this hash table size. If it's not a power of two, it breaks the hash function and the performance drops heavily. To solve this problem, we could add a variable that would be set to a reasonable value (a power of two) and in function of the maximum size of the compressed cache, but there's the problem explained above. - swap_out_fragments() never sleeps to lock a page. If it couldn't be locked at once, move it to the end of the LRU list and tries to lock the next. - removed checksum from the comp_cache_fragment_t and checksum computation from get_comp_cache_page() and decompress_page(). It added a huge overhead in our tests. Index: comp_cache.h =================================================================== RCS file: /cvsroot/linuxcompressed/linux/include/linux/comp_cache.h,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -r1.37 -r1.38 *** comp_cache.h 2002/01/02 16:59:05 1.37 --- comp_cache.h 2002/01/04 22:24:07 1.38 *************** *** 2,6 **** * linux/mm/comp_cache.h * ! * Time-stamp: <2002-01-02 12:06:10 rcastro> * * Linux Virtual Memory Compressed Cache --- 2,6 ---- * linux/mm/comp_cache.h * ! * Time-stamp: <2002-01-04 19:31:48 rcastro> * * Linux Virtual Memory Compressed Cache *************** *** 29,32 **** --- 29,33 ---- #include <linux/WKcommon.h> + /* maximum compressed size of a page */ #define MAX_COMPRESSED_SIZE 4500 *************** *** 58,62 **** /* index == 0 && compressed_size != 0 => compressed_size = free_space */ unsigned short compressed_size; - unsigned int checksum; unsigned long flags; --- 59,62 ---- *************** *** 489,494 **** inline void check_all_fragments(comp_cache_t *); ! #define HTABLE_SIZE 32 ! #define hashfn(entry) ((entry >> 9) & (HTABLE_SIZE - 1)) inline void add_fragment_to_hash_table(comp_cache_fragment_t *); --- 489,494 ---- 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 *); |