[lc-checkins] CVS: linux/mm/comp_cache adaptivity.c,1.34,1.35 aux.c,1.36,1.37 free.c,1.34,1.35 main.
Status: Beta
Brought to you by:
nitin_sf
From: Rodrigo S. de C. <rc...@us...> - 2002-07-15 20:52:27
|
Update of /cvsroot/linuxcompressed/linux/mm/comp_cache In directory usw-pr-cvs1:/tmp/cvs-serv1029/mm/comp_cache Modified Files: adaptivity.c aux.c free.c main.c proc.c swapin.c swapout.c vswap.c Log Message: Feature o Added feature to enable 8K pages (on i386). This option can only be selected if "Resize Compressed Cache On Demand" is enabled since it does not support pages with buffers. The motive to implement this idea is to make better use of the space reserved for compressed cache, since depending on the compression ratio, several fragments end up stored alone in a page. Index: adaptivity.c =================================================================== RCS file: /cvsroot/linuxcompressed/linux/mm/comp_cache/adaptivity.c,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -r1.34 -r1.35 *** adaptivity.c 11 Jul 2002 19:08:11 -0000 1.34 --- adaptivity.c 15 Jul 2002 20:52:23 -0000 1.35 *************** *** 2,6 **** * linux/mm/comp_cache/adaptivity.c * ! * Time-stamp: <2002-07-09 16:33:37 rcastro> * * Linux Virtual Memory Compressed Cache --- 2,6 ---- * linux/mm/comp_cache/adaptivity.c * ! * Time-stamp: <2002-07-15 14:42:43 rcastro> * * Linux Virtual Memory Compressed Cache *************** *** 30,34 **** unsigned int i, new_fragment_hash_bits, new_fragment_hash_order, hash_index; ! new_fragment_hash_size = 3 * num_comp_pages * sizeof(struct comp_cache_fragment *); new_fragment_hash = create_fragment_hash(&new_fragment_hash_size, &new_fragment_hash_bits, &new_fragment_hash_order); --- 30,34 ---- unsigned int i, new_fragment_hash_bits, new_fragment_hash_order, hash_index; ! new_fragment_hash_size = NUM_FRAG_HASH_ENTRIES * sizeof(struct comp_cache_fragment *); new_fragment_hash = create_fragment_hash(&new_fragment_hash_size, &new_fragment_hash_bits, &new_fragment_hash_order); *************** *** 40,44 **** /* 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; --- 40,44 ---- /* if we are growing the hash, but couldn't allocate a bigger * chunk, let's back out and keep the current one */ ! if (NUM_FRAG_HASH_ENTRIES > fragment_hash_size && new_fragment_hash_order <= fragment_hash_order) goto free_new_hash; *************** *** 451,455 **** static inline void shrink_fragment_hash_table(void) { ! unsigned long new_fragment_hash_size = (3 * num_comp_pages) * sizeof(struct comp_cache_fragment *); /* if we shrink the hash table an order, will the data fit in --- 451,455 ---- static inline void shrink_fragment_hash_table(void) { ! unsigned long new_fragment_hash_size = NUM_FRAG_HASH_ENTRIES * sizeof(struct comp_cache_fragment *); /* if we shrink the hash table an order, will the data fit in *************** *** 528,532 **** BUG(); UnlockPage(empty_comp_page->page); ! page_cache_release(empty_comp_page->page); set_comp_page(empty_comp_page, NULL); --- 528,532 ---- BUG(); UnlockPage(empty_comp_page->page); ! __free_pages(empty_comp_page->page, comp_page_order); set_comp_page(empty_comp_page, NULL); *************** *** 604,608 **** static inline void grow_fragment_hash_table(void) { ! unsigned long new_fragment_hash_size = (3 * num_comp_pages) * sizeof(struct comp_cache_fragment *); /* do we really need a bigger hash table? */ --- 604,608 ---- static inline void grow_fragment_hash_table(void) { ! unsigned long new_fragment_hash_size = NUM_FRAG_HASH_ENTRIES * sizeof(struct comp_cache_fragment *); /* do we really need a bigger hash table? */ *************** *** 629,633 **** while (comp_cache_needs_to_grow() && nrpages--) { ! page = alloc_page(GFP_ATOMIC); /* couldn't allocate the page */ --- 629,633 ---- while (comp_cache_needs_to_grow() && nrpages--) { ! page = alloc_pages(GFP_ATOMIC, comp_page_order); /* couldn't allocate the page */ *************** *** 636,645 **** if (!init_comp_page(&comp_page, page)) { ! page_cache_release(page); return 0; } ! comp_cache_freeable_space += PAGE_SIZE; ! comp_cache_free_space += PAGE_SIZE; num_comp_pages++; #if 0 --- 636,645 ---- if (!init_comp_page(&comp_page, page)) { ! __free_pages(page, comp_page_order); return 0; } ! comp_cache_freeable_space += COMP_PAGE_SIZE; ! comp_cache_free_space += COMP_PAGE_SIZE; num_comp_pages++; #if 0 Index: aux.c =================================================================== RCS file: /cvsroot/linuxcompressed/linux/mm/comp_cache/aux.c,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -r1.36 -r1.37 *** aux.c 11 Jul 2002 19:08:11 -0000 1.36 --- aux.c 15 Jul 2002 20:52:23 -0000 1.37 *************** *** 2,6 **** * linux/mm/comp_cache/aux.c * ! * Time-stamp: <2002-07-11 15:45:38 rcastro> * * Linux Virtual Memory Compressed Cache --- 2,6 ---- * linux/mm/comp_cache/aux.c * ! * Time-stamp: <2002-07-15 15:14:01 rcastro> * * Linux Virtual Memory Compressed Cache *************** *** 80,85 **** if (page) goto out; ! comp_cache_freeable_space -= PAGE_SIZE; ! comp_cache_free_space -= PAGE_SIZE; goto out; } --- 80,85 ---- if (page) goto out; ! comp_cache_freeable_space -= COMP_PAGE_SIZE; ! comp_cache_free_space -= COMP_PAGE_SIZE; goto out; } *************** *** 88,93 **** BUG(); ! comp_cache_freeable_space += PAGE_SIZE; ! comp_cache_free_space += PAGE_SIZE; out: --- 88,93 ---- BUG(); ! comp_cache_freeable_space += COMP_PAGE_SIZE; ! comp_cache_free_space += COMP_PAGE_SIZE; out: *************** *** 226,230 **** if (index != free_space_hash_size - 1) BUG(); ! if (comp_page->free_space != PAGE_SIZE) BUG(); } --- 226,230 ---- if (index != free_space_hash_size - 1) BUG(); ! if (comp_page->free_space != COMP_PAGE_SIZE) BUG(); } *************** *** 235,249 **** case 0: if (!comp_page->page) ! num_fragments[6]++; num_fragments[0]++; break; case 1: if (comp_page->page && PageMappedCompCache(comp_page->page)) ! num_fragments[5]++; num_fragments[1]++; break; default: ! if (total_fragments > 3) ! num_fragments[4]++; else num_fragments[total_fragments]++; --- 235,249 ---- case 0: if (!comp_page->page) ! num_fragments[7]++; num_fragments[0]++; break; case 1: if (comp_page->page && PageMappedCompCache(comp_page->page)) ! num_fragments[6]++; num_fragments[1]++; break; default: ! if (total_fragments > 4) ! num_fragments[5]++; else num_fragments[total_fragments]++; *************** *** 256,260 **** unsigned long ! fragmentation_count(int index, unsigned long * frag_space) { struct comp_cache_page * comp_page; struct comp_cache_fragment * fragment; --- 256,260 ---- unsigned long ! fragmentation_count(int index, unsigned long * frag_space, int interval) { struct comp_cache_page * comp_page; struct comp_cache_fragment * fragment; *************** *** 281,285 **** BUG(); ! frag_space[(int) fragmented_space/500]++; } --- 281,285 ---- BUG(); ! frag_space[(int) fragmented_space/interval]++; } *************** *** 518,522 **** } ! if (comp_page->free_space != PAGE_SIZE - used_space) BUG(); --- 518,522 ---- } ! if (comp_page->free_space != COMP_PAGE_SIZE - used_space) BUG(); *************** *** 577,581 **** /* fragment hash table (code heavily based on * page_cache_init():filemap.c */ ! fragment_hash_size = 3 * num_comp_pages * sizeof(struct comp_cache_fragment *); fragment_hash_used = 0; fragment_hash = create_fragment_hash(&fragment_hash_size, &fragment_hash_bits, &fragment_hash_order); --- 577,581 ---- /* fragment hash table (code heavily based on * page_cache_init():filemap.c */ ! fragment_hash_size = NUM_FRAG_HASH_ENTRIES * sizeof(struct comp_cache_fragment *); fragment_hash_used = 0; fragment_hash = create_fragment_hash(&fragment_hash_size, &fragment_hash_bits, &fragment_hash_order); *************** *** 588,593 **** /* inits comp cache free space hash table */ ! free_space_interval = 100 * ((float) PAGE_SIZE)/4096; ! free_space_hash_size = (int) (PAGE_SIZE/free_space_interval) + 2; free_space_hash = (struct comp_cache_page **) kmalloc(free_space_hash_size * sizeof(struct comp_cache_page *), GFP_ATOMIC); --- 588,593 ---- /* inits comp cache free space hash table */ ! free_space_interval = 100 * (comp_page_order + 1); ! free_space_hash_size = (int) (PAGE_SIZE/100) + 2; free_space_hash = (struct comp_cache_page **) kmalloc(free_space_hash_size * sizeof(struct comp_cache_page *), GFP_ATOMIC); *************** *** 601,606 **** /* inits comp cache total free space hash table */ ! total_free_space_interval = 100 * ((float) PAGE_SIZE)/4096; ! total_free_space_hash_size = (int) (PAGE_SIZE/free_space_interval) + 2; total_free_space_hash = (struct comp_cache_page **) kmalloc(total_free_space_hash_size * sizeof(struct comp_cache_page *), GFP_ATOMIC); --- 601,606 ---- /* inits comp cache total free space hash table */ ! total_free_space_interval = 100 * (comp_page_order + 1); ! total_free_space_hash_size = (int) (PAGE_SIZE/100) + 2; total_free_space_hash = (struct comp_cache_page **) kmalloc(total_free_space_hash_size * sizeof(struct comp_cache_page *), GFP_ATOMIC); Index: free.c =================================================================== RCS file: /cvsroot/linuxcompressed/linux/mm/comp_cache/free.c,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -r1.34 -r1.35 *** free.c 11 Jul 2002 19:08:11 -0000 1.34 --- free.c 15 Jul 2002 20:52:23 -0000 1.35 *************** *** 2,6 **** * linux/mm/comp_cache/free.c * ! * Time-stamp: <2002-07-09 16:34:26 rcastro> * * Linux Virtual Memory Compressed Cache --- 2,6 ---- * linux/mm/comp_cache/free.c * ! * Time-stamp: <2002-07-15 14:56:06 rcastro> * * Linux Virtual Memory Compressed Cache *************** *** 89,93 **** struct comp_cache_fragment * fragment, * min_fragment = NULL; struct list_head * fragment_lh, * tmp_lh, aux_fragment_list; ! int min_offset = PAGE_SIZE + 1, num_fragments = 0, next_offset = 0; INIT_LIST_HEAD(&aux_fragment_list); --- 89,93 ---- struct comp_cache_fragment * fragment, * min_fragment = NULL; struct list_head * fragment_lh, * tmp_lh, aux_fragment_list; ! int min_offset = COMP_PAGE_SIZE + 1, num_fragments = 0, next_offset = 0; INIT_LIST_HEAD(&aux_fragment_list); *************** *** 121,125 **** min_fragment->offset = next_offset; ! min_offset = PAGE_SIZE + 1; next_offset += min_fragment->compressed_size; --- 121,125 ---- min_fragment->offset = next_offset; ! min_offset = COMP_PAGE_SIZE + 1; next_offset += min_fragment->compressed_size; *************** *** 152,157 **** if (!comp_page) BUG(); - if (not_compressed(fragment) && comp_page->free_space) - BUG(); /* remove from the free space hash table to update it */ --- 152,155 ---- *************** *** 170,174 **** /* simple case - no free space * 1 - one not compressed page ! * 2 - sum of all fragments = PAGE_SIZE */ if (!comp_page->free_space) { remove_fragment_from_comp_cache(fragment); --- 168,172 ---- /* simple case - no free space * 1 - one not compressed page ! * 2 - sum of all fragments = COMP_PAGE_SIZE */ if (!comp_page->free_space) { remove_fragment_from_comp_cache(fragment); Index: main.c =================================================================== RCS file: /cvsroot/linuxcompressed/linux/mm/comp_cache/main.c,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -r1.53 -r1.54 *** main.c 15 Jul 2002 11:24:27 -0000 1.53 --- main.c 15 Jul 2002 20:52:24 -0000 1.54 *************** *** 2,6 **** * linux/mm/comp_cache/main.c * ! * Time-stamp: <2002-07-15 08:20:26 rcastro> * * Linux Virtual Memory Compressed Cache --- 2,6 ---- * linux/mm/comp_cache/main.c * ! * Time-stamp: <2002-07-15 13:45:54 rcastro> * * Linux Virtual Memory Compressed Cache *************** *** 39,42 **** --- 39,48 ---- kmem_cache_t * fragment_cachep; + #ifdef CONFIG_COMP_DOUBLE_PAGE + int comp_page_order = 1; + #else + int comp_page_order = 0; + #endif + extern unsigned long num_physpages; *************** *** 131,135 **** return 0; ! if (fragment->offset + fragment->compressed_size > PAGE_SIZE) BUG(); --- 137,141 ---- return 0; ! if (fragment->offset + fragment->compressed_size > COMP_PAGE_SIZE) BUG(); *************** *** 157,161 **** memcpy(page_address(comp_page->page) + fragment->offset, buffer_compressed , fragment->compressed_size); } else ! memcpy(page_address(comp_page->page), page_address(page), PAGE_SIZE); if (PageTestandSetCompCache(page)) --- 163,167 ---- memcpy(page_address(comp_page->page) + fragment->offset, buffer_compressed , fragment->compressed_size); } else ! memcpy(page_address(comp_page->page) + fragment->offset, page_address(page), PAGE_SIZE); if (PageTestandSetCompCache(page)) *************** *** 300,305 **** return 0; ! (*comp_page)->free_space = PAGE_SIZE; ! (*comp_page)->total_free_space = PAGE_SIZE; (*comp_page)->free_offset = 0; (*comp_page)->page = page; --- 306,310 ---- return 0; ! (*comp_page)->free_space = (*comp_page)->total_free_space = (comp_page_order + 1) * PAGE_SIZE; (*comp_page)->free_offset = 0; (*comp_page)->page = page; *************** *** 319,329 **** #ifdef CONFIG_COMP_DEMAND_RESIZE ! min_num_comp_pages = 48; #else ! min_num_comp_pages = num_physpages * 0.05; #endif if (!max_num_comp_pages || max_num_comp_pages < min_num_comp_pages || max_num_comp_pages > num_physpages * 0.5) ! max_num_comp_pages = num_physpages * 0.5; if (!init_num_comp_pages || init_num_comp_pages < min_num_comp_pages || init_num_comp_pages > max_num_comp_pages) --- 324,334 ---- #ifdef CONFIG_COMP_DEMAND_RESIZE ! min_num_comp_pages = page_to_comp_page(48); #else ! min_num_comp_pages = page_to_comp_page((unsigned long) (num_physpages * 0.05)); #endif if (!max_num_comp_pages || max_num_comp_pages < min_num_comp_pages || max_num_comp_pages > num_physpages * 0.5) ! max_num_comp_pages = page_to_comp_page((unsigned long) (num_physpages * 0.5)); if (!init_num_comp_pages || init_num_comp_pages < min_num_comp_pages || init_num_comp_pages > max_num_comp_pages) *************** *** 336,345 **** "Compressed Cache: maximum size\n" "Compressed Cache: %lu pages = %luKiB\n", ! init_num_comp_pages, (init_num_comp_pages * PAGE_SIZE)/1024, ! max_num_comp_pages, (max_num_comp_pages * PAGE_SIZE)/1024); /* fiz zone watermarks */ comp_cache_init_fix_watermarks(init_num_comp_pages); ! /* create slab caches */ comp_cachep = kmem_cache_create("comp_cache_struct", sizeof(struct comp_cache_page), 0, SLAB_HWCACHE_ALIGN, NULL, NULL); --- 341,350 ---- "Compressed Cache: maximum size\n" "Compressed Cache: %lu pages = %luKiB\n", ! init_num_comp_pages, (init_num_comp_pages * COMP_PAGE_SIZE)/1024, ! max_num_comp_pages, (max_num_comp_pages * COMP_PAGE_SIZE)/1024); /* fiz zone watermarks */ comp_cache_init_fix_watermarks(init_num_comp_pages); ! /* create slab caches */ comp_cachep = kmem_cache_create("comp_cache_struct", sizeof(struct comp_cache_page), 0, SLAB_HWCACHE_ALIGN, NULL, NULL); *************** *** 355,364 **** /* initialize each comp cache entry */ for (i = 0; i < num_comp_pages; i++) { ! page = alloc_page(GFP_KERNEL); if (!init_comp_page(&comp_page, page)) ! page_cache_release(page); } ! comp_cache_free_space = num_comp_pages * PAGE_SIZE; /* initialize our algorithms statistics array */ --- 360,369 ---- /* initialize each comp cache entry */ for (i = 0; i < num_comp_pages; i++) { ! page = alloc_pages(GFP_KERNEL, comp_page_order); if (!init_comp_page(&comp_page, page)) ! __free_pages(page, comp_page_order); } ! comp_cache_free_space = num_comp_pages * COMP_PAGE_SIZE; /* initialize our algorithms statistics array */ *************** *** 371,380 **** static int __init comp_cache_size(char *str) { char * endp; #ifdef CONFIG_COMP_DEMAND_RESIZE ! max_num_comp_pages = memparse(str, &endp) >> PAGE_SHIFT; #else ! init_num_comp_pages = memparse(str, &endp) >> PAGE_SHIFT; #endif return 1; --- 376,388 ---- static int __init comp_cache_size(char *str) { + unsigned long nr_pages; char * endp; + nr_pages = memparse(str, &endp) >> (PAGE_SHIFT + comp_page_order); + #ifdef CONFIG_COMP_DEMAND_RESIZE ! max_num_comp_pages = nr_pages; #else ! init_num_comp_pages = nr_pages; #endif return 1; Index: proc.c =================================================================== RCS file: /cvsroot/linuxcompressed/linux/mm/comp_cache/proc.c,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -r1.18 -r1.19 *** proc.c 11 Jul 2002 19:08:11 -0000 1.18 --- proc.c 15 Jul 2002 20:52:24 -0000 1.19 *************** *** 2,6 **** * linux/mm/comp_cache/proc.c * ! * Time-stamp: <2002-07-11 16:00:00 rcastro> * * Linux Virtual Memory Compressed Cache --- 2,6 ---- * linux/mm/comp_cache/proc.c * ! * Time-stamp: <2002-07-15 15:13:14 rcastro> * * Linux Virtual Memory Compressed Cache *************** *** 398,403 **** #define HIST_PRINTK \ num_fragments[0], num_fragments[1], num_fragments[2], num_fragments[3], \ ! num_fragments[4], num_fragments[5], num_fragments[6] ! #define HIST_COUNT 7 int --- 398,403 ---- #define HIST_PRINTK \ num_fragments[0], num_fragments[1], num_fragments[2], num_fragments[3], \ ! num_fragments[4], num_fragments[5], num_fragments[6], num_fragments[7] ! #define HIST_COUNT 8 int *************** *** 414,418 **** } ! length = sprintf(page, "compressed cache - free space histogram (free space x number of fragments)\n"); memset((void *) num_fragments, 0, HIST_COUNT * sizeof(unsigned long)); --- 414,420 ---- } ! length = sprintf(page, ! "compressed cache - free space histogram (free space x number of fragments)\n" ! " total 0f 1f 2f 3f 4f more buffers nopg\n"); memset((void *) num_fragments, 0, HIST_COUNT * sizeof(unsigned long)); *************** *** 420,449 **** total1 = free_space_count(0, num_fragments); length += sprintf(page + length, ! " total 0f 1f 2f 3f more buffers nopg\n" ! " %4d: %7lu %5lu %5lu %5lu %5lu %5lu %5lu %5lu\n", 0, total1, HIST_PRINTK); ! for (i = 1; i < free_space_hash_size - 1; i += 2) { memset((void *) num_fragments, 0, HIST_COUNT * sizeof(unsigned long)); total1 = free_space_count(i, num_fragments); ! total2 = free_space_count(i + 1, num_fragments); length += sprintf(page + length, ! "%4d - %4d: %7lu %5lu %5lu %5lu %5lu %5lu %5lu %5lu\n", ! (i+1)*100-200?:1, (i+1)*100, total1 + total2, HIST_PRINTK); } - memset((void *) num_fragments, 0, HIST_COUNT * sizeof(unsigned long)); - - total1 = free_space_count(free_space_hash_size - 1, num_fragments); - length += sprintf(page + length, - "%4d - %4d: %7lu %5lu %5lu %5lu %5lu %5lu %5lu %5lu\n", - (free_space_hash_size - 2) * 100 + 1, (int) PAGE_SIZE, - total1, - HIST_PRINTK); - vfree(num_fragments); out: --- 422,443 ---- total1 = free_space_count(0, num_fragments); length += sprintf(page + length, ! " %4d: %7lu %5lu %5lu %5lu %5lu %5lu %5lu %5lu %5lu\n", 0, total1, HIST_PRINTK); ! for (i = 1; i < free_space_hash_size; i += 2) { memset((void *) num_fragments, 0, HIST_COUNT * sizeof(unsigned long)); total1 = free_space_count(i, num_fragments); ! total2 = 0; ! if (i + 1 < free_space_hash_size) ! total2 = free_space_count(i + 1, num_fragments); length += sprintf(page + length, ! "%4d - %4d: %7lu %5lu %5lu %5lu %5lu %5lu %5lu %5lu %5lu\n", ! (i-1)*free_space_interval+1, (i+1)*free_space_interval<COMP_PAGE_SIZE?(i+1)*free_space_interval:(int)COMP_PAGE_SIZE, total1 + total2, HIST_PRINTK); } vfree(num_fragments); out: *************** *** 451,455 **** } ! #define FRAG_INTERVAL 500 #define FRAG_PRINTK \ frag_space[0], frag_space[1], frag_space[2], frag_space[3], \ --- 445,449 ---- } ! #define FRAG_INTERVAL (500 * (comp_page_order + 1)) #define FRAG_PRINTK \ frag_space[0], frag_space[1], frag_space[2], frag_space[3], \ *************** *** 463,467 **** int length = 0, i; ! frag_space = (unsigned long *) vmalloc((PAGE_SIZE/FRAG_INTERVAL + 1) * sizeof(unsigned long)); if (!frag_space) { --- 457,461 ---- int length = 0, i; ! frag_space = (unsigned long *) vmalloc((COMP_PAGE_SIZE/FRAG_INTERVAL + 1) * sizeof(unsigned long)); if (!frag_space) { *************** *** 472,497 **** length = sprintf(page, "compressed cache - fragmentation histogram (free space x fragmented space)\n" ! " total <500 -1000 -1500 -2000 -2500 -3000 -3500 -4000 -4096\n"); ! ! for (i = 1; i < free_space_hash_size - 1; i += 2) { ! memset((void *) frag_space, 0, (PAGE_SIZE/FRAG_INTERVAL + 1) * sizeof(unsigned long)); ! total1 = fragmentation_count(i, frag_space); ! total2 = fragmentation_count(i + 1, frag_space); length += sprintf(page + length, "%4d - %4d: %5lu %5lu %5lu %5lu %5lu %5lu %5lu %5lu %5lu %5lu\n", ! (i+1)*100-200?:1, (i+1)*100, total1 + total2, FRAG_PRINTK); } - memset((void *) frag_space, 0, (PAGE_SIZE/FRAG_INTERVAL + 1)* sizeof(unsigned long)); - - total1 = free_space_count(free_space_hash_size - 1, frag_space); - length += sprintf(page + length, - "%4d - %4d: %5lu %5lu %5lu %5lu %5lu %5lu %5lu %5lu %5lu %5lu\n", - (free_space_hash_size - 2) * 100 + 1, (int) PAGE_SIZE, - total1, - FRAG_PRINTK); - vfree(frag_space); out: --- 466,487 ---- length = sprintf(page, "compressed cache - fragmentation histogram (free space x fragmented space)\n" ! " total <%4d", FRAG_INTERVAL); ! for (i = FRAG_INTERVAL * 2; i < COMP_PAGE_SIZE; i += FRAG_INTERVAL) ! length += sprintf(page + length, " -%d", i); ! length += sprintf(page + length, " -%d\n", (int)COMP_PAGE_SIZE); ! ! for (i = 1; i < free_space_hash_size; i += 2) { ! memset((void *) frag_space, 0, (COMP_PAGE_SIZE/FRAG_INTERVAL + 1) * sizeof(unsigned long)); ! total1 = fragmentation_count(i, frag_space, FRAG_INTERVAL); ! total2 = 0; ! if (i + 1 < free_space_hash_size) ! total2 = fragmentation_count(i + 1, frag_space, FRAG_INTERVAL); length += sprintf(page + length, "%4d - %4d: %5lu %5lu %5lu %5lu %5lu %5lu %5lu %5lu %5lu %5lu\n", ! (i-1)*free_space_interval+1, (i+1)*free_space_interval<COMP_PAGE_SIZE?(i+1)*free_space_interval:(int)COMP_PAGE_SIZE, total1 + total2, FRAG_PRINTK); } vfree(frag_space); out: Index: swapin.c =================================================================== RCS file: /cvsroot/linuxcompressed/linux/mm/comp_cache/swapin.c,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -r1.43 -r1.44 *** swapin.c 1 Jul 2002 17:37:30 -0000 1.43 --- swapin.c 15 Jul 2002 20:52:24 -0000 1.44 *************** *** 2,6 **** * linux/mm/comp_cache/swapin.c * ! * Time-stamp: <2002-07-01 11:28:19 rcastro> * * Linux Virtual Memory Compressed Cache --- 2,6 ---- * linux/mm/comp_cache/swapin.c * ! * Time-stamp: <2002-07-15 14:35:45 rcastro> * * Linux Virtual Memory Compressed Cache *************** *** 80,84 **** decompress(fragment, page); else ! memcpy(page_address(page), page_address(comp_page->page), PAGE_SIZE); PageSetCompCache(page); --- 80,84 ---- decompress(fragment, page); else ! memcpy(page_address(page), page_address(comp_page->page) + fragment->offset, PAGE_SIZE); PageSetCompCache(page); *************** *** 230,237 **** PageClearCompCache(page); __set_page_dirty(page); - page_cache_release(page); - UnlockPage(page); - return; out_release: --- 230,234 ---- Index: swapout.c =================================================================== RCS file: /cvsroot/linuxcompressed/linux/mm/comp_cache/swapout.c,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -r1.58 -r1.59 *** swapout.c 11 Jul 2002 19:08:11 -0000 1.58 --- swapout.c 15 Jul 2002 20:52:24 -0000 1.59 *************** *** 2,6 **** * /mm/comp_cache/swapout.c * ! * Time-stamp: <2002-07-11 15:33:33 rcastro> * * Linux Virtual Memory Compressed Cache --- 2,6 ---- * /mm/comp_cache/swapout.c * ! * Time-stamp: <2002-07-15 10:06:15 rcastro> * * Linux Virtual Memory Compressed Cache *************** *** 420,424 **** if (!comp_page->page) { ! if (comp_page->free_space != PAGE_SIZE) BUG(); if (alloc) --- 420,424 ---- if (!comp_page->page) { ! if (comp_page->free_space != COMP_PAGE_SIZE) BUG(); if (alloc) Index: vswap.c =================================================================== RCS file: /cvsroot/linuxcompressed/linux/mm/comp_cache/vswap.c,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -r1.38 -r1.39 *** vswap.c 25 Jun 2002 14:34:08 -0000 1.38 --- vswap.c 15 Jul 2002 20:52:24 -0000 1.39 *************** *** 2,6 **** * linux/mm/comp_cache/vswap.c * ! * Time-stamp: <2002-06-24 18:24:11 rcastro> * * Linux Virtual Memory Compressed Cache --- 2,6 ---- * linux/mm/comp_cache/vswap.c * ! * Time-stamp: <2002-07-15 14:24:03 rcastro> * * Linux Virtual Memory Compressed Cache *************** *** 79,84 **** vswap = vswap_address[offset]; ! if (vswap->swap_cache_page) ! BUG(); vswap->swap_cache_page = VSWAP_ALLOCATING; --- 79,84 ---- vswap = vswap_address[offset]; ! //if (vswap->swap_cache_page) ! //BUG(); vswap->swap_cache_page = VSWAP_ALLOCATING; *************** *** 101,105 **** if (vswap->swap_cache_page != VSWAP_ALLOCATING) ! BUG(); vswap->swap_cache_page = NULL; --- 101,106 ---- if (vswap->swap_cache_page != VSWAP_ALLOCATING) ! //BUG(); ! return; vswap->swap_cache_page = NULL; *************** *** 143,147 **** mean_size = total/NUM_MEAN_PAGES; ! if (mean_size < 0 || mean_size > PAGE_SIZE) BUG(); --- 144,148 ---- mean_size = total/NUM_MEAN_PAGES; ! if (mean_size < 0 || mean_size > COMP_PAGE_SIZE) BUG(); *************** *** 161,165 **** * 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; --- 162,166 ---- * compressed cache, even if we have to move fragments in * order to make room for any vswap entry */ ! if (vswap_num_reserved_entries > comp_page_to_page(num_comp_pages)) return 0; *************** *** 190,194 **** available_mean_size = (unsigned short) (comp_cache_freeable_space/num_comp_pages); ! if (available_mean_size > PAGE_SIZE) BUG(); --- 191,195 ---- available_mean_size = (unsigned short) (comp_cache_freeable_space/num_comp_pages); ! if (available_mean_size > COMP_PAGE_SIZE) BUG(); *************** *** 237,241 **** entry.val = 0; ! if (!vswap_address && !comp_cache_vswap_alloc()) return entry; --- 238,242 ---- entry.val = 0; ! if (!vswap_address && !comp_cache_vswap_alloc()) return entry; *************** *** 779,788 **** INIT_LIST_HEAD(&(vswap_address_used_head)); ! comp_cache_freeable_space = PAGE_SIZE * num_comp_pages; last_page_size = (unsigned short *) vmalloc(NUM_MEAN_PAGES * sizeof(unsigned short)); for (i = 0; i < NUM_MEAN_PAGES; i++) ! last_page_size[i] = PAGE_SIZE/2; /* alloc only one page right now to avoid problems when --- 780,789 ---- INIT_LIST_HEAD(&(vswap_address_used_head)); ! comp_cache_freeable_space = COMP_PAGE_SIZE * num_comp_pages; last_page_size = (unsigned short *) vmalloc(NUM_MEAN_PAGES * sizeof(unsigned short)); for (i = 0; i < NUM_MEAN_PAGES; i++) ! last_page_size[i] = COMP_PAGE_SIZE/2; /* alloc only one page right now to avoid problems when |