linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* filecache/swapcache questions
@ 1999-06-15  7:16 Kanoj Sarcar
  1999-06-15  7:32 ` Rik van Riel
  0 siblings, 1 reply; 23+ messages in thread
From: Kanoj Sarcar @ 1999-06-15  7:16 UTC (permalink / raw)
  To: linux-mm

Hi all.

I am trying to understand some of the swapcache/filecache code. I
have a few questions (I am sure I will have more soon), which I am
jotting down here in the hope that someone can answer them. It is
quite possible that I am reading the code wrong ...


Q1. Is it really needed to put all the swap pages in the swapper_inode
i_pages? 

Q2. shrink_mmap has code that reads:

                if (PageSwapCache(page)) {
                        if (referenced && swap_count(page->offset) != 1)
                                continue;
                        delete_from_swap_cache(page);
                        return 1;
                }

How will it be possible for a page to be in the swapcache, for its
reference count to be 1 (which has been checked just before), and
for its swap_count(page->offset) to also be 1? I can see this being
possible only if an unmap/exit path might lazily leave a anonymous
page in the swap cache, but I don't believe that happens. Ipc/shm 
pages are not candidates here, since they temporarily raise the page
reference count while swapping.

Q3. Is there some mechanism to detect io errors for swap cache pages
similar to what the PG_uptodate bit provides for filemap pages?

Thanks.

Kanoj
kanoj@engr.sgi.com
--
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/

^ permalink raw reply	[flat|nested] 23+ messages in thread
* Re: filecache/swapcache questions
@ 1999-06-21  5:29 Kanoj Sarcar
  1999-06-21 11:25 ` Stephen C. Tweedie
  0 siblings, 1 reply; 23+ messages in thread
From: Kanoj Sarcar @ 1999-06-21  5:29 UTC (permalink / raw)
  To: sct; +Cc: linux-mm

Okay, lets see if I am being stupid again ...

Imagine a process exitting, executing exit_mmap. exit_mmap
cleans out the vma list from the mm, ie sets mm->mmap = 0.
Then, it invokes vm_ops->unmap, say on a MAP_SHARED file
vma, which starts file io, that puts the process to sleep.

Now, a sys_swapoff comes in ... this will not be able to
retrieve the swap handles from the former process (since
the vma's are invisible), so it may end up deleting the 
device with a warning message about non 0 swap_map count.

The exitting process then invokes a bunch of swap_free()s
via zap_page_range, whereas the swap id might already have
been reassigned.

If there's no protection against this, a possible fix would 
be for exit_mmap not to clean the vma list, rather delete a
vma at a time from the list.

So, what is the call to swap_free doing in filemap_sync_pte?
When will this call ever be executed?

Thanks.

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

^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~1999-06-28 23:24 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-06-15  7:16 filecache/swapcache questions Kanoj Sarcar
1999-06-15  7:32 ` Rik van Riel
1999-06-15 15:51   ` Kanoj Sarcar
1999-06-15 20:24     ` Rik van Riel
1999-06-15 21:02       ` Kanoj Sarcar
1999-06-16 20:37     ` Andrea Arcangeli
1999-06-17 23:33   ` Stephen C. Tweedie
1999-06-18  0:20     ` Kanoj Sarcar
1999-06-18 17:00       ` Stephen C. Tweedie
1999-06-18 17:03         ` Kanoj Sarcar
1999-06-21  5:29 Kanoj Sarcar
1999-06-21 11:25 ` Stephen C. Tweedie
1999-06-21 16:46   ` Kanoj Sarcar
1999-06-21 16:57     ` Stephen C. Tweedie
1999-06-21 17:36       ` Kanoj Sarcar
1999-06-21 17:49         ` Stephen C. Tweedie
1999-06-21 18:46           ` Kanoj Sarcar
1999-06-21 23:44             ` Kanoj Sarcar
1999-06-24 22:23               ` Andrea Arcangeli
1999-06-24 23:55                 ` Kanoj Sarcar
1999-06-25  0:26                   ` Andrea Arcangeli
1999-06-28 22:36             ` Stephen C. Tweedie
1999-06-28 23:24               ` Kanoj Sarcar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox