[lc-checkins] CVS: linux/include/linux comp_cache.h,1.84,1.85 swap.h,1.14,1.15
Status: Beta
Brought to you by:
nitin_sf
From: Rodrigo S. de C. <rc...@us...> - 2002-07-01 17:37:32
|
Update of /cvsroot/linuxcompressed/linux/include/linux In directory usw-pr-cvs1:/tmp/cvs-serv26297/include/linux Modified Files: comp_cache.h swap.h Log Message: Features o Some compressed cache functions (in particular the swap out ones) have priority parameter now, which will passed from VM main functions. The priority will show how far we should go on scanning lists to free spaces in compressed cache. o Fragments will not be decompressed when they are read from a read ahead (for swap and page cache). In this case, we only check if the fragment is in compressed cache. This police avoids LRU order to be changed. o Fragments will be removed from compressed cache if resize on demand is enabled. o Support for pages with buffers will only happen if resize on demand is disabled. Bug fixes o Fixed potential bug in __find_lock_page() where we would decompress a fragment and add a new page to page cache even if it had been just swapped in. Cleanups o Added #ifdefs in lru queues functions. o Several small cleanups Other o compress_page() only returns the page in locked state if it has been compressed. Otherwise, it will returned always unlocked. o now get_comp_cache_page() doesn't try so hard to get an entry. The maximum number of tries (which includes calls to writeout_fragments()) is 3. Index: comp_cache.h =================================================================== RCS file: /cvsroot/linuxcompressed/linux/include/linux/comp_cache.h,v retrieving revision 1.84 retrieving revision 1.85 diff -C2 -r1.84 -r1.85 *** comp_cache.h 27 Jun 2002 13:17:37 -0000 1.84 --- comp_cache.h 1 Jul 2002 17:37:28 -0000 1.85 *************** *** 2,6 **** * linux/mm/comp_cache.h * ! * Time-stamp: <2002-06-27 09:33:08 rcastro> * * Linux Virtual Memory Compressed Cache --- 2,6 ---- * linux/mm/comp_cache.h * ! * Time-stamp: <2002-07-01 13:09:35 rcastro> * * Linux Virtual Memory Compressed Cache *************** *** 314,318 **** extern int FASTCALL(flush_comp_cache(struct page *)); ! int read_comp_cache(struct address_space *, unsigned long, struct page *, int); int invalidate_comp_cache(struct address_space *, unsigned long); void invalidate_comp_pages(struct address_space *); --- 314,318 ---- extern int FASTCALL(flush_comp_cache(struct page *)); ! int read_comp_cache(struct address_space *, unsigned long, struct page *); int invalidate_comp_cache(struct address_space *, unsigned long); void invalidate_comp_pages(struct address_space *); *************** *** 323,327 **** #define there_are_locked_comp_pages(mapping) (!list_empty(&(mapping)->locked_comp_pages)) #else ! static inline int read_comp_cache(struct address_space * mapping, unsigned long offset, struct page * page, int access) { return -ENOENT; } static inline int invalidate_comp_cache(struct address_space * mapping, unsigned long offset) { return -ENOENT; } static inline int flush_comp_cache(struct page * page) { return -ENOENT; } --- 323,327 ---- #define there_are_locked_comp_pages(mapping) (!list_empty(&(mapping)->locked_comp_pages)) #else ! static inline int read_comp_cache(struct address_space * mapping, unsigned long offset, struct page * page) { return -ENOENT; } static inline int invalidate_comp_cache(struct address_space * mapping, unsigned long offset) { return -ENOENT; } static inline int flush_comp_cache(struct page * page) { return -ENOENT; } *************** *** 336,344 **** /* main.c */ #ifdef CONFIG_COMP_CACHE ! int compress_page(struct page *, int, unsigned int); 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); ! inline int compress_clean_page(struct page *, unsigned int); extern unsigned long comp_cache_free_space; --- 336,344 ---- /* main.c */ #ifdef CONFIG_COMP_CACHE ! int compress_page(struct page *, int, unsigned int, int); 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; *************** *** 346,358 **** #else static inline void comp_cache_init(void) {}; ! static inline int compress_dirty_page(struct page * page, int (*writepage)(struct page *), unsigned int gfp_mask) { return writepage(page); } ! static inline int compress_clean_page(struct page * page, unsigned int gfp_mask) { return 1; } #endif #ifdef CONFIG_COMP_PAGE_CACHE - int comp_cache_try_to_release_page(struct page **, int); void steal_page_from_comp_cache(struct page *, struct page *); #else ! static inline int comp_cache_try_to_release_page(struct page ** page, int gfp_mask) { return try_to_release_page(*page, gfp_mask); } static inline void steal_page_from_comp_cache(struct page * page, struct page * new_page) {}; #endif --- 346,362 ---- #else static inline void comp_cache_init(void) {}; ! static inline int compress_dirty_page(struct page * page, int (*writepage)(struct page *), unsigned int gfp_mask, int priority) { return writepage(page); } ! static inline int compress_clean_page(struct page * page, unsigned int gfp_mask, int priority) { return 1; } #endif #ifdef CONFIG_COMP_PAGE_CACHE void steal_page_from_comp_cache(struct page *, struct page *); + #ifndef CONFIG_COMP_DEMAND_RESIZE + int comp_cache_try_to_release_page(struct page **, int, int); #else ! static inline int comp_cache_try_to_release_page(struct page ** page, int gfp_mask, int priority) { return try_to_release_page(*page, gfp_mask); } ! #endif ! #else ! static inline int comp_cache_try_to_release_page(struct page ** page, int gfp_mask, int priority) { return try_to_release_page(*page, gfp_mask); } static inline void steal_page_from_comp_cache(struct page * page, struct page * new_page) {}; #endif *************** *** 546,552 **** --- 550,558 ---- /* enough memory functions */ #ifdef CONFIG_COMP_CACHE + inline int in_comp_cache(struct address_space *, unsigned long); extern int FASTCALL(find_comp_page(struct address_space *, unsigned long, struct comp_cache_fragment **)); #else static inline int find_comp_page(struct address_space * mapping, unsigned long offset, struct comp_cache_fragment ** fragment) { return -ENOENT; } + static inline int in_comp_cache(struct address_space * mapping, unsigned long offset) { return 0; } #endif Index: swap.h =================================================================== RCS file: /cvsroot/linuxcompressed/linux/include/linux/swap.h,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -r1.14 -r1.15 *** swap.h 27 Feb 2002 14:16:52 -0000 1.14 --- swap.h 1 Jul 2002 17:37:29 -0000 1.15 *************** *** 140,144 **** extern void free_page_and_swap_cache(struct page *page); extern struct page * lookup_swap_cache(swp_entry_t); ! extern struct page * read_swap_cache_async(swp_entry_t); /* linux/mm/oom_kill.c */ --- 140,146 ---- extern void free_page_and_swap_cache(struct page *page); extern struct page * lookup_swap_cache(swp_entry_t); ! extern struct page * __read_swap_cache_async(swp_entry_t, int); ! #define read_swap_cache_async(entry) __read_swap_cache_async(entry, 0) ! #define read_swap_cache_async_ahead(entry) __read_swap_cache_async(entry, 1) /* linux/mm/oom_kill.c */ |