[lc-checkins] CVS: linux/include/linux sysctl.h,1.5,1.6 comp_cache.h,1.102,1.103 lzoconf.h,1.5,1.6 m
Status: Beta
Brought to you by:
nitin_sf
From: Rodrigo S. de C. <rc...@us...> - 2002-11-22 16:02:07
|
Update of /cvsroot/linuxcompressed/linux/include/linux In directory sc8-pr-cvs1:/tmp/cvs-serv13256/include/linux Modified Files: comp_cache.h lzoconf.h minilzo.h swap.h Added Files: sysctl.h Log Message: Features o New clean page adaptability. This policy disables compression of clean pages when it is not worth it (i.e., most pages are compressed and freed, without being reclaimed to the system). o Two new configuration options to disable the whole adaptability policy and clean page adaptability separately. It was most used for some tests, but it might be useful for someone which has compressed caching performing not very well. Bug Fixes o Make the LZO code compile on Athlon systems o __read_comp_cache(): if a dirty fragment was supposed to be freed, it wouldn't be actually freed because we forgot to drop a reference on the fragment. Cleanups o Lots, mainly in adaptivity.c Index: comp_cache.h =================================================================== RCS file: /cvsroot/linuxcompressed/linux/include/linux/comp_cache.h,v retrieving revision 1.102 retrieving revision 1.103 diff -C2 -r1.102 -r1.103 *** comp_cache.h 10 Sep 2002 17:23:55 -0000 1.102 --- comp_cache.h 22 Nov 2002 16:01:33 -0000 1.103 *************** *** 2,6 **** * linux/mm/comp_cache.h * ! * Time-stamp: <2002-09-10 14:05:49 rcastro> * * Linux Virtual Memory Compressed Cache --- 2,6 ---- * linux/mm/comp_cache.h * ! * Time-stamp: <2002-11-21 16:46:32 rcastro> * * Linux Virtual Memory Compressed Cache *************** *** 31,41 **** #include <linux/minilzo.h> ! #define COMP_CACHE_VERSION "0.24pre4" /* maximum compressed size of a page */ #define MAX_COMPRESSED_SIZE 4500 ! extern unsigned long num_comp_pages, num_fragments, num_active_fragments, num_swapper_fragments, num_clean_fragments, zone_num_comp_pages; ! extern unsigned long new_num_comp_pages, min_num_comp_pages, max_num_comp_pages, max_used_num_comp_pages; extern kmem_cache_t * fragment_cachep; --- 31,46 ---- #include <linux/minilzo.h> ! #define COMP_CACHE_VERSION "0.24pre5" /* maximum compressed size of a page */ #define MAX_COMPRESSED_SIZE 4500 ! /* compressed cache metadata */ ! extern unsigned long num_fragments, num_active_fragments; ! extern unsigned long num_swapper_fragments, num_clean_fragments; ! ! extern unsigned long num_comp_pages, zone_num_comp_pages; ! extern unsigned long min_num_comp_pages, max_num_comp_pages, max_used_num_comp_pages; ! extern kmem_cache_t * fragment_cachep; *************** *** 111,125 **** ((struct swp_buffer *) kmem_cache_alloc(comp_cachep, SLAB_ATOMIC)) ! extern int shmem_page(struct page * page); /* adaptivity.c */ #ifdef CONFIG_COMP_CACHE extern unsigned long failed_comp_page_allocs; ! extern int growing_lock; int grow_on_demand(void); int shrink_on_demand(struct comp_cache_page *); void compact_comp_cache(void); void balance_lru_queues(void); #else static inline int grow_on_demand(void) { return 0; } --- 116,145 ---- ((struct swp_buffer *) kmem_cache_alloc(comp_cachep, SLAB_ATOMIC)) ! extern int shmem_page(struct page *); ! extern void comp_cache_fix_watermarks(int); /* adaptivity.c */ #ifdef CONFIG_COMP_CACHE extern unsigned long failed_comp_page_allocs; ! extern int growth_lock; int grow_on_demand(void); int shrink_on_demand(struct comp_cache_page *); void compact_comp_cache(void); + + #ifdef CONFIG_COMP_DIS_CLEAN + static inline void hit_clean_page(struct page * page) { }; + static inline void add_clean_page(struct page * page) { }; + #else + void hit_clean_page(struct page *); + void add_clean_page(struct page *); + #endif + + #ifdef CONFIG_COMP_DIS_ADAPT + static inline void balance_lru_queues(void) { }; + #else void balance_lru_queues(void); + #endif + #else static inline int grow_on_demand(void) { return 0; } *************** *** 127,130 **** --- 147,173 ---- #endif + extern unsigned long clean_page_hash_size; + extern unsigned int clean_page_hash_bits; + + struct clean_page_data { + struct list_head list; + + struct address_space * mapping; + unsigned long index; + + struct clean_page_data * next_hash; + struct clean_page_data ** pprev_hash; + }; + + static inline unsigned long + clean_page_hashfn(struct address_space * mapping, unsigned long index) + { + #define i (((unsigned long) mapping)/(sizeof(struct inode) & ~ (sizeof(struct inode) - 1))) + #define s(x) ((x)+((x) >> clean_page_hash_bits)) + return s(i+index) & (clean_page_hash_size - 1); + #undef i + #undef s + } + /* swapout.c */ extern struct list_head swp_free_buffer_head; *************** *** 139,142 **** --- 182,186 ---- #define CF_ToBeFreed 1 #define CF_Active 2 + #define CF_End 3 #define CompFragmentDirty(fragment) test_bit(CF_Dirty, &(fragment)->flags) *************** *** 150,158 **** #define CompFragmentTestandSetToBeFreed(fragment) test_and_set_bit(CF_ToBeFreed, &(fragment)->flags) ! #define CompFragmentActive(fragment) test_bit(CF_Active, &(fragment)->flags) ! #define CompFragmentSetActive(fragment) set_bit(CF_Active, &(fragment)->flags) ! #define CompFragmentTestandSetActive(fragment) test_and_set_bit(CF_Active, &(fragment)->flags) ! #define CompFragmentTestandClearActive(fragment) test_and_clear_bit(CF_Active, &(fragment)->flags) ! #define CompFragmentClearActive(fragment) clear_bit(CF_Active, &(fragment)->flags) /* general */ --- 194,208 ---- #define CompFragmentTestandSetToBeFreed(fragment) test_and_set_bit(CF_ToBeFreed, &(fragment)->flags) ! #define CompFragmentActive(fragment) test_bit(CF_Active, &(fragment)->flags) ! #define CompFragmentSetActive(fragment) set_bit(CF_Active, &(fragment)->flags) ! #define CompFragmentTestandSetActive(fragment) test_and_set_bit(CF_Active, &(fragment)->flags) ! #define CompFragmentTestandClearActive(fragment) test_and_clear_bit(CF_Active, &(fragment)->flags) ! #define CompFragmentClearActive(fragment) clear_bit(CF_Active, &(fragment)->flags) ! ! #define CompFragmentEnd(fragment) test_bit(CF_End, &(fragment)->flags) ! #define CompFragmentSetEnd(fragment) set_bit(CF_End, &(fragment)->flags) ! #define CompFragmentTestandSetEnd(fragment) test_and_set_bit(CF_End, &(fragment)->flags) ! #define CompFragmentTestandClearEnd(fragment) test_and_clear_bit(CF_End, &(fragment)->flags) ! #define CompFragmentClearEnd(fragment) clear_bit(CF_End, &(fragment)->flags) /* general */ *************** *** 233,236 **** --- 283,288 ---- /* proc.c */ + extern int clean_page_compress_lock; + #ifdef CONFIG_COMP_CACHE void decompress_fragment_to_page(struct comp_cache_fragment *, struct page *); *************** *** 239,244 **** void __init comp_cache_algorithms_init(void); - - extern int clean_page_compress_lock; #else static inline void decompress_swap_cache_page(struct page * page) { }; --- 291,294 ---- *************** *** 308,311 **** --- 358,362 ---- extern unsigned long comp_cache_free_space; extern spinlock_t comp_cache_lock; + extern struct comp_cache_fragment * last_checked_inactive; #else static inline void comp_cache_init(void) {}; *************** *** 507,511 **** int set_pte_list_to_entry(struct pte_list *, swp_entry_t, swp_entry_t); ! struct comp_cache_page * search_comp_page(struct comp_cache_page **, int); struct comp_cache_fragment ** create_fragment_hash(unsigned long *, unsigned int *, unsigned int *); --- 558,562 ---- int set_pte_list_to_entry(struct pte_list *, swp_entry_t, swp_entry_t); ! struct comp_cache_page * FASTCALL(search_comp_page(struct comp_cache_page ** hash_table, int free_space)); struct comp_cache_fragment ** create_fragment_hash(unsigned long *, unsigned int *, unsigned int *); Index: lzoconf.h =================================================================== RCS file: /cvsroot/linuxcompressed/linux/include/linux/lzoconf.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** lzoconf.h 10 Sep 2002 20:19:06 -0000 1.5 --- lzoconf.h 22 Nov 2002 16:01:33 -0000 1.6 *************** *** 41,60 **** # include <config.h> #endif - //#include <limits.h> - #include <linux/kernel.h> #define CHAR_BIT 8 - - #undef UCHAR_MAX #define UCHAR_MAX 255 ! /* For the sake of 16 bit hosts, we may not use -32768 */ ! #define SHRT_MIN (-32767-1) ! #undef SHRT_MAX ! #define SHRT_MAX 32767 - /* Maximum value an `unsigned short int' can hold. (Minimum is 0). */ - #undef USHRT_MAX #define USHRT_MAX 65535 #ifdef __cplusplus --- 41,77 ---- # include <config.h> #endif + /* definitions from limits.h */ #define CHAR_BIT 8 #define UCHAR_MAX 255 ! #ifndef __INT_MAX__ ! #define __INT_MAX__ 2147483647 ! #endif ! #undef INT_MIN ! #define INT_MIN (-INT_MAX-1) ! #undef INT_MAX ! #define INT_MAX __INT_MAX__ ! ! #undef UINT_MAX ! #define UINT_MAX (INT_MAX * 2U + 1) ! ! #ifndef __LONG_MAX__ ! #if defined (__alpha__) || (defined (_ARCH_PPC) && defined (__64BIT__)) || defined (__sparc_v9__) || defined (__sparcv9) ! #define __LONG_MAX__ 9223372036854775807L ! #else ! #define __LONG_MAX__ 2147483647L ! #endif /* __alpha__ || sparc64 */ ! #endif ! #undef LONG_MIN ! #define LONG_MIN (-LONG_MAX-1) ! #undef LONG_MAX ! #define LONG_MAX __LONG_MAX__ ! ! #undef ULONG_MAX ! #define ULONG_MAX (LONG_MAX * 2UL + 1) #define USHRT_MAX 65535 + #define SHRT_MAX 32767 #ifdef __cplusplus Index: minilzo.h =================================================================== RCS file: /cvsroot/linuxcompressed/linux/include/linux/minilzo.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** minilzo.h 29 May 2002 21:28:54 -0000 1.4 --- minilzo.h 22 Nov 2002 16:01:34 -0000 1.5 *************** *** 46,50 **** #undef LZO_HAVE_CONFIG_H ! #include "lzoconf.h" #if !defined(LZO_VERSION) || (LZO_VERSION != MINILZO_VERSION) --- 46,50 ---- #undef LZO_HAVE_CONFIG_H ! #include <linux/lzoconf.h> #if !defined(LZO_VERSION) || (LZO_VERSION != MINILZO_VERSION) Index: swap.h =================================================================== RCS file: /cvsroot/linuxcompressed/linux/include/linux/swap.h,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -r1.17 -r1.18 *** swap.h 10 Sep 2002 17:23:56 -0000 1.17 --- swap.h 22 Nov 2002 16:01:34 -0000 1.18 *************** *** 75,80 **** #define SWAP_MAP_MAX 0x7fff #define SWAP_MAP_BAD 0x8000 - #define SWAP_MAP_COMP 0x0000 #define SWAP_MAP_COMP_BIT 0x0000 #define swap_map_count(swap) (swap) #endif --- 75,80 ---- #define SWAP_MAP_MAX 0x7fff #define SWAP_MAP_BAD 0x8000 #define SWAP_MAP_COMP_BIT 0x0000 + #define SWAP_MAP_COMP_BIT_MASK 0x0000 #define swap_map_count(swap) (swap) #endif *************** *** 179,183 **** extern swp_entry_t get_swap_page(void); extern void get_swaphandle_info(swp_entry_t, unsigned long *, kdev_t *, ! struct inode **); extern int swap_duplicate(swp_entry_t); extern int swap_count(struct page *); --- 179,183 ---- extern swp_entry_t get_swap_page(void); extern void get_swaphandle_info(swp_entry_t, unsigned long *, kdev_t *, ! struct inode **); extern int swap_duplicate(swp_entry_t); extern int swap_count(struct page *); |