[lc-checkins] CVS: linux/mm/comp_cache adaptivity.c,1.17,1.18 aux.c,1.24,1.25 free.c,1.28,1.29 main.
Status: Beta
Brought to you by:
nitin_sf
|
From: Rodrigo S. de C. <rc...@us...> - 2002-05-15 18:05:39
|
Update of /cvsroot/linuxcompressed/linux/mm/comp_cache
In directory usw-pr-cvs1:/tmp/cvs-serv11239/mm/comp_cache
Modified Files:
adaptivity.c aux.c free.c main.c proc.c swapout.c vswap.c
Log Message:
- Fix meminfo output when compressed cache is enabled. Thus, cached memory
and swap cached memory actually corresponds to the cache and swap cached
memory in non-compressed cache. Besides, adds two lines to its output with
information about compressed cache memory consumption like how much memory
was reserved and how much is being used at that moment.
Index: adaptivity.c
===================================================================
RCS file: /cvsroot/linuxcompressed/linux/mm/comp_cache/adaptivity.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -r1.17 -r1.18
*** adaptivity.c 28 Apr 2002 20:51:35 -0000 1.17
--- adaptivity.c 15 May 2002 18:05:36 -0000 1.18
***************
*** 2,6 ****
* linux/mm/comp_cache/adaptivity.c
*
! * Time-stamp: <2002-04-03 12:33:28 rcastro>
*
* Linux Virtual Memory Compressed Cache
--- 2,6 ----
* linux/mm/comp_cache/adaptivity.c
*
! * Time-stamp: <2002-05-15 10:31:44 rcastro>
*
* Linux Virtual Memory Compressed Cache
***************
*** 24,28 ****
int latest_uncomp_misses[10], latest_miss;
- #define comp_cache_used_space ((real_num_comp_pages * PAGE_SIZE) - comp_cache_free_space)
#define comp_cache_total_space (preset_comp_cache[i].size * PAGE_SIZE)
--- 24,27 ----
***************
*** 62,66 ****
printk("nr_uncomp_misses %d\n", nr_uncomp_misses);
! printk("free space %ld\n", (comp_cache_free_space * 100)/(real_num_comp_pages * PAGE_SIZE));
/* compute costs and benefits - smaller sizes*/
--- 61,65 ----
printk("nr_uncomp_misses %d\n", nr_uncomp_misses);
! printk("free space %ld\n", (comp_cache_free_space * 100)/(num_comp_pages * PAGE_SIZE));
/* compute costs and benefits - smaller sizes*/
***************
*** 103,107 ****
}
! if (comp_cache_free_space > 0.30 * real_num_comp_pages * PAGE_SIZE)
goto out;
--- 102,106 ----
}
! if (comp_cache_free_space > 0.30 * num_comp_pages * PAGE_SIZE)
goto out;
***************
*** 171,175 ****
unsigned int i, new_fragment_hash_bits, new_fragment_hash_order, hash_index;
! new_fragment_hash_size = 3 * real_num_comp_pages * sizeof(comp_cache_fragment_t *);
new_fragment_hash = create_fragment_hash(&new_fragment_hash_size, &new_fragment_hash_bits, &new_fragment_hash_order);
--- 170,174 ----
unsigned int i, new_fragment_hash_bits, new_fragment_hash_order, hash_index;
! new_fragment_hash_size = 3 * num_comp_pages * sizeof(comp_cache_fragment_t *);
new_fragment_hash = create_fragment_hash(&new_fragment_hash_size, &new_fragment_hash_bits, &new_fragment_hash_order);
***************
*** 181,185 ****
/* if we are growing the hash, but couldn't allocate a bigger
* chunk, let's back out and keep the current one */
! if (3 * real_num_comp_pages > fragment_hash_size &&
new_fragment_hash_order <= fragment_hash_order)
goto free_new_hash;
--- 180,184 ----
/* if we are growing the hash, but couldn't allocate a bigger
* chunk, let's back out and keep the current one */
! if (3 * num_comp_pages > fragment_hash_size &&
new_fragment_hash_order <= fragment_hash_order)
goto free_new_hash;
***************
*** 225,229 ****
* shrink_vswap(unsigned long) - shrinks vswap adressing table from
* its current size (vswap_current_num_entries) to NUM_VSWAP_ENTRIES,
! * its new size in function of real_num_comp_pages.
*
* we try to shrink the vswap at once, but that will depend on getting
--- 224,228 ----
* shrink_vswap(unsigned long) - shrinks vswap adressing table from
* its current size (vswap_current_num_entries) to NUM_VSWAP_ENTRIES,
! * its new size in function of num_comp_pages.
*
* we try to shrink the vswap at once, but that will depend on getting
***************
*** 425,429 ****
/* grow_vswap(void) - grows vswap adressing table from its current
* size (vswap_current_num_entries) to NUM_VSWAP_ENTRIES, its new size
! * in function of real_num_comp_pages.
*
* we allocate the new vswap table and allocates the needed vswap
--- 424,428 ----
/* grow_vswap(void) - grows vswap adressing table from its current
* size (vswap_current_num_entries) to NUM_VSWAP_ENTRIES, its new size
! * in function of num_comp_pages.
*
* we allocate the new vswap table and allocates the needed vswap
***************
*** 495,499 ****
static inline int
fragment_hash_needs_to_shrink(void) {
! unsigned long new_fragment_hash_size = (3 * real_num_comp_pages) * sizeof(comp_cache_fragment_t *);
/* if we shrink the hash table an order, will the data fit in
--- 494,498 ----
static inline int
fragment_hash_needs_to_shrink(void) {
! unsigned long new_fragment_hash_size = (3 * num_comp_pages) * sizeof(comp_cache_fragment_t *);
/* if we shrink the hash table an order, will the data fit in
***************
*** 526,530 ****
comp_cache_needs_to_shrink(void) {
/* obvious condition */
! if (new_num_comp_pages >= real_num_comp_pages)
return 0;
--- 525,529 ----
comp_cache_needs_to_shrink(void) {
/* obvious condition */
! if (new_num_comp_pages >= num_comp_pages)
return 0;
***************
*** 565,570 ****
comp_cache_freeable_space -= PAGE_SIZE;
comp_cache_free_space -= PAGE_SIZE;
! real_num_comp_pages--;
! //printk("shrink new %lu real %lu\n", new_num_comp_pages, real_num_comp_pages);
out:
--- 564,569 ----
comp_cache_freeable_space -= PAGE_SIZE;
comp_cache_free_space -= PAGE_SIZE;
! num_comp_pages--;
! //printk("shrink new %lu real %lu\n", new_num_comp_pages, num_comp_pages);
out:
***************
*** 598,606 ****
}
! #define comp_cache_needs_to_grow() (new_num_comp_pages > real_num_comp_pages)
static inline int
fragment_hash_needs_to_grow(void) {
! unsigned long new_fragment_hash_size = (3 * real_num_comp_pages) * sizeof(comp_cache_fragment_t *);
/* do we really need a bigger hash table? */
--- 597,605 ----
}
! #define comp_cache_needs_to_grow() (new_num_comp_pages > num_comp_pages)
static inline int
fragment_hash_needs_to_grow(void) {
! unsigned long new_fragment_hash_size = (3 * num_comp_pages) * sizeof(comp_cache_fragment_t *);
/* do we really need a bigger hash table? */
***************
*** 644,649 ****
comp_cache_freeable_space += PAGE_SIZE;
comp_cache_free_space += PAGE_SIZE;
! real_num_comp_pages++;
! //printk("grow real %lu\n", real_num_comp_pages);
}
--- 643,648 ----
comp_cache_freeable_space += PAGE_SIZE;
comp_cache_free_space += PAGE_SIZE;
! num_comp_pages++;
! //printk("grow real %lu\n", num_comp_pages);
}
Index: aux.c
===================================================================
RCS file: /cvsroot/linuxcompressed/linux/mm/comp_cache/aux.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -r1.24 -r1.25
*** aux.c 28 Apr 2002 20:51:35 -0000 1.24
--- aux.c 15 May 2002 18:05:36 -0000 1.25
***************
*** 2,6 ****
* linux/mm/comp_cache/aux.c
*
! * Time-stamp: <2002-04-18 13:00:30 rcastro>
*
* Linux Virtual Memory Compressed Cache
--- 2,6 ----
* linux/mm/comp_cache/aux.c
*
! * Time-stamp: <2002-05-15 12:31:27 rcastro>
*
* Linux Virtual Memory Compressed Cache
***************
*** 395,399 ****
/* fragment hash table (code heavily based on
* page_cache_init():filemap.c */
! fragment_hash_size = 3 * real_num_comp_pages * sizeof(comp_cache_fragment_t *);
fragment_hash_used = 0;
fragment_hash = create_fragment_hash(&fragment_hash_size, &fragment_hash_bits, &fragment_hash_order);
--- 395,399 ----
/* fragment hash table (code heavily based on
* page_cache_init():filemap.c */
! fragment_hash_size = 3 * num_comp_pages * sizeof(comp_cache_fragment_t *);
fragment_hash_used = 0;
fragment_hash = create_fragment_hash(&fragment_hash_size, &fragment_hash_bits, &fragment_hash_order);
Index: free.c
===================================================================
RCS file: /cvsroot/linuxcompressed/linux/mm/comp_cache/free.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -r1.28 -r1.29
*** free.c 8 May 2002 20:24:38 -0000 1.28
--- free.c 15 May 2002 18:05:36 -0000 1.29
***************
*** 2,6 ****
* linux/mm/comp_cache/free.c
*
! * Time-stamp: <2002-05-08 16:01:46 rcastro>
*
* Linux Virtual Memory Compressed Cache
--- 2,6 ----
* linux/mm/comp_cache/free.c
*
! * Time-stamp: <2002-05-15 10:05:47 rcastro>
*
* Linux Virtual Memory Compressed Cache
***************
*** 71,75 ****
list_del_init(&fragment->mapping_list);
fragment->mapping->nrpages--;
! atomic_dec(&page_cache_size);
comp_cache_free_space += fragment->compressed_size;
}
--- 71,76 ----
list_del_init(&fragment->mapping_list);
fragment->mapping->nrpages--;
! if (PageSwapCache(fragment))
! num_swapper_fragments--;
comp_cache_free_space += fragment->compressed_size;
}
Index: main.c
===================================================================
RCS file: /cvsroot/linuxcompressed/linux/mm/comp_cache/main.c,v
retrieving revision 1.35
retrieving revision 1.36
diff -C2 -r1.35 -r1.36
*** main.c 8 May 2002 20:24:39 -0000 1.35
--- main.c 15 May 2002 18:05:36 -0000 1.36
***************
*** 2,6 ****
* linux/mm/comp_cache/main.c
*
! * Time-stamp: <2002-05-08 16:41:47 rcastro>
*
* Linux Virtual Memory Compressed Cache
--- 2,6 ----
* linux/mm/comp_cache/main.c
*
! * Time-stamp: <2002-05-15 10:06:22 rcastro>
*
* Linux Virtual Memory Compressed Cache
***************
*** 20,24 ****
/* compressed cache */
! unsigned long real_num_comp_pages = 0;
unsigned long init_num_comp_pages = 0;
--- 20,26 ----
/* compressed cache */
! unsigned long num_comp_pages = 0;
! unsigned long num_swapper_fragments = 0;
!
unsigned long init_num_comp_pages = 0;
***************
*** 162,166 ****
#endif
init_num_comp_pages = num_physpages * 0.10;
! new_num_comp_pages = min_num_comp_pages = real_num_comp_pages = init_num_comp_pages;
printk("Compressed Cache: starting %s version\n", COMP_CACHE_VERSION);
--- 164,168 ----
#endif
init_num_comp_pages = num_physpages * 0.10;
! 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);
***************
*** 203,211 ****
/* initialize each comp cache entry */
! for (i = 0; i < real_num_comp_pages; i++) {
page = alloc_page(GFP_KERNEL);
init_comp_page(&comp_page, page);
}
! comp_cache_free_space = real_num_comp_pages * PAGE_SIZE;
/* initialize our algorithms statistics array */
--- 205,213 ----
/* initialize each comp cache entry */
! for (i = 0; i < num_comp_pages; i++) {
page = alloc_page(GFP_KERNEL);
init_comp_page(&comp_page, page);
}
! comp_cache_free_space = num_comp_pages * PAGE_SIZE;
/* initialize our algorithms statistics array */
Index: proc.c
===================================================================
RCS file: /cvsroot/linuxcompressed/linux/mm/comp_cache/proc.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** proc.c 28 Apr 2002 20:51:35 -0000 1.7
--- proc.c 15 May 2002 18:05:36 -0000 1.8
***************
*** 2,6 ****
* linux/mm/comp_cache/proc.c
*
! * Time-stamp: <2002-04-18 15:32:34 rcastro>
*
* Linux Virtual Memory Compressed Cache
--- 2,6 ----
* linux/mm/comp_cache/proc.c
*
! * Time-stamp: <2002-05-15 10:40:40 rcastro>
*
* Linux Virtual Memory Compressed Cache
***************
*** 243,246 ****
--- 243,249 ----
total_faultin_pages = stats->faultin_swap + stats->faultin_page;
+ if (!total_comp_pages)
+ return;
+
*length += sprintf(page + *length, "compressed cache - statistics\n");
*length += sprintf(page + *length, "algorithm %s%s\n", algorithm->name, current_msg);
***************
*** 271,277 ****
stats->faultin_swap,
stats->faultin_page);
-
- if (!total_comp_pages)
- return;
mean_size = big_division(stats->comp_size_sum, total_comp_pages);
--- 274,277 ----
Index: swapout.c
===================================================================
RCS file: /cvsroot/linuxcompressed/linux/mm/comp_cache/swapout.c,v
retrieving revision 1.41
retrieving revision 1.42
diff -C2 -r1.41 -r1.42
*** swapout.c 14 May 2002 18:59:28 -0000 1.41
--- swapout.c 15 May 2002 18:05:36 -0000 1.42
***************
*** 2,6 ****
* /mm/comp_cache/swapout.c
*
! * Time-stamp: <2002-05-14 14:46:54 rcastro>
*
* Linux Virtual Memory Compressed Cache
--- 2,6 ----
* /mm/comp_cache/swapout.c
*
! * Time-stamp: <2002-05-15 10:07:24 rcastro>
*
* Linux Virtual Memory Compressed Cache
***************
*** 299,303 ****
BUG();
! maxtry = real_num_comp_pages >> 1;
page_cache_get(page);
--- 299,303 ----
BUG();
! maxtry = num_comp_pages >> 1;
page_cache_get(page);
***************
*** 305,309 ****
while (maxtry--) {
aux_comp_size = compressed_size;
! maxscan = real_num_comp_pages >> 3;
while (maxscan--) {
--- 305,309 ----
while (maxtry--) {
aux_comp_size = compressed_size;
! maxscan = num_comp_pages >> 3;
while (maxscan--) {
***************
*** 469,473 ****
list_add(&fragment->mapping_list, &fragment->mapping->clean_comp_pages);
page->mapping->nrpages++;
! atomic_inc(&page_cache_size);
add_fragment_to_hash_table(fragment);
--- 469,478 ----
list_add(&fragment->mapping_list, &fragment->mapping->clean_comp_pages);
page->mapping->nrpages++;
!
! /* we need to account the number of fragments that are from
! * swapper_space to correctly count the cached, swapcached
! * memory in /proc/meminfo */
! if (PageSwapCache(page))
! num_swapper_fragments++;
add_fragment_to_hash_table(fragment);
Index: vswap.c
===================================================================
RCS file: /cvsroot/linuxcompressed/linux/mm/comp_cache/vswap.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -r1.29 -r1.30
*** vswap.c 26 Mar 2002 12:35:10 -0000 1.29
--- vswap.c 15 May 2002 18:05:36 -0000 1.30
***************
*** 2,6 ****
* linux/mm/comp_cache/vswap.c
*
! * Time-stamp: <2002-03-26 09:22:24 rcastro>
*
* Linux Virtual Memory Compressed Cache
--- 2,6 ----
* linux/mm/comp_cache/vswap.c
*
! * Time-stamp: <2002-05-15 09:36:47 rcastro>
*
* Linux Virtual Memory Compressed Cache
***************
*** 45,48 ****
--- 45,51 ----
unsigned long vswap_num_used_entries;
+ /* number of vswap entries that have swap cache pages */
+ unsigned long vswap_num_swap_cache;
+
/* index to the last used vswap entry - used when shrinking vswap */
unsigned int vswap_last_used;
***************
*** 77,81 ****
* compressed cache, even if we have to move fragments in
* order to make room for any vswap entry */
! if (vswap_num_reserved_entries > real_num_comp_pages)
return 0;
--- 80,84 ----
* compressed cache, even if we have to move fragments in
* order to make room for any vswap entry */
! if (vswap_num_reserved_entries > num_comp_pages)
return 0;
***************
*** 85,89 ****
return 0;
! available_mean_size = (unsigned short) (comp_cache_freeable_space/real_num_comp_pages);
if (available_mean_size > PAGE_SIZE)
--- 88,92 ----
return 0;
! available_mean_size = (unsigned short) (comp_cache_freeable_space/num_comp_pages);
if (available_mean_size > PAGE_SIZE)
***************
*** 587,590 ****
--- 590,594 ----
vswap_address[offset]->swap_cache_page = page;
+ vswap_num_swap_cache++;
}
***************
*** 618,621 ****
--- 622,626 ----
vswap_address[offset]->swap_cache_page = NULL;
+ vswap_num_swap_cache--;
}
***************
*** 665,673 ****
vswap_last_used = NUM_VSWAP_ENTRIES - 1;
vswap_num_used_entries = 0;
for (i = 0; i < NUM_VSWAP_ENTRIES; i++)
vswap_alloc_and_init(vswap_address, i);
! comp_cache_freeable_space = PAGE_SIZE * real_num_comp_pages;
last_page_size = (unsigned short *) vmalloc(NUM_MEAN_PAGES * sizeof(unsigned short));
--- 670,679 ----
vswap_last_used = NUM_VSWAP_ENTRIES - 1;
vswap_num_used_entries = 0;
+ vswap_num_swap_cache = 0;
for (i = 0; i < NUM_VSWAP_ENTRIES; i++)
vswap_alloc_and_init(vswap_address, i);
! comp_cache_freeable_space = PAGE_SIZE * num_comp_pages;
last_page_size = (unsigned short *) vmalloc(NUM_MEAN_PAGES * sizeof(unsigned short));
|