[lc-checkins] CVS: linux/mm swap_state.c,1.30,1.31 vmscan.c,1.35,1.36
Status: Beta
Brought to you by:
nitin_sf
From: Rodrigo S. de C. <rc...@us...> - 2002-06-25 14:34:12
|
Update of /cvsroot/linuxcompressed/linux/mm In directory usw-pr-cvs1:/tmp/cvs-serv13268/mm Modified Files: swap_state.c vmscan.c Log Message: Feature o Implemented support for resizing the compressed cache on demand. The user defines the maximum compressed cache size and compressed cache will grow up to this size if necessary. Only then it will start swapping out fragments. And when the compressed cache entries start to get empty, their pages will be released to the system, decreasing compressed cache size. Still have to solve some issues about resizing vswap. o Changed most of the calls from comp_cache_free_locked() to comp_cache_free(), in order to release the page if necessary. Only calls from writeout functions were not changed since we don't want to use those pages to shrink the compressed cache. Bug fixes o Fixed potential oops in comp_cache_use_address(). If the ptes cannot be set to the new address, we would access a null variable (fragment). o Fixed bug in swap in process for virtual swap addresses. While allocating a new page, that virtual swap address might get unused (it gained a real address or vswap table got shrunk), what could lead to a BUG() in comp_cache_swp_duplicate(). Other o Some comments added to functions in adaptivity.c o Updated Configure.help for CONFIG_COMP_CACHE Index: swap_state.c =================================================================== RCS file: /cvsroot/linuxcompressed/linux/mm/swap_state.c,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -r1.30 -r1.31 *** swap_state.c 20 Jun 2002 14:28:49 -0000 1.30 --- swap_state.c 25 Jun 2002 14:34:07 -0000 1.31 *************** *** 214,217 **** --- 214,218 ---- */ if (!new_page) { + set_vswap_allocating(entry); new_page = alloc_page(GFP_HIGHUSER); if (!new_page) *************** *** 232,258 **** if (!read_comp_cache(&swapper_space, entry.val, new_page, 1)) return new_page; ! ! /* ! * vswap address? It's been moved when vswap ! * got shrunk, or gained a real entry and has ! * been swapped out. In either cases, its pte ! * has changed. There's no problem returning a ! * NULL page, mainly when swapping in, since ! * the pte is checked wrt changes. If it's ! * been swapped in when allocating the page ! * above, it will fail to add to swap cache. ! */ ! if (vswap_address(entry)) { ! delete_from_swap_cache(new_page); ! break; ! } ! rw_swap_page(READ, new_page); return new_page; } } while (err != -ENOENT); ! if (new_page) page_cache_release(new_page); return found_page; } --- 233,246 ---- if (!read_comp_cache(&swapper_space, entry.val, new_page, 1)) return new_page; ! if (vswap_address(entry)) ! BUG(); rw_swap_page(READ, new_page); return new_page; } } while (err != -ENOENT); ! if (new_page) page_cache_release(new_page); + clear_vswap_allocating(entry); return found_page; } Index: vmscan.c =================================================================== RCS file: /cvsroot/linuxcompressed/linux/mm/vmscan.c,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -r1.35 -r1.36 *** vmscan.c 18 Jun 2002 13:39:33 -0000 1.35 --- vmscan.c 25 Jun 2002 14:34:07 -0000 1.36 *************** *** 636,643 **** nr_pages = shrink_caches(classzone, priority, gfp_mask, nr_pages); if (nr_pages <= 0) { ! /* let's steal at most half the pages that has ! * been freed by shrink_caches to grow ! * compressed cache (only for normal zone) */ ! grow_comp_cache(classzone, SWAP_CLUSTER_MAX/2); return 1; } --- 636,642 ---- nr_pages = shrink_caches(classzone, priority, gfp_mask, nr_pages); if (nr_pages <= 0) { ! #ifndef CONFIG_COMP_DEMAND_RESIZE ! grow_comp_cache(SWAP_CLUSTER_MAX/2); ! #endif return 1; } |