[lc-checkins] CVS: linux/mm/comp_cache adaptivity.c,1.18,1.19 main.c,1.40,1.41 swapin.c,1.35,1.36 sw
Status: Beta
Brought to you by:
nitin_sf
|
From: Rodrigo S. de C. <rc...@us...> - 2002-05-28 19:16:19
|
Update of /cvsroot/linuxcompressed/linux/mm/comp_cache In directory usw-pr-cvs1:/tmp/cvs-serv8044/mm/comp_cache Modified Files: adaptivity.c main.c swapin.c swapout.c Log Message: - Fixed a bug that caused FS corruption (hit under UML). Details: http://sourceforge.net/tracker/index.php?func=detail&aid=561171&group_id=13472&atid=113472 - Resizing compressed cache size now fix normal Zone Watermarks too Index: adaptivity.c =================================================================== RCS file: /cvsroot/linuxcompressed/linux/mm/comp_cache/adaptivity.c,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -r1.18 -r1.19 *** adaptivity.c 15 May 2002 18:05:36 -0000 1.18 --- adaptivity.c 28 May 2002 19:16:15 -0000 1.19 *************** *** 2,6 **** * linux/mm/comp_cache/adaptivity.c * ! * Time-stamp: <2002-05-15 10:31:44 rcastro> * * Linux Virtual Memory Compressed Cache --- 2,6 ---- * linux/mm/comp_cache/adaptivity.c * ! * Time-stamp: <2002-05-28 15:44:25 rcastro> * * Linux Virtual Memory Compressed Cache *************** *** 473,477 **** vswap_address = new_vswap_address; ! //printk("VSWAP - resized from %ld to %ld\n", vswap_current_num_entries, vswap_new_num_entries); vswap_current_num_entries = vswap_new_num_entries; vswap_last_used = vswap_new_num_entries - 1; --- 473,479 ---- vswap_address = new_vswap_address; ! #if 0 ! printk("VSWAP - resized from %ld to %ld\n", vswap_current_num_entries, vswap_new_num_entries); ! #endif vswap_current_num_entries = vswap_new_num_entries; vswap_last_used = vswap_new_num_entries - 1; *************** *** 534,537 **** --- 536,545 ---- } + static inline int + zone_wrong_watermarks_shrink(void) + { + return (zone_num_comp_pages > num_comp_pages); + } + int shrink_comp_cache(comp_cache_t * comp_page) *************** *** 543,547 **** if (!list_empty(&(comp_page->fragments))) { UnlockPage(comp_page->page); ! goto out; } --- 551,555 ---- if (!list_empty(&(comp_page->fragments))) { UnlockPage(comp_page->page); ! goto check_shrink; } *************** *** 549,555 **** if (!comp_cache_needs_to_shrink()) { UnlockPage(comp_page->page); ! return retval; } empty_comp_page = comp_page; retval = 1; --- 557,564 ---- if (!comp_cache_needs_to_shrink()) { UnlockPage(comp_page->page); ! goto out; } + /* we need to shrink and have a empty page, so let's do it */ empty_comp_page = comp_page; retval = 1; *************** *** 565,574 **** comp_cache_free_space -= PAGE_SIZE; num_comp_pages--; ! //printk("shrink new %lu real %lu\n", new_num_comp_pages, num_comp_pages); ! ! out: ! if (comp_cache_needs_to_shrink() && !fragment_failed_alloc && !vswap_failed_alloc) ! goto check_empty_pages; if (fragment_hash_needs_to_shrink()) resize_fragment_hash_table(); --- 574,592 ---- comp_cache_free_space -= PAGE_SIZE; num_comp_pages--; ! #if 0 ! printk("shrink new %lu real %lu\n", new_num_comp_pages, num_comp_pages); ! #endif ! ! check_shrink: ! if (comp_cache_needs_to_shrink()) { ! if (!fragment_failed_alloc && !vswap_failed_alloc) ! goto check_empty_pages; ! } ! else { ! if (zone_wrong_watermarks_shrink()) ! comp_cache_fix_watermarks(num_comp_pages); ! } + out: if (fragment_hash_needs_to_shrink()) resize_fragment_hash_table(); *************** *** 621,624 **** --- 639,648 ---- } + static inline int + zone_wrong_watermarks_grow(void) + { + return (zone_num_comp_pages < num_comp_pages); + } + inline void grow_comp_cache(zone_t * zone, int nr_pages) *************** *** 644,652 **** comp_cache_free_space += PAGE_SIZE; num_comp_pages++; ! //printk("grow real %lu\n", num_comp_pages); } ! if (comp_cache_needs_to_grow() && !fragment_failed_alloc && !vswap_failed_alloc) ! return; if (fragment_hash_needs_to_grow()) --- 668,684 ---- comp_cache_free_space += PAGE_SIZE; num_comp_pages++; ! #if 0 ! printk("grow real %lu\n", num_comp_pages); ! #endif } ! if (comp_cache_needs_to_grow()) { ! if (!fragment_failed_alloc && !vswap_failed_alloc) ! return; ! } ! else { ! if (zone_wrong_watermarks_grow()) ! comp_cache_fix_watermarks(num_comp_pages); ! } if (fragment_hash_needs_to_grow()) Index: main.c =================================================================== RCS file: /cvsroot/linuxcompressed/linux/mm/comp_cache/main.c,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -r1.40 -r1.41 *** main.c 24 May 2002 14:41:36 -0000 1.40 --- main.c 28 May 2002 19:16:15 -0000 1.41 *************** *** 2,6 **** * linux/mm/comp_cache/main.c * ! * Time-stamp: <2002-05-24 11:11:39 rcastro> * * Linux Virtual Memory Compressed Cache --- 2,6 ---- * linux/mm/comp_cache/main.c * ! * Time-stamp: <2002-05-28 14:42:21 rcastro> * * Linux Virtual Memory Compressed Cache *************** *** 19,23 **** #include <net/checksum.h> ! /* compressed cache */ unsigned long num_comp_pages = 0; unsigned long num_swapper_fragments = 0; --- 19,23 ---- #include <net/checksum.h> ! /* compressed cache control variables */ unsigned long num_comp_pages = 0; unsigned long num_swapper_fragments = 0; *************** *** 29,32 **** --- 29,36 ---- unsigned long min_num_comp_pages = 0; + /* stores the last number of compressed pages that has been used to + * fix the normal zone watermarks */ + unsigned long zone_num_comp_pages = 0; + unsigned long comp_cache_free_space; *************** *** 67,71 **** return 0; #endif ! page_cache_get(page); spin_unlock(&pagecache_lock); --- 71,75 ---- return 0; #endif ! page_cache_get(page); spin_unlock(&pagecache_lock); *************** *** 151,155 **** } ! extern void comp_cache_fix_watermarks(int num_comp_pages); void __init --- 155,159 ---- } ! extern void __init comp_cache_init_fix_watermarks(int num_comp_pages); void __init *************** *** 197,201 **** /* fiz zone watermarks */ ! comp_cache_fix_watermarks(init_num_comp_pages); /* create slab caches */ --- 201,205 ---- /* fiz zone watermarks */ ! comp_cache_init_fix_watermarks(init_num_comp_pages); /* create slab caches */ Index: swapin.c =================================================================== RCS file: /cvsroot/linuxcompressed/linux/mm/comp_cache/swapin.c,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -r1.35 -r1.36 *** swapin.c 21 May 2002 18:49:06 -0000 1.35 --- swapin.c 28 May 2002 19:16:15 -0000 1.36 *************** *** 2,6 **** * linux/mm/comp_cache/swapin.c * ! * Time-stamp: <2002-05-21 11:27:43 rcastro> * * Linux Virtual Memory Compressed Cache --- 2,6 ---- * linux/mm/comp_cache/swapin.c * ! * Time-stamp: <2002-05-28 14:27:51 rcastro> * * Linux Virtual Memory Compressed Cache *************** *** 85,89 **** PageSetCompCache(page); - SetPageUptodate(page); } --- 85,88 ---- Index: swapout.c =================================================================== RCS file: /cvsroot/linuxcompressed/linux/mm/comp_cache/swapout.c,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -r1.45 -r1.46 *** swapout.c 24 May 2002 14:41:38 -0000 1.45 --- swapout.c 28 May 2002 19:16:15 -0000 1.46 *************** *** 2,6 **** * /mm/comp_cache/swapout.c * ! * Time-stamp: <2002-05-24 10:32:39 rcastro> * * Linux Virtual Memory Compressed Cache --- 2,6 ---- * /mm/comp_cache/swapout.c * ! * Time-stamp: <2002-05-28 14:51:56 rcastro> * * Linux Virtual Memory Compressed Cache |