[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: filecache/swapcache questions



> 
> On Tue, 15 Jun 1999, Kanoj Sarcar wrote:
> 
> > I still can't see how this can happen. Note that try_to_swap_out
> > either does a get_swap_page/swap_duplicate on the swaphandle,
> > which gets the swap_count up to 2, or if it sees a page already in
> > the swapcache, it just does a swap_duplicate. Either way, if the
> > only reference on the physical page is from the swapcache, there
> > will be at least one more reference on the swap page other than
> > due to the swapcache. What am I missing?
> 
> When the swap I/O (if needed) finishes, the page count is
> decreased by one.
>

Never mind, I was being blind before. This is why shrink_mmap 
has code that reads:

                if (PageSwapCache(page)) {
                        if (referenced && swap_count(page->offset) != 1)
                                continue;
                        delete_from_swap_cache(page);
                        return 1;
                }
 
Say a process is just about to execute exit()/munmap(), and kswapd 
steals a page from it, updating the pte with the swaphandle.
zap_pte_range -> free_pte will just free the swaphandle, possibly
leaving the page with a refcount of 1 (from the swapcache) and
a swappage count of 1 (from the swapcache again). shrink_mmap
recognizes the page/swaphandle will not be used by anyone and
frees these up.

Thanks for the pointers, Rik.

Kanoj
--
To unsubscribe, send a message with 'unsubscribe linux-mm my@address'
in the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://humbolt.geo.uu.nl/Linux-MM/