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

Re: Q. about swap-cache orphans



Hi,

On Wed, Mar 22, 2000 at 11:55:45PM +0100, Jamie Lokier wrote:
> [This is just a question to help my understanding, not relevant to madvise]
> 
> Stephen C. Tweedie wrote:
> > If it is the last user of the page --- ie. if PG_SwapCache is set and
> > the refcount of the page is one --- then it will do so anyway, because
> > when I added that swap cache code I made sure that zap_page_range()
> > does a free_page_and_swap_cache() when freeing pages.
> 
> I.e., zap_page_range makes sure that MADV_DONTNEED won't leave orphan
> swap-cache pages.

Not quite, but very nearly.  There are a few minor places where the 
refcount on a page is bumped up temporarily, so zap_page_range is
theoretically able to be confused into thinking that there are extra
references, and that the swap cache should remain.  However, that is
still correct behaviour, because the shrink_mmap() code will seek and
destroy the remaining swap cache references if that happens.

> > The shrink_mmap() page cache reclaimer is able to pick up any orphaned 
> > swap cache pages.
> 
> But there won't be any orphans, will there?
> Or do they appear due to async. swapping situations?

Yes, but it's harmless.

--Stephen

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux.eu.org/Linux-MM/