[lc-checkins] CVS: linux/mm/comp_cache main.c,1.61,1.62 proc.c,1.22,1.23 swapin.c,1.50,1.51 swapout.
Status: Beta
Brought to you by:
nitin_sf
From: Rodrigo S. de C. <rc...@us...> - 2002-08-01 14:52:29
|
Update of /cvsroot/linuxcompressed/linux/mm/comp_cache In directory usw-pr-cvs1:/tmp/cvs-serv6713/mm/comp_cache Modified Files: main.c proc.c swapin.c swapout.c Log Message: Bug fixes o We were only accounting writeout statistics if the writepage() returned one, but returning zero doesn't mean it has not been written tough (swap_writepage() always returns zero). So, it ended up that we didn't account any writeout page because most writepage() functions return zero. Now we account every written page, no matter the return value. o Fixed CompCache bit assignment, so now we don't have to search compressed cache for every page that gets compressed. Given that, a PageCompCache(page) does not mean it has a fragment in compressed cache, but a !PageCompCache(page) surely doesn't have a fragment. That improves performance. Cleanups o Don't printk initial compressed cache size, only the maximum size o comp_data defined as static in proc.c Index: main.c =================================================================== RCS file: /cvsroot/linuxcompressed/linux/mm/comp_cache/main.c,v retrieving revision 1.61 retrieving revision 1.62 diff -C2 -r1.61 -r1.62 *** main.c 31 Jul 2002 12:31:05 -0000 1.61 --- main.c 1 Aug 2002 14:52:25 -0000 1.62 *************** *** 2,6 **** * linux/mm/comp_cache/main.c * ! * Time-stamp: <2002-07-29 09:31:05 rcastro> * * Linux Virtual Memory Compressed Cache --- 2,6 ---- * linux/mm/comp_cache/main.c * ! * Time-stamp: <2002-08-01 10:19:51 rcastro> * * Linux Virtual Memory Compressed Cache *************** *** 68,75 **** if (!PageLocked(page)) BUG(); ! if (!find_comp_page(page->mapping, page->index, &fragment)) { ! if (!CompFragmentToBeFreed(fragment)) ! BUG(); ! return 0; } --- 68,78 ---- if (!PageLocked(page)) BUG(); ! if (PageCompCache(page)) { ! if (!find_comp_page(page->mapping, page->index, &fragment)) { ! if (!CompFragmentToBeFreed(fragment)) ! BUG(); ! return 0; ! } ! PageClearCompCache(page); } *************** *** 218,226 **** printk("Compressed Cache: %s\n", COMP_CACHE_VERSION); ! printk("Compressed Cache: initial size\n" ! "Compressed Cache: %lu pages = %luKiB\n" ! "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); --- 221,226 ---- printk("Compressed Cache: %s\n", COMP_CACHE_VERSION); ! printk("Compressed Cache: maximum size\n" "Compressed Cache: %lu pages = %luKiB\n", max_num_comp_pages, (max_num_comp_pages * COMP_PAGE_SIZE)/1024); Index: proc.c =================================================================== RCS file: /cvsroot/linuxcompressed/linux/mm/comp_cache/proc.c,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -r1.22 -r1.23 *** proc.c 28 Jul 2002 15:47:04 -0000 1.22 --- proc.c 1 Aug 2002 14:52:25 -0000 1.23 *************** *** 2,6 **** * linux/mm/comp_cache/proc.c * ! * Time-stamp: <2002-07-28 12:01:51 rcastro> * * Linux Virtual Memory Compressed Cache --- 2,6 ---- * linux/mm/comp_cache/proc.c * ! * Time-stamp: <2002-08-01 09:03:16 rcastro> * * Linux Virtual Memory Compressed Cache *************** *** 32,36 **** static int current_algorithm = 0; ! struct comp_alg_data comp_data; static spinlock_t comp_data_lock __cacheline_aligned = SPIN_LOCK_UNLOCKED; --- 32,36 ---- static int current_algorithm = 0; ! static struct comp_alg_data comp_data; static spinlock_t comp_data_lock __cacheline_aligned = SPIN_LOCK_UNLOCKED; Index: swapin.c =================================================================== RCS file: /cvsroot/linuxcompressed/linux/mm/comp_cache/swapin.c,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -r1.50 -r1.51 *** swapin.c 31 Jul 2002 12:31:05 -0000 1.50 --- swapin.c 1 Aug 2002 14:52:25 -0000 1.51 *************** *** 2,6 **** * linux/mm/comp_cache/swapin.c * ! * Time-stamp: <2002-07-30 12:21:21 rcastro> * * Linux Virtual Memory Compressed Cache --- 2,6 ---- * linux/mm/comp_cache/swapin.c * ! * Time-stamp: <2002-08-01 10:06:03 rcastro> * * Linux Virtual Memory Compressed Cache *************** *** 42,46 **** spin_lock(&comp_cache_lock); ! if (likely(!PageTestandClearCompCache(page))) goto out_unlock; --- 42,46 ---- spin_lock(&comp_cache_lock); ! if (likely(!PageCompCache(page))) goto out_unlock; *************** *** 49,55 **** * cache entry, what may happen in do_swap_page() */ err = find_comp_page(page->mapping?:&swapper_space, page->index, &fragment); ! ! if (err) goto out_unlock; if (CompFragmentTestandClearDirty(fragment)) { --- 49,56 ---- * cache entry, what may happen in do_swap_page() */ err = find_comp_page(page->mapping?:&swapper_space, page->index, &fragment); ! if (err) { ! PageClearCompCache(page); goto out_unlock; + } if (CompFragmentTestandClearDirty(fragment)) { *************** *** 61,66 **** __set_page_dirty(page); } ! drop_fragment(fragment); ! out_unlock: spin_unlock(&comp_cache_lock); --- 62,68 ---- __set_page_dirty(page); } ! ! if (drop_fragment(fragment)) ! PageClearCompCache(page); out_unlock: spin_unlock(&comp_cache_lock); *************** *** 134,138 **** put_fragment(fragment); ! drop_fragment(fragment); out_unlock: spin_unlock(&comp_cache_lock); --- 136,141 ---- put_fragment(fragment); ! if (!drop_fragment(fragment)) ! PageSetCompCache(page); out_unlock: spin_unlock(&comp_cache_lock); *************** *** 263,270 **** /* effectively free it */ ! drop_fragment(fragment); spin_unlock(&comp_cache_lock); - - PageClearCompCache(page); __set_page_dirty(page); UnlockPage(page); --- 266,272 ---- /* effectively free it */ ! if (drop_fragment(fragment)) ! PageClearCompCache(page); spin_unlock(&comp_cache_lock); __set_page_dirty(page); UnlockPage(page); Index: swapout.c =================================================================== RCS file: /cvsroot/linuxcompressed/linux/mm/comp_cache/swapout.c,v retrieving revision 1.68 retrieving revision 1.69 diff -C2 -r1.68 -r1.69 *** swapout.c 31 Jul 2002 20:48:59 -0000 1.68 --- swapout.c 1 Aug 2002 14:52:25 -0000 1.69 *************** *** 2,6 **** * /mm/comp_cache/swapout.c * ! * Time-stamp: <2002-07-31 16:07:44 rcastro> * * Linux Virtual Memory Compressed Cache --- 2,6 ---- * /mm/comp_cache/swapout.c * ! * Time-stamp: <2002-08-01 09:00:35 rcastro> * * Linux Virtual Memory Compressed Cache *************** *** 293,300 **** } ! /* account only those fragments that have been ! * sucessfully written */ ! if (ret) ! comp_cache_update_writeout_stats(fragment); if (nrpages) --- 293,297 ---- } ! comp_cache_update_writeout_stats(fragment); if (nrpages) |