[lc-checkins] CVS: linux/mm/comp_cache adaptivity.c,1.41,1.42 aux.c,1.44,1.45 main.c,1.66,1.67 swapo
Status: Beta
Brought to you by:
nitin_sf
From: Rodrigo S. de C. <rc...@us...> - 2002-11-26 21:42:35
|
Update of /cvsroot/linuxcompressed/linux/mm/comp_cache In directory sc8-pr-cvs1:/tmp/cvs-serv8394/mm/comp_cache Modified Files: adaptivity.c aux.c main.c swapout.c Log Message: Cleanup o Remove unused CF_End and related macros o Removed special cases in get_comp_cache_page() where there were the comp_page structure, but no page was set to it. o Removed set_comp_page() function, which is not needed any longer. Bug fixes o Fixed, at least partially, bug reported by Claudio Martella. The free space in compressed cache wasn't accounted correctly in compact_comp_cache(). Pages were removed from their original locations, increasing the comp_cache_free_space variable, but not decreasing when they were relocated. o Fixed bug that would account erroneously the number of allocated pages if any allocation (page or structure of the compressed cache) failed in the boot process. That can be worse when a static compressed cache is used. It would also oops if neither the page nor the fragment structure could be allocated. This bug is fixed too. Index: adaptivity.c =================================================================== RCS file: /cvsroot/linuxcompressed/linux/mm/comp_cache/adaptivity.c,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -r1.41 -r1.42 *** adaptivity.c 22 Nov 2002 16:01:36 -0000 1.41 --- adaptivity.c 26 Nov 2002 21:42:32 -0000 1.42 *************** *** 2,6 **** * linux/mm/comp_cache/adaptivity.c * ! * Time-stamp: <2002-11-21 17:28:13 rcastro> * * Linux Virtual Memory Compressed Cache --- 2,6 ---- * linux/mm/comp_cache/adaptivity.c * ! * Time-stamp: <2002-11-26 19:34:55 rcastro> * * Linux Virtual Memory Compressed Cache *************** *** 519,523 **** __free_pages(comp_page->page, COMP_PAGE_ORDER); ! set_comp_page(comp_page, NULL); kmem_cache_free(comp_cachep, comp_page); num_comp_pages--; --- 519,526 ---- __free_pages(comp_page->page, COMP_PAGE_ORDER); ! comp_cache_freeable_space -= COMP_PAGE_SIZE; ! comp_cache_free_space -= COMP_PAGE_SIZE; ! comp_page->page = NULL; ! kmem_cache_free(comp_cachep, comp_page); num_comp_pages--; *************** *** 741,744 **** --- 744,749 ---- new_comp_page->free_offset += new_fragment->compressed_size; + comp_cache_free_space -= compressed_size; + add_to_comp_page_list(new_comp_page, new_fragment); add_fragment_vswap(new_fragment); Index: aux.c =================================================================== RCS file: /cvsroot/linuxcompressed/linux/mm/comp_cache/aux.c,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -r1.44 -r1.45 *** aux.c 22 Nov 2002 16:01:36 -0000 1.44 --- aux.c 26 Nov 2002 21:42:32 -0000 1.45 *************** *** 2,6 **** * linux/mm/comp_cache/aux.c * ! * Time-stamp: <2002-10-28 21:13:03 rcastro> * * Linux Virtual Memory Compressed Cache --- 2,6 ---- * linux/mm/comp_cache/aux.c * ! * Time-stamp: <2002-11-26 19:34:59 rcastro> * * Linux Virtual Memory Compressed Cache *************** *** 70,96 **** return q; - } - - inline void - set_comp_page(struct comp_cache_page * comp_page, struct page * page) - { - if (!comp_page) - BUG(); - if (comp_page->page) { - if (page) - goto out; - comp_cache_freeable_space -= COMP_PAGE_SIZE; - comp_cache_free_space -= COMP_PAGE_SIZE; - goto out; - } - - if (!page) - BUG(); - - comp_cache_freeable_space += COMP_PAGE_SIZE; - comp_cache_free_space += COMP_PAGE_SIZE; - - out: - comp_page->page = page; } --- 70,73 ---- Index: main.c =================================================================== RCS file: /cvsroot/linuxcompressed/linux/mm/comp_cache/main.c,v retrieving revision 1.66 retrieving revision 1.67 diff -C2 -r1.66 -r1.67 *** main.c 22 Nov 2002 16:01:37 -0000 1.66 --- main.c 26 Nov 2002 21:42:32 -0000 1.67 *************** *** 2,6 **** * linux/mm/comp_cache/main.c * ! * Time-stamp: <2002-10-25 08:54:11 rcastro> * * Linux Virtual Memory Compressed Cache --- 2,6 ---- * linux/mm/comp_cache/main.c * ! * Time-stamp: <2002-11-26 19:32:57 rcastro> * * Linux Virtual Memory Compressed Cache *************** *** 37,41 **** unsigned long zone_num_comp_pages = 0; ! unsigned long comp_cache_free_space; kmem_cache_t * comp_cachep; --- 37,41 ---- unsigned long zone_num_comp_pages = 0; ! unsigned long comp_cache_free_space = 0; kmem_cache_t * comp_cachep; *************** *** 226,230 **** struct comp_cache_page * comp_page; struct page * page; ! int i; printk("Compressed Cache: %s\n", COMP_CACHE_VERSION); --- 226,230 ---- struct comp_cache_page * comp_page; struct page * page; ! int i, failed = 0; printk("Compressed Cache: %s\n", COMP_CACHE_VERSION); *************** *** 269,275 **** 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; --- 269,285 ---- page = alloc_pages(GFP_KERNEL, COMP_PAGE_ORDER); ! if (!page) ! goto failed; ! ! if (init_comp_page(&comp_page, page)) ! continue; ! ! __free_pages(page, COMP_PAGE_ORDER); ! failed: ! failed++; } + + num_comp_pages -= failed; + max_used_num_comp_pages -= failed; comp_cache_free_space = num_comp_pages * COMP_PAGE_SIZE; Index: swapout.c =================================================================== RCS file: /cvsroot/linuxcompressed/linux/mm/comp_cache/swapout.c,v retrieving revision 1.73 retrieving revision 1.74 diff -C2 -r1.73 -r1.74 *** swapout.c 22 Nov 2002 16:01:45 -0000 1.73 --- swapout.c 26 Nov 2002 21:42:32 -0000 1.74 *************** *** 2,6 **** * /mm/comp_cache/swapout.c * ! * Time-stamp: <2002-10-25 11:26:59 rcastro> * * Linux Virtual Memory Compressed Cache --- 2,6 ---- * /mm/comp_cache/swapout.c * ! * Time-stamp: <2002-11-26 19:33:23 rcastro> * * Linux Virtual Memory Compressed Cache *************** *** 529,537 **** break; ! if (!comp_page->page) { ! if (comp_page->free_space != COMP_PAGE_SIZE) ! BUG(); ! goto alloc_new_page; ! } aux_comp_size = 0; --- 529,534 ---- break; ! if (!comp_page->page) ! BUG(); aux_comp_size = 0; *************** *** 617,639 **** page_cache_release(page); return comp_page; - - alloc_new_page: - /* remove from free space hash table before update */ - remove_comp_page_from_hash_table(comp_page); - - if (comp_page->page) - BUG(); - - spin_unlock(&comp_cache_lock); - new_page = alloc_page(gfp_mask); - spin_lock(&comp_cache_lock); - - if (!new_page) - goto failed; - - set_comp_page(comp_page, new_page); - - if (TryLockPage(comp_page->page)) - BUG(); check_references: --- 614,617 ---- |