linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: kanoj@google.engr.sgi.com (Kanoj Sarcar)
To: Andrea Arcangeli <andrea@suse.de>
Cc: torvalds@transmeta.com, sct@redhat.com, linux-mm@kvack.org
Subject: Re: filecache/swapcache questions
Date: Thu, 24 Jun 1999 16:55:28 -0700 (PDT)	[thread overview]
Message-ID: <199906242355.QAA92976@google.engr.sgi.com> (raw)
In-Reply-To: <Pine.LNX.4.10.9906250014490.20322-100000@laser.random> from "Andrea Arcangeli" at Jun 25, 99 00:23:26 am

> 
> On Mon, 21 Jun 1999, Kanoj Sarcar wrote:
> 
> >And continuing on with the problems with swapoff ...
> 
> I have not thought yet at the races you are talking about in the thread.
> 
> But I think I seen another potential problem related to swapoff in the
> last days. Think if you run swapoff -a while there is a program that is
> faulting in a swapin exception. The process is sleeping into
> read_swap_cache_async() after having increased the swap-count (this is the
> only problem). While the task is sleeping swapoff will swapin the page and
> will map the swapped-in page in the pte of the process while the process
> is sleeping. Then swapoff continue and see that the swap-count is still >
> 0 (1 in the example) even if the page is been swapped-in for all tasks in
> the system. Swapoff get confused and set the swap count to 0 by hand (and
> doing that it corrupts a bit the state of the VM). I think I reproduced
> the above scenario stress testing 2.3.8 + my VM changes (finally "stable"
> except the buffer beyond end of the device problem) but it the problem
> I seen is real then it will apply to 2.2.x as well.
> 
> Andrea Arcangeli
> 

Andrea, 

The scenario that you lay out is not possible, as both Stephen and I
pointed out earlier in this thread. swapoff uses read_swap_cache,
so if a process has started a swapin, swapoff will wait for that io
to complete. Note that swapoff can not proceed until the read-in is
complete (at which point the swapcount is decremented by 
PG_swap_unlock_after logic). So, it is not possible for swapoff
to see swap count > 0. At least in theory ...

As to why you might be seeing the problem, this might be due
to fork/exit races with swapoff (which I pointed out in this thread), 
which I hope to have a fix for sometime soon (although it looks ugly). 
Also, see below.

Linus,

The swap lockmap deletion in 2.3.8 is not complete. I hope you will
be taking in Andrea's "shm pages in swapcache" changes (although I
haven't reviewed it, so I can't attest to its goodness). One problem
in 2.3.8 is that a shm page could be getting swapped out, and a swapoff
could actually read the contents of the swaphandle into a new page,
*before* the swapout completed (this was prevented in 2.3.7 in
rw_swap_page_base() by swap lockmap checking), since shm pages are 
not in the swap cache (thus swapoff would have no way of synchronizing
with the swapout completing). This could lead to shm data getting
corrupted. And also lead to swapoff manually setting swapcount to 0,
with shm swapout termination also decrementing swapcount.

Or maybe I am just confused ....

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/

  reply	other threads:[~1999-06-24 23:55 UTC|newest]

Thread overview: 70+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
1999-06-25  0:26                   ` Andrea Arcangeli
1999-06-28  1:48                     ` filecache/swapcache questions [RFC] [RFT] [PATCH] kanoj-mm12-2.3.8 Fix swapoff races Kanoj Sarcar
1999-06-28 10:35                       ` Andrea Arcangeli
1999-06-28 17:11                         ` filecache/swapcache questions [RFC] [RFT] [PATCH] kanoj-mm12-2.3.8 Kanoj Sarcar
1999-06-28 16:32                       ` filecache/swapcache questions [RFC] [RFT] [PATCH] kanoj-mm12-2.3.8 Fix swapoff races Stephen C. Tweedie
1999-06-28 17:25                         ` Kanoj Sarcar
1999-06-28 20:40                           ` Stephen C. Tweedie
1999-06-28 21:11                             ` Kanoj Sarcar
1999-06-28 22:12                               ` Stephen C. Tweedie
1999-06-28 23:43                                 ` Kanoj Sarcar
1999-06-29 11:44                                   ` Stephen C. Tweedie
1999-06-29 22:01                                     ` Kanoj Sarcar
1999-06-30 17:28                                       ` Stephen C. Tweedie
1999-06-30 18:05                                         ` Kanoj Sarcar
1999-06-28 19:39                       ` Chuck Lever
1999-06-28 19:55                         ` filecache/swapcache questions [RFC] [RFT] [PATCH] kanoj-mm12-2.3.8 Kanoj Sarcar
1999-06-28 20:33                           ` Chuck Lever
1999-06-28 20:51                             ` Kanoj Sarcar
1999-06-28 21:32                               ` Chuck Lever
1999-06-28 21:38                                 ` Kanoj Sarcar
1999-06-28 21:50                                   ` Chuck Lever
1999-06-28 22:15                                     ` Kanoj Sarcar
1999-06-29 11:23                                       ` Stephen C. Tweedie
1999-06-29 17:36                                         ` Kanoj Sarcar
1999-06-28 22:22                                   ` Stephen C. Tweedie
1999-06-28 22:21                                 ` Stephen C. Tweedie
1999-06-28 22:57                                   ` Andrea Arcangeli
1999-06-29  2:13                                     ` Chuck Lever
1999-06-29 12:01                                       ` Stephen C. Tweedie
1999-06-29 12:32                                         ` Andrea Arcangeli
1999-06-30 15:59                                           ` Stephen C. Tweedie
1999-06-29  1:00                                   ` Chuck Lever
1999-06-28 22:08                               ` Stephen C. Tweedie
1999-06-28 22:59                                 ` Andrea Arcangeli
1999-06-29  0:53                                 ` Chuck Lever
1999-06-29 11:14                                   ` Stephen C. Tweedie
1999-06-28 22:09                           ` Stephen C. Tweedie
1999-06-28 20:45                         ` filecache/swapcache questions [RFC] [RFT] [PATCH] kanoj-mm12-2.3.8 Fix swapoff races Stephen C. Tweedie
1999-06-28 21:14                           ` Chuck Lever
1999-06-28 21:25                             ` filecache/swapcache questions [RFC] [RFT] [PATCH] kanoj-mm12-2.3.8 Kanoj Sarcar
1999-06-28 22:15                             ` filecache/swapcache questions [RFC] [RFT] [PATCH] kanoj-mm12-2.3.8 Fix swapoff races Stephen C. Tweedie
1999-06-28 22:48                             ` Andrea Arcangeli
1999-06-29  1:29                               ` Chuck Lever
1999-06-29 11:58                                 ` Stephen C. Tweedie
1999-06-29 12:09                                 ` Andrea Arcangeli
1999-06-29 15:27                                   ` Chuck Lever
1999-06-29 11:55                               ` Stephen C. Tweedie
1999-06-29 20:08                               ` Andrea Arcangeli
1999-06-28 22:36             ` filecache/swapcache questions Stephen C. Tweedie
1999-06-28 23:24               ` Kanoj Sarcar
  -- strict thread matches above, loose matches on Subject: below --
1999-06-15  7:16 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=199906242355.QAA92976@google.engr.sgi.com \
    --to=kanoj@google.engr.sgi.com \
    --cc=andrea@suse.de \
    --cc=linux-mm@kvack.org \
    --cc=sct@redhat.com \
    --cc=torvalds@transmeta.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox