Re: [lc-devel] CCache work status
Status: Beta
Brought to you by:
nitin_sf
From: Anderson B. <bri...@gm...> - 2006-06-08 00:45:05
|
Hi Nitin, > The approach I've taken is this: > > * General > It creates a virtual swap device (another swap_info_struct in swap_info[]). Its > size is set though a /proc entry created by 'cc_control' module (attached). This > swap is set to highest priority and is identified in other code paths with > SWP_COMPRESSED flag. So, when adding page to swap cache, it is given 'type' no. > as for this virt swap until it reaches its max capacity (as set through /proc > interface). > > * Storing page to ccache > When swap to disk occurs in pageout(), same things will occur as is done for > page-cache pages -- it doesn't need to know if it's anon or fs-backed page. > These things are - replace corresponding swapper radix tree node to a > 'chunk_head' which then points to the location of 'chunks' in ccache storage > structure. > > * Restoring an anon page from ccache > When page fault occurs, handle_pte_fault() first checks swap cache if it already > has required page which then calls find_get_page() over swapper space radix > tree. Here, a compressed page is handled exactly as for page cache page i.e. > checked if looked-up page has PG_compressed set, decompress it and make radix > node point back to this uncompressed page. > > * Notes > -- This approach deals easily with case where no real swap devices exist. This > virt swap is a separate entity with all separate data structures like swap_map[] > as for a normal swap device. > -- This only requires working with arch independent swp_entry_t instead of arch > dependent representation of it in PTEs. > -- More code sharing for handling page-cache and swap-cache pages - much of code > wouldn't know if its working with anon or fs-backed page like > add_to_swap_cache(), find_get_page() (and friends). > > * About files attached > -- cc_control module: This creates two proc entries: > /proc/cc_control/{max_anon_cc_size, max_fs_backed_cc_size}. Write to > max_anon_cc_size, the size of ccache for anon pages in units of no. of pages. > Writing this value calls set_anon_cc_size() in mm/swapfile.c which creates this > virtual swap device with size as passed and highest priority (hard-coded to > 100). (max_fs_backed_cc_size is dummy for now). > -- patch for 2.6.17-rc5 that has this set_anon_cc_size() with some small misc > handling. I'm testing the patch and the module but I got a 'Segmentation Fault' problem when reading /proc/swaps entry after creating the virtual swap area. Is this virtual swap usable? Because when a page will be swapped-out to the virtual swap area I'm getting a Kernel Null pointer reference. Best regards, Anderson Briglia |