[lc-checkins] CVS: linux/include/linux comp_cache.h,1.88,1.89
Status: Beta
Brought to you by:
nitin_sf
From: Rodrigo S. de C. <rc...@us...> - 2002-07-11 19:08:15
|
Update of /cvsroot/linuxcompressed/linux/include/linux In directory usw-pr-cvs1:/tmp/cvs-serv16722/include/linux Modified Files: comp_cache.h Log Message: Feature o New proc entry (comp_cache_frag), showing the fragmentation in the compressed cache. o Every struct comp_cache_struct is added to two hash tables: free space and total free space. The former is the old one, showing the amount of free space that can be used right away. The latter shows the total free space, ie it also accounts the fragmented space. Thus, if there is a page with total space enough for a new fragment, we compact this page and return it to be used by the new fragment. The two tables are set up the same way. o Added back feature removed in 0.23pre9 due to a bug fix. That feature would allow pages to be compressed even when the gfp_mask does not allow. Now it is back and it won't write out a page if the gfp_mask does not allow. This feature allows a better use of the compressed cache space. Cleanup o Removed dirty parameter from get_comp_cache_page(). o Better descriptions of /proc/comp_cache_{hist,frag}. Index: comp_cache.h =================================================================== RCS file: /cvsroot/linuxcompressed/linux/include/linux/comp_cache.h,v retrieving revision 1.88 retrieving revision 1.89 diff -C2 -r1.88 -r1.89 *** comp_cache.h 9 Jul 2002 13:15:23 -0000 1.88 --- comp_cache.h 11 Jul 2002 19:08:10 -0000 1.89 *************** *** 2,6 **** * linux/mm/comp_cache.h * ! * Time-stamp: <2002-07-09 10:03:27 rcastro> * * Linux Virtual Memory Compressed Cache --- 2,6 ---- * linux/mm/comp_cache.h * ! * Time-stamp: <2002-07-11 15:28:35 rcastro> * * Linux Virtual Memory Compressed Cache *************** *** 75,84 **** /* fields for compression structure */ unsigned short free_offset; ! short free_space; struct list_head fragments; ! struct comp_cache_page * next_hash; ! struct comp_cache_page ** pprev_hash; }; --- 75,95 ---- /* fields for compression structure */ unsigned short free_offset; ! ! /* free space that can used right away */ ! short free_space; ! ! /* total free space = free_space + fragmented space, ie the ! * sum of all Freed fragments waiting to be merged */ ! short total_free_space; struct list_head fragments; ! /* free space hash table */ ! struct comp_cache_page * next_hash_fs; ! struct comp_cache_page ** pprev_hash_fs; ! ! /* total free space hash table */ ! struct comp_cache_page * next_hash_tfs; ! struct comp_cache_page ** pprev_hash_tfs; }; *************** *** 339,344 **** void comp_cache_init(void); inline int init_comp_page(struct comp_cache_page **,struct page *); ! inline void compress_dirty_page(struct page *, int (*writepage)(struct page *), unsigned int, int); ! inline int compress_clean_page(struct page *, unsigned int, int); extern unsigned long comp_cache_free_space; --- 350,355 ---- void comp_cache_init(void); inline int init_comp_page(struct comp_cache_page **,struct page *); ! inline void compress_dirty_page(struct page *, int (*writepage)(struct page *), unsigned int, int); ! inline int compress_clean_page(struct page *, unsigned int, int); extern unsigned long comp_cache_free_space; *************** *** 486,489 **** --- 497,501 ---- } + void compact_fragments(struct comp_cache_page *); #else *************** *** 525,531 **** --- 537,548 ---- } + extern struct comp_cache_page ** free_space_hash; extern unsigned int free_space_hash_size; extern unsigned int free_space_interval; + extern struct comp_cache_page ** total_free_space_hash; + extern unsigned int total_free_space_hash_size; + extern unsigned int total_free_space_interval; + static inline int free_space_hashfn(int free_space) { *************** *** 542,546 **** int set_pte_list_to_entry(struct pte_list *, swp_entry_t, swp_entry_t); ! struct comp_cache_page * search_comp_page_free_space(int); struct comp_cache_fragment ** create_fragment_hash(unsigned long *, unsigned int *, unsigned int *); --- 559,563 ---- 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 *); *************** *** 551,554 **** --- 568,574 ---- inline void remove_fragment_from_lru_queue(struct comp_cache_fragment *); + unsigned long free_space_count(int, unsigned long *); + unsigned long fragmentation_count(int, unsigned long *); + /* enough memory functions */ #ifdef CONFIG_COMP_CACHE *************** *** 564,570 **** int comp_cache_stat_read_proc(char *, char **, off_t, int, int *, void *); int comp_cache_hist_read_proc(char *, char **, off_t, int, int *, void *); inline void comp_cache_update_page_stats(struct page *, int); - unsigned long free_space_count(int, unsigned long *); - #endif /* _LINUX_COMP_CACHE_H */ --- 584,589 ---- int comp_cache_stat_read_proc(char *, char **, off_t, int, int *, void *); int comp_cache_hist_read_proc(char *, char **, off_t, int, int *, void *); + int comp_cache_frag_read_proc(char *, char **, off_t, int, int *, void *); inline void comp_cache_update_page_stats(struct page *, int); #endif /* _LINUX_COMP_CACHE_H */ |