[lc-checkins] CVS: linux/include/linux comp_cache.h,1.72,1.73 mm.h,1.15,1.16 sysctl.h,1.3,1.4
Status: Beta
Brought to you by:
nitin_sf
|
From: Rodrigo S. de C. <rc...@us...> - 2002-06-11 13:21:07
|
Update of /cvsroot/linuxcompressed/linux/include/linux
In directory usw-pr-cvs1:/tmp/cvs-serv3905/include/linux
Modified Files:
comp_cache.h mm.h sysctl.h
Log Message:
- Now compress_*_page() and shrink_cache() take into account the
return value of compress_page() and don't loop in shrink_cache() if
not needed.
- Support for storing page with buffers in compressed cache. These
pages are not compressed, only referenced by a compressed cache entry
in order to make the space reserved for compressed cache useful for
these kind of pages. The main consequence is that we avoid syncing
those buffers to disk in case of memory pressure on the uncompressed
cache.
- For this buffer support, there's a new page flag used by our
code. It's called PG_mapped_comp_cache, which means that a certain
page is part of page cache, but is also mapped by compressed
cache. The old PG_comp_cache flag means that the page has a fragment
in compressed cache. The difference is subtle.
- The buffer support is based on two main functions. The first one,
comp_cache_try_to_release(), is a wrapper for try_to_release()
function. In some cases, we won't call the try_to_release() and will
store the page in compressed cache, returning the page reserved for
compressed cache (if any) to the caller (shrink_cache()) to be freed.
- The second fundamental function is steal_page_from_comp_cache(),
which will remove a PageMappedCompCache from compressed cache,
ocasionally replacing this page (which was used by compressed cache)
with a new one. That sort of thing is needed when mapping this page
back to a pte or for any reference that is made to this particular
page. Actually, all reference to a PageMappedCompCache page will
remove it from compressed cache (will "steal" it).
- Another way out for this kind of page will be writeout_fragments(),
which will sync the page buffers, removing from page cache (or swap
cache), and keep using this page just freed for the compressed cache.
- New info in /proc/comp_cache_hist. Now /proc/comp_cache_hist shows
data about how many compressed cache entries whose pages have buffers
and also compressed cache entries without a reserved page (which will
happen often with buffer support, since the buffer support may "steal"
the page from compressed cache).
Index: comp_cache.h
===================================================================
RCS file: /cvsroot/linuxcompressed/linux/include/linux/comp_cache.h,v
retrieving revision 1.72
retrieving revision 1.73
diff -C2 -r1.72 -r1.73
*** comp_cache.h 30 May 2002 16:33:17 -0000 1.72
--- comp_cache.h 11 Jun 2002 13:20:48 -0000 1.73
***************
*** 2,6 ****
* linux/mm/comp_cache.h
*
! * Time-stamp: <2002-05-30 13:12:50 rcastro>
*
* Linux Virtual Memory Compressed Cache
--- 2,6 ----
* linux/mm/comp_cache.h
*
! * Time-stamp: <2002-06-10 15:02:12 rcastro>
*
* Linux Virtual Memory Compressed Cache
***************
*** 342,347 ****
void comp_cache_init(void);
inline void init_comp_page(comp_cache_t **,struct page *);
! inline int compress_dirty_page(struct page *, int (*writepage)(struct page *), unsigned int);
! inline int compress_clean_page(struct page *, unsigned int);
extern int nr_swap_misses;
--- 342,350 ----
void comp_cache_init(void);
inline void init_comp_page(comp_cache_t **,struct page *);
! inline void compress_dirty_page(struct page *, int (*writepage)(struct page *), unsigned int);
! inline int compress_clean_page(struct page *, unsigned int);
!
! void steal_page_from_comp_cache(struct page *, struct page *);
! int comp_cache_try_to_release_page(struct page **, int);
extern int nr_swap_misses;
***************
*** 359,362 ****
--- 362,368 ----
static inline int compress_clean_page(struct page * page, unsigned int gfp_mask) { return 0; }
+ static inline void steal_page_from_comp_cache(struct page * page, struct page * new_page) {};
+ static inline int comp_cache_try_to_release_page(struct page ** page, int gfp_mask) { return try_to_release_page(*page, gfp_mask); }
+
#define add_swap_miss() (0)
#define add_compressed_cache_miss() (0)
***************
*** 484,488 ****
/* aux.c */
unsigned long long big_division(unsigned long long, unsigned long long);
!
inline void check_all_fragments(comp_cache_t *);
--- 490,494 ----
/* aux.c */
unsigned long long big_division(unsigned long long, unsigned long long);
! inline void set_comp_page(comp_cache_t *, struct page *);
inline void check_all_fragments(comp_cache_t *);
***************
*** 548,551 ****
--- 554,558 ----
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 *);
Index: mm.h
===================================================================
RCS file: /cvsroot/linuxcompressed/linux/include/linux/mm.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -r1.15 -r1.16
*** mm.h 1 Mar 2002 14:30:52 -0000 1.15
--- mm.h 11 Jun 2002 13:20:49 -0000 1.16
***************
*** 287,290 ****
--- 287,292 ----
#define PG_launder 15 /* written out by VM pressure.. */
#define PG_comp_cache 16 /* page with a fragment in compressed cache */
+ #define PG_mapped_comp_cache 17 /* page from page cache that is also mapped in
+ * the compressed cache */
/* Make it prettier to test the above... */
***************
*** 330,335 ****
--- 332,339 ----
#ifdef CONFIG_COMP_CACHE
#define PageCompCache(page) test_bit(PG_comp_cache, &(page)->flags)
+ #define PageMappedCompCache(page) test_bit(PG_mapped_comp_cache, &(page)->flags)
#else
#define PageCompCache(page) 0
+ #define PageMappedCompCache(page) 0
#endif
***************
*** 338,341 ****
--- 342,350 ----
#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 PageSetMappedCompCache(page) set_bit(PG_mapped_comp_cache, &(page)->flags)
+ #define PageClearMappedCompCache(page) clear_bit(PG_mapped_comp_cache, &(page)->flags)
+ #define PageTestandSetMappedCompCache(page) test_and_set_bit(PG_mapped_comp_cache, &(page)->flags)
+ #define PageTestandClearMappedCompCache(page) test_and_clear_bit(PG_mapped_comp_cache, &(page)->flags)
#define PageActive(page) test_bit(PG_active, &(page)->flags)
Index: sysctl.h
===================================================================
RCS file: /cvsroot/linuxcompressed/linux/include/linux/sysctl.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** sysctl.h 13 Dec 2001 19:12:57 -0000 1.3
--- sysctl.h 11 Jun 2002 13:20:49 -0000 1.4
***************
*** 146,149 ****
--- 146,150 ----
};
+
/* CTL_NET names: */
enum
|