[lc-checkins] CVS: linux/mm/comp_cache aux.c,1.25,1.26 main.c,1.36,1.37 proc.c,1.8,1.9 swapin.c,1.34
Status: Beta
Brought to you by:
nitin_sf
|
From: Rodrigo S. de C. <rc...@us...> - 2002-05-21 18:49:11
|
Update of /cvsroot/linuxcompressed/linux/mm/comp_cache
In directory usw-pr-cvs1:/tmp/cvs-serv1879/mm/comp_cache
Modified Files:
aux.c main.c proc.c swapin.c swapout.c
Log Message:
- New statistics for compressed dirty and clean pages
- Cleanups regarding comp_cache_skip_* prototypes. These functions will no
longer be used in compressed cache since they impose fundamental changes
upon the VM that aren't worth it and would require long time researching and
testing.
- Some comestic changes regarding the information printed on boot process.
- Now we fix the normal zone watermarks when compressed cache is initialized
to make sure we don't put too much (and unneeded) pressure on the
uncompressed cache. For example, on a system with 48M RAM and 24M compressed
cache, the watermarks on the remaining 24M uncompressed cache will have been
wrongly computed on the 48M total memory. Now we make sure that the
watermarks are computed on the correct amount of uncompressed cache
available memory. This information (old and new watermarks) is printed along
with the initial compressed cache boot messages.
- Clean CompCache bit for freed pages in lookup_all_comp_pages().
- Make sure we first try to get a swap buffer without syncing its buffers to
disk. Earlier, we were syncing any dirty buffer as soon as we could lock a
page. Now that's done only in case we couldn't get any page without syncing
its buffer in order to free them. That's done cleaning up the __GFP_IO flag
if we are in the "don't sync" (= !wait) stage.
Index: aux.c
===================================================================
RCS file: /cvsroot/linuxcompressed/linux/mm/comp_cache/aux.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -r1.25 -r1.26
*** aux.c 15 May 2002 18:05:36 -0000 1.25
--- aux.c 21 May 2002 18:49:06 -0000 1.26
***************
*** 2,6 ****
* linux/mm/comp_cache/aux.c
*
! * Time-stamp: <2002-05-15 12:31:27 rcastro>
*
* Linux Virtual Memory Compressed Cache
--- 2,6 ----
* linux/mm/comp_cache/aux.c
*
! * Time-stamp: <2002-05-21 12:34:55 rcastro>
*
* Linux Virtual Memory Compressed Cache
***************
*** 402,406 ****
panic("comp_cache_hash_init(): couldn't allocate fragment hash table\n");
! printk("Compressed Cache: fragment hash table - %lu entries = %luB\n", fragment_hash_size, (PAGE_SIZE << fragment_hash_order));
/* inits comp cache free space hash table */
--- 402,407 ----
panic("comp_cache_hash_init(): couldn't allocate fragment hash table\n");
! printk("Compressed Cache: hash table\n"
! "Compressed Cache: fragment (%lu entries = %luB)\n", fragment_hash_size, (PAGE_SIZE << fragment_hash_order));
/* inits comp cache free space hash table */
***************
*** 410,414 ****
free_space_hash = vmalloc(free_space_hash_size * sizeof(comp_cache_t *));
! printk("Compressed Cache: free space hash table - %u entries = %uB\n", free_space_hash_size, free_space_hash_size * sizeof(comp_cache_t *));
if (!free_space_hash)
--- 411,415 ----
free_space_hash = vmalloc(free_space_hash_size * sizeof(comp_cache_t *));
! printk("Compressed Cache: free space (%u entries = %uB)\n", free_space_hash_size, free_space_hash_size * sizeof(comp_cache_t *));
if (!free_space_hash)
Index: main.c
===================================================================
RCS file: /cvsroot/linuxcompressed/linux/mm/comp_cache/main.c,v
retrieving revision 1.36
retrieving revision 1.37
diff -C2 -r1.36 -r1.37
*** main.c 15 May 2002 18:05:36 -0000 1.36
--- main.c 21 May 2002 18:49:06 -0000 1.37
***************
*** 2,6 ****
* linux/mm/comp_cache/main.c
*
! * Time-stamp: <2002-05-15 10:06:22 rcastro>
*
* Linux Virtual Memory Compressed Cache
--- 2,6 ----
* linux/mm/comp_cache/main.c
*
! * Time-stamp: <2002-05-21 12:40:53 rcastro>
*
* Linux Virtual Memory Compressed Cache
***************
*** 105,109 ****
#endif
! comp_size = compress(current_compressed_page = page, buffer_compressed = (unsigned long *) &buffer_compressed1, &algorithm);
comp_page = get_comp_cache_page(page, comp_size, &fragment, dirty, gfp_mask);
--- 105,109 ----
#endif
! comp_size = compress(current_compressed_page = page, buffer_compressed = (unsigned long *) &buffer_compressed1, &algorithm, dirty);
comp_page = get_comp_cache_page(page, comp_size, &fragment, dirty, gfp_mask);
***************
*** 123,127 ****
if (compressed(fragment)) {
if (current_compressed_page != page)
! compress(page, buffer_compressed = (unsigned long *) &buffer_compressed2, &algorithm);
memcpy(page_address(comp_page->page) + fragment->offset, buffer_compressed , fragment->compressed_size);
} else
--- 123,127 ----
if (compressed(fragment)) {
if (current_compressed_page != page)
! compress(page, buffer_compressed = (unsigned long *) &buffer_compressed2, &algorithm, dirty);
memcpy(page_address(comp_page->page) + fragment->offset, buffer_compressed , fragment->compressed_size);
} else
***************
*** 151,154 ****
--- 151,156 ----
}
+ extern void comp_cache_fix_watermarks(int num_comp_pages);
+
void __init
comp_cache_init(void)
***************
*** 166,170 ****
new_num_comp_pages = min_num_comp_pages = num_comp_pages = init_num_comp_pages;
! printk("Compressed Cache: starting %s version\n", COMP_CACHE_VERSION);
/* adaptivity */
--- 168,172 ----
new_num_comp_pages = min_num_comp_pages = num_comp_pages = init_num_comp_pages;
! printk("Compressed Cache: %s\n", COMP_CACHE_VERSION);
/* adaptivity */
***************
*** 183,187 ****
for (i = 0; i < nr_preset_sizes; i++)
! printk("Compressed Cache: preset size %d: %u memory pages\n", i, preset_comp_cache[i].size);
for (i = 0; i < 10; i++)
--- 185,189 ----
for (i = 0; i < nr_preset_sizes; i++)
! printk("Compressed Cache: preset size %d: %u memory pages\n", i, preset_comp_cache[i].size);
for (i = 0; i < 10; i++)
***************
*** 189,194 ****
latest_miss = 0;
#else
! printk("Compressed Cache: initial size - %lu pages = %luKiB\n", init_num_comp_pages, (init_num_comp_pages * PAGE_SIZE)/1024);
#endif
/* create slab caches */
--- 191,200 ----
latest_miss = 0;
#else
! printk("Compressed Cache: initial size\n"
! "Compressed Cache: %lu pages = %luKiB\n", init_num_comp_pages, (init_num_comp_pages * PAGE_SIZE)/1024);
#endif
+
+ /* fiz zone watermarks */
+ comp_cache_fix_watermarks(init_num_comp_pages);
/* create slab caches */
Index: proc.c
===================================================================
RCS file: /cvsroot/linuxcompressed/linux/mm/comp_cache/proc.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** proc.c 15 May 2002 18:05:36 -0000 1.8
--- proc.c 21 May 2002 18:49:06 -0000 1.9
***************
*** 2,6 ****
* linux/mm/comp_cache/proc.c
*
! * Time-stamp: <2002-05-15 10:40:40 rcastro>
*
* Linux Virtual Memory Compressed Cache
--- 2,6 ----
* linux/mm/comp_cache/proc.c
*
! * Time-stamp: <2002-05-16 14:11:49 rcastro>
*
* Linux Virtual Memory Compressed Cache
***************
*** 58,62 ****
static void
! comp_cache_update_comp_stats(stats_page_t * comp_page_stats, struct page * page)
{
compression_algorithm_t * algorithm = &compression_algorithms[current_algorithm];
--- 58,62 ----
static void
! comp_cache_update_comp_stats(stats_page_t * comp_page_stats, struct page * page, int dirty)
{
compression_algorithm_t * algorithm = &compression_algorithms[current_algorithm];
***************
*** 90,93 ****
--- 90,97 ----
#endif
compression_algorithms[current_algorithm].stats.comp_swap++;
+ if (dirty)
+ compression_algorithms[current_algorithm].stats.comp_dirty++;
+ else
+ compression_algorithms[current_algorithm].stats.comp_clean++;
}
***************
*** 147,151 ****
int
! compress(struct page * page, void * to, unsigned short * algorithm)
{
stats_page_t comp_page_stats;
--- 151,155 ----
int
! compress(struct page * page, void * to, unsigned short * algorithm, int dirty)
{
stats_page_t comp_page_stats;
***************
*** 155,159 ****
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);
! comp_cache_update_comp_stats(&comp_page_stats, page);
*algorithm = current_algorithm;
--- 159,163 ----
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);
! comp_cache_update_comp_stats(&comp_page_stats, page, dirty);
*algorithm = current_algorithm;
***************
*** 253,256 ****
--- 257,262 ----
" Swap Cache: %8lu\n"
" Page Cache: %8lu\n"
+ " Dirty: %8lu\n"
+ " Clean: %8lu\n"
"Decompressed Pages: %8lu\n"
" Swap Cache: %8lu\n"
***************
*** 265,268 ****
--- 271,276 ----
stats->comp_swap,
stats->comp_page,
+ stats->comp_dirty,
+ stats->comp_clean,
total_decomp_pages,
stats->decomp_swap,
Index: swapin.c
===================================================================
RCS file: /cvsroot/linuxcompressed/linux/mm/comp_cache/swapin.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -C2 -r1.34 -r1.35
*** swapin.c 2 May 2002 16:31:37 -0000 1.34
--- swapin.c 21 May 2002 18:49:06 -0000 1.35
***************
*** 2,6 ****
* linux/mm/comp_cache/swapin.c
*
! * Time-stamp: <2002-04-30 11:36:19 rcastro>
*
* Linux Virtual Memory Compressed Cache
--- 2,6 ----
* linux/mm/comp_cache/swapin.c
*
! * Time-stamp: <2002-05-21 11:27:43 rcastro>
*
* Linux Virtual Memory Compressed Cache
***************
*** 208,213 ****
decompress_fragment(fragment, page);
comp_cache_free_locked(fragment);
!
! __set_page_dirty(page);
page_cache_release(page);
--- 208,214 ----
decompress_fragment(fragment, page);
comp_cache_free_locked(fragment);
!
! PageClearCompCache(page);
! __set_page_dirty(page);
page_cache_release(page);
Index: swapout.c
===================================================================
RCS file: /cvsroot/linuxcompressed/linux/mm/comp_cache/swapout.c,v
retrieving revision 1.42
retrieving revision 1.43
diff -C2 -r1.42 -r1.43
*** swapout.c 15 May 2002 18:05:36 -0000 1.42
--- swapout.c 21 May 2002 18:49:06 -0000 1.43
***************
*** 2,6 ****
* /mm/comp_cache/swapout.c
*
! * Time-stamp: <2002-05-15 10:07:24 rcastro>
*
* Linux Virtual Memory Compressed Cache
--- 2,6 ----
* /mm/comp_cache/swapout.c
*
! * Time-stamp: <2002-05-21 11:23:59 rcastro>
*
* Linux Virtual Memory Compressed Cache
***************
*** 66,71 ****
if (swp_buffer->page->buffers) {
list_del_init(swp_buffer_lh);
! if (!try_to_free_buffers(swp_buffer->page, gfp_mask)) {
list_add_tail(swp_buffer_lh, &swp_used_buffer_head);
UnlockPage(swp_buffer->page);
--- 66,80 ----
if (swp_buffer->page->buffers) {
+ unsigned int gfp_mask_buffer = gfp_mask;
+
+ /***
+ * we would like to try freeing the buffers
+ * without syncing them to disk at this first
+ * try, so let's get rid of __GFP_IO flag
+ */
+ if (!wait)
+ gfp_mask_buffer &= ~__GFP_IO;
list_del_init(swp_buffer_lh);
! if (!try_to_free_buffers(swp_buffer->page, gfp_mask_buffer)) {
list_add_tail(swp_buffer_lh, &swp_used_buffer_head);
UnlockPage(swp_buffer->page);
|