[lc-checkins] CVS: linux/include/linux comp_cache.h,1.98,1.99
Status: Beta
Brought to you by:
nitin_sf
From: Rodrigo S. de C. <rc...@us...> - 2002-08-01 14:52:29
|
Update of /cvsroot/linuxcompressed/linux/include/linux In directory usw-pr-cvs1:/tmp/cvs-serv6713/include/linux Modified Files: comp_cache.h Log Message: Bug fixes o We were only accounting writeout statistics if the writepage() returned one, but returning zero doesn't mean it has not been written tough (swap_writepage() always returns zero). So, it ended up that we didn't account any writeout page because most writepage() functions return zero. Now we account every written page, no matter the return value. o Fixed CompCache bit assignment, so now we don't have to search compressed cache for every page that gets compressed. Given that, a PageCompCache(page) does not mean it has a fragment in compressed cache, but a !PageCompCache(page) surely doesn't have a fragment. That improves performance. Cleanups o Don't printk initial compressed cache size, only the maximum size o comp_data defined as static in proc.c Index: comp_cache.h =================================================================== RCS file: /cvsroot/linuxcompressed/linux/include/linux/comp_cache.h,v retrieving revision 1.98 retrieving revision 1.99 diff -C2 -r1.98 -r1.99 *** comp_cache.h 31 Jul 2002 12:31:05 -0000 1.98 --- comp_cache.h 1 Aug 2002 14:52:25 -0000 1.99 *************** *** 2,6 **** * linux/mm/comp_cache.h * ! * Time-stamp: <2002-07-29 09:43:00 rcastro> * * Linux Virtual Memory Compressed Cache --- 2,6 ---- * linux/mm/comp_cache.h * ! * Time-stamp: <2002-08-01 09:49:34 rcastro> * * Linux Virtual Memory Compressed Cache *************** *** 30,34 **** #include <linux/minilzo.h> ! #define COMP_CACHE_VERSION "0.24pre2" /* maximum compressed size of a page */ --- 30,34 ---- #include <linux/minilzo.h> ! #define COMP_CACHE_VERSION "0.24pre3" /* maximum compressed size of a page */ *************** *** 108,127 **** ((struct swp_buffer *) kmem_cache_alloc(comp_cachep, SLAB_ATOMIC)) - #define get_fragment(f) do { \ - if (atomic_read(&(f)->count) == 0) \ - BUG(); \ - atomic_inc(&(f)->count); \ - } while(0); - - #define drop_fragment(f) do { \ - if (!CompFragmentTestandSetToBeFreed(f)) \ - put_fragment(f); \ - } while(0); - - #define put_fragment(f) __comp_cache_free(f) - #define put_fragment_testzero(f) atomic_dec_and_test(&(f)->count) - #define fragment_count(f) atomic_read(&(f)->count) - #define set_fragment_count(f,v) atomic_set(&(f)->count, v) - extern int shmem_page(struct page * page); --- 108,111 ---- *************** *** 175,178 **** --- 159,185 ---- #define CompFragmentTestandSetToBeFreed(fragment) test_and_set_bit(CF_ToBeFreed, &(fragment)->flags) + /* general */ + #define get_fragment(f) do { \ + if (atomic_read(&(f)->count) == 0) \ + BUG(); \ + atomic_inc(&(f)->count); \ + } while(0); + + #define put_fragment(f) __comp_cache_free(f) + #define put_fragment_testzero(f) atomic_dec_and_test(&(f)->count) + #define fragment_count(f) atomic_read(&(f)->count) + #define set_fragment_count(f,v) atomic_set(&(f)->count, v) + + extern int __comp_cache_free(struct comp_cache_fragment *); + + static inline int + drop_fragment(struct comp_cache_fragment * fragment) + { + int err = 0; + if (!CompFragmentTestandSetToBeFreed(fragment)) + err = put_fragment(fragment); + return err; + } + #define INF 0xffffffff *************** *** 436,441 **** /* free.c */ - int __comp_cache_free(struct comp_cache_fragment *); - #ifdef CONFIG_COMP_CACHE --- 443,446 ---- *************** *** 443,446 **** --- 448,452 ---- int comp_cache_use_address(swp_entry_t); + int __comp_cache_free(struct comp_cache_fragment *); /* from Riel's rmap patch */ |