[lc-checkins] CVS: linux/include/linux comp_cache.h,1.52,1.53 fs.h,1.1,1.2 mm.h,1.13,1.14
Status: Beta
Brought to you by:
nitin_sf
|
From: Rodrigo S. de C. <rc...@us...> - 2002-02-25 19:34:43
|
Update of /cvsroot/linuxcompressed/linux/include/linux
In directory usw-pr-cvs1:/tmp/cvs-serv26754/include/linux
Modified Files:
comp_cache.h fs.h mm.h
Log Message:
This version fixes some bugs regarding the clean pages support. And
fixes many other bugs with the page cache support, besides code
cleanups. The improvement done in this version is the replacement of
the slab cache by Rik van Riel's rmap allocation for pte lists.
- now address space have two lists for compressed pages: dirty and
clean lists.
- some static inline functions that were in comp_cache.h have been
moved to the c file that uses it.
- all vswap functions that are often called are now compiled with
FASTCALL option.
- all vswap functions have been documented and cleaned up.
- since our pte_list struct is smaller than the minimum size needed
for slab cache, slab cache has been replaced by Rik's allocation,
that's pretty simple.
- failed fragment allocations are handled now.
- shared memory _broken_ support removed, since it was broken and only
bothering us.
Index: comp_cache.h
===================================================================
RCS file: /cvsroot/linuxcompressed/linux/include/linux/comp_cache.h,v
retrieving revision 1.52
retrieving revision 1.53
diff -C2 -r1.52 -r1.53
*** comp_cache.h 23 Feb 2002 18:24:10 -0000 1.52
--- comp_cache.h 25 Feb 2002 19:34:40 -0000 1.53
***************
*** 2,6 ****
* linux/mm/comp_cache.h
*
! * Time-stamp: <2002-02-23 14:36:13 rcastro>
*
* Linux Virtual Memory Compressed Cache
--- 2,6 ----
* linux/mm/comp_cache.h
*
! * Time-stamp: <2002-02-25 09:43:46 rcastro>
*
* Linux Virtual Memory Compressed Cache
***************
*** 285,367 ****
extern int current_algorithm;
- extern inline int
- fragment_algorithm(comp_cache_fragment_t * fragment)
- {
- if (CompFragmentWKdm(fragment))
- return WKDM_IDX;
-
- if (CompFragmentWK4x4(fragment))
- return WK4X4_IDX;
-
- return -1;
- }
-
- extern void comp_cache_update_comp_stats(unsigned short, stats_page_t *);
-
- static inline int compress(void * from, void * to, unsigned short * algorithm) {
- stats_page_t comp_page_stats;
-
- START_ZEN_TIME(comp_page_stats.myTimer);
- comp_page_stats.comp_size = compression_algorithms[current_algorithm].comp(from, to, PAGE_SIZE/4, (void *)(&comp_data));
- STOP_ZEN_TIME(comp_page_stats.myTimer, comp_page_stats.comp_cycles);
-
- /* update some statistics */
- comp_cache_update_comp_stats(current_algorithm, &comp_page_stats);
-
- *algorithm = current_algorithm;
-
- return ((comp_page_stats.comp_size <= PAGE_SIZE)?comp_page_stats.comp_size:PAGE_SIZE);
- }
-
- extern void comp_cache_update_decomp_stats(unsigned short, stats_page_t *);
-
- static inline void decompress(unsigned short algorithm, void * from, void * to) {
- stats_page_t comp_page_stats;
-
- START_ZEN_TIME(comp_page_stats.myTimer);
- compression_algorithms[algorithm].decomp(from, to, PAGE_SIZE/4, (void *)(&comp_data));
- STOP_ZEN_TIME(comp_page_stats.myTimer, comp_page_stats.decomp_cycles);
-
- /* update some statistics */
- comp_cache_update_decomp_stats(algorithm, &comp_page_stats);
- }
-
- static inline void comp_cache_update_faultin_stats(void) {
- compression_algorithms[current_algorithm].stats.pgccin++;
- }
-
- static inline void
- set_fragment_algorithm(comp_cache_fragment_t * fragment, unsigned short algorithm)
- {
- switch(algorithm) {
- case WKDM_IDX:
- CompFragmentSetWKdm(fragment);
- break;
- case WK4X4_IDX:
- CompFragmentSetWK4x4(fragment);
- break;
- default:
- BUG();
- }
- }
-
/* swapin.c */
#ifdef CONFIG_COMP_CACHE
! int lookup_comp_cache(struct address_space *, unsigned long, struct page *);
! struct page * shmem_lookup_comp_cache(swp_entry_t *, struct address_space *, unsigned long);
void invalidate_comp_page(struct address_space *, unsigned long, struct page *);
void truncate_comp_pages(struct address_space *, unsigned long, unsigned);
void lookup_all_comp_pages(struct address_space *);
- static inline int mapping_has_comp_pages(struct address_space * mapping) { return !list_empty(&mapping->comp_pages); }
-
#else
! static inline int lookup_comp_cache(swp_entry_t) { return 0; }
! static inline struct page * shmem_lookup_comp_cache(swp_entry_t *, struct address_space *, unsigned long)
! {
! return find_get_page(&swapper_space, entry->val);
! }
static inline void invalidate_comp_page(struct address_space * mapping, unsigned long offset, struct page * page) { };
- static inline int mapping_has_comp_pages(struct address_space * mapping) { return 0; }
-
static inline void truncate_comp_pages(struct address_space * mapping, unsigned long start, unsigned partial) { };
static inline void lookup_all_comp_pages(struct address_space * mapping) { };
--- 285,297 ----
extern int current_algorithm;
/* swapin.c */
#ifdef CONFIG_COMP_CACHE
! int lookup_comp_cache(struct address_space *, unsigned long, struct page *);
void invalidate_comp_page(struct address_space *, unsigned long, struct page *);
void truncate_comp_pages(struct address_space *, unsigned long, unsigned);
void lookup_all_comp_pages(struct address_space *);
#else
! static inline int lookup_comp_cache(swp_entry_t entry) { return 0; }
static inline void invalidate_comp_page(struct address_space * mapping, unsigned long offset, struct page * page) { };
static inline void truncate_comp_pages(struct address_space * mapping, unsigned long start, unsigned partial) { };
static inline void lookup_all_comp_pages(struct address_space * mapping) { };
***************
*** 411,430 ****
#define reserved(offset) (vswap_address[offset]->fragment == VSWAP_RESERVED)
- #define comp_cache_swp_free(swp_entry) comp_cache_swp_free_generic(swp_entry, 1)
-
void comp_cache_swp_duplicate(swp_entry_t);
! int comp_cache_swp_free_generic(swp_entry_t, int);
! int comp_cache_swp_count(swp_entry_t);
inline int comp_cache_available_space(void);
! swp_entry_t get_virtual_swap_page(struct page *, unsigned short);
void remap_vswap_ptes(swp_entry_t, struct page *);
!
! inline void add_pte_vswap(pte_t *, swp_entry_t);
! inline void remove_pte_vswap(pte_t *);
! inline void add_swap_cache_page_vswap(struct page *, swp_entry_t);
! inline void del_swap_cache_page_vswap(struct page *);
void vswap_alloc_and_init(struct vswap_address **, int);
--- 341,357 ----
#define reserved(offset) (vswap_address[offset]->fragment == VSWAP_RESERVED)
void comp_cache_swp_duplicate(swp_entry_t);
! int comp_cache_swp_free(swp_entry_t);
! int comp_cache_swp_count(swp_entry_t);
inline int comp_cache_available_space(void);
! swp_entry_t get_virtual_swap_page(void);
void remap_vswap_ptes(swp_entry_t, struct page *);
! extern void FASTCALL(add_pte_vswap(pte_t *, swp_entry_t));
! extern void FASTCALL(remove_pte_vswap(pte_t *));
! extern void FASTCALL(add_swap_cache_page_vswap(struct page *, swp_entry_t));
! extern void FASTCALL(del_swap_cache_page_vswap(struct page *));
void vswap_alloc_and_init(struct vswap_address **, int);
***************
*** 436,441 ****
#define vswap_address(entry) (0)
- #define comp_cache_swp_free(swp_entry) comp_cache_swp_free_generic(swp_entry, 1)
-
static inline void comp_cache_swp_duplicate(swp_entry_t entry) {};
static inline int comp_cache_swp_free_generic(swp_entry_t entry, int free_fragment) { return 0; }
--- 363,366 ----
***************
*** 454,459 ****
/* free.c */
- inline void comp_cache_free(comp_cache_fragment_t *);
void comp_cache_free_locked(comp_cache_fragment_t *);
#ifdef CONFIG_COMP_CACHE
--- 379,384 ----
/* free.c */
void comp_cache_free_locked(comp_cache_fragment_t *);
+ inline void comp_cache_free(comp_cache_fragment_t *);
#ifdef CONFIG_COMP_CACHE
Index: fs.h
===================================================================
RCS file: /cvsroot/linuxcompressed/linux/include/linux/fs.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** fs.h 21 Feb 2002 15:14:11 -0000 1.1
--- fs.h 25 Feb 2002 19:34:40 -0000 1.2
***************
*** 398,402 ****
struct list_head dirty_pages; /* list of dirty pages */
#ifdef CONFIG_COMP_CACHE
! struct list_head comp_pages; /* list of compressed pages */
#endif
struct list_head locked_pages; /* list of locked pages */
--- 398,403 ----
struct list_head dirty_pages; /* list of dirty pages */
#ifdef CONFIG_COMP_CACHE
! struct list_head clean_comp_pages; /* list of clean compressed pages */
! struct list_head dirty_comp_pages; /* list of dirty compressed pages */
#endif
struct list_head locked_pages; /* list of locked pages */
Index: mm.h
===================================================================
RCS file: /cvsroot/linuxcompressed/linux/include/linux/mm.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -r1.13 -r1.14
*** mm.h 23 Feb 2002 18:24:10 -0000 1.13
--- mm.h 25 Feb 2002 19:34:40 -0000 1.14
***************
*** 303,306 ****
--- 303,307 ----
#define PageLaunder(page) test_bit(PG_launder, &(page)->flags)
#define SetPageLaunder(page) set_bit(PG_launder, &(page)->flags)
+ #define ClearPageLaunder(page) clear_bit(PG_launder, &(page)->flags)
extern void FASTCALL(set_page_dirty(struct page *));
***************
*** 333,336 ****
--- 334,338 ----
#define PageClearCompCache(page) clear_bit(PG_comp_cache, &(page)->flags)
#define PageTestandSetCompCache(page) test_and_set_bit(PG_comp_cache, &(page)->flags)
+ #define PageTestandClearCompCache(page) test_and_clear_bit(PG_comp_cache, &(page)->flags)
#define PageActive(page) test_bit(PG_active, &(page)->flags)
|