Update of /cvsroot/linuxcompressed/linux/include/linux
In directory usw-pr-cvs1:/tmp/cvs-serv31165/include/linux
Modified Files:
comp_cache.h
Log Message:
More changes regarding performance optimization.
- avl tree is finally removed. Now there's a new hash table for compressed
cache entries, what improved our cache performance. comp_cache_struct size
was decreased by 10 bytes with this change (actually 8 due to C struct
padding).
- search for duplicated fragments in get_comp_cache_page() was deleted since
it does not make sense any longer. Calls to _find_nolock_comp_page() have
fallen dramatically.
- comp_cache_notree() was renamed to comp_cache_nohash().
Index: comp_cache.h
===================================================================
RCS file: /cvsroot/linuxcompressed/linux/include/linux/comp_cache.h,v
retrieving revision 1.38
retrieving revision 1.39
diff -C2 -r1.38 -r1.39
*** comp_cache.h 2002/01/04 22:24:07 1.38
--- comp_cache.h 2002/01/07 17:48:29 1.39
***************
*** 2,6 ****
* linux/mm/comp_cache.h
*
! * Time-stamp: <2002-01-04 19:31:48 rcastro>
*
* Linux Virtual Memory Compressed Cache
--- 2,6 ----
* linux/mm/comp_cache.h
*
! * Time-stamp: <2002-01-07 15:33:53 rcastro>
*
* Linux Virtual Memory Compressed Cache
***************
*** 36,46 ****
extern unsigned long real_num_comp_pages, new_num_comp_pages, max_num_comp_pages;
- struct avl_info {
- short comp_avl_height;
- struct comp_cache_struct * comp_avl_left;
- struct comp_cache_struct * comp_avl_right;
- struct list_head avl_list;
- };
-
struct pte_list {
struct pte_list * next;
--- 36,39 ----
***************
*** 75,83 ****
short free_space;
- struct avl_info avl_free_space;
struct list_head fragments;
unsigned long flags;
} comp_cache_t;
--- 68,78 ----
short free_space;
struct list_head fragments;
unsigned long flags;
+
+ struct comp_cache_struct * next_hash;
+ struct comp_cache_struct ** pprev_hash;
} comp_cache_t;
***************
*** 129,150 ****
#endif
-
- /* avl.c */
- extern comp_cache_t * comp_avl_free_space;
-
- void comp_avl_insert (comp_cache_t *, comp_cache_t **, unsigned long, unsigned long);
- int comp_avl_remove (comp_cache_t *, comp_cache_t **, unsigned long, unsigned long);
- comp_cache_t * comp_search_avl_tree(unsigned short, comp_cache_t *, unsigned long, unsigned long);
-
- #define search_avl_tree_free_space(size) \
- comp_search_avl_tree(size, comp_avl_free_space, member_offset(free_space), member_offset(avl_free_space))
-
- #define avl_insert_free_space(comp_page) \
- comp_avl_insert(comp_page, &comp_avl_free_space, member_offset(free_space), member_offset(avl_free_space))
-
- #define avl_remove_free_space(comp_page) \
- comp_avl_remove(comp_page, &comp_avl_free_space, member_offset(free_space), member_offset(avl_free_space))
! /* Comp Fragment Entry Flags */
#define CF_Freed 0
#define CF_SwapBuffer 1
--- 124,129 ----
#endif
! /* comp fragment entry flags */
#define CF_Freed 0
#define CF_SwapBuffer 1
***************
*** 494,497 ****
--- 473,493 ----
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)
+ {
+ if (!free_space)
+ return 0;
+
+ free_space -= (free_space % FREE_SPACE_INTERVAL);
+
+ return (free_space/FREE_SPACE_INTERVAL + 1);
+ }
+
+ inline void add_comp_page_to_hash_table(comp_cache_t *);
+ inline void remove_comp_page_from_hash_table(comp_cache_t *);
+ comp_cache_t * search_comp_page_free_space(int);
+
extern struct list_head lru_queue;
|