All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: "Stephen C. Tweedie" <sct@redhat.com>
To: Zlatko.Calusic@CARNet.hr
Cc: Linux-MM List <linux-mm@kvack.org>,
	Linux Kernel List <linux-kernel@vger.rutgers.edu>,
	Stephen Tweedie <sct@redhat.com>
Subject: Re: Removing swap lockmap...
Date: Mon, 18 Jan 1999 21:46:40 GMT	[thread overview]
Message-ID: <199901182146.VAA09942@dax.scot.redhat.com> (raw)
In-Reply-To: <87iue47gy4.fsf@atlas.CARNet.hr>

Hi,

In article <87iue47gy4.fsf@atlas.CARNet.hr>, Zlatko Calusic
<Zlatko.Calusic@CARNet.hr> writes:

> I removed swap lockmap all together and, to my surprise, I can't
> produce any ill behaviour on my system, not even under very heavy
> swapping (in low memory condition).

Just because you can't reproduce it doesn't mean it works perfectly.
There was a very good reason why the swap lock map was still required
until recently.  The race condition it fixed wass an obscure one but
still important.  However, very recent VM changes make me wonder if it
is still absolutely necessary.  

The problem was that if we swapped out a page, we might sometimes remove
the swap cache for the page before the IO was complete.  If we can
_guarantee_ that the swap cache will persist until after the IO is
complete, then any future attempt to use that swap page will find that
the page is locked and will wait for the IO to complete.

However, if in fact the swap cache for the page _ever_ gets removed
before the IO completes, then a future read in of the page might start
before the current write had completed.  This has been observed in
practice.  The swap lock protects against this.

Now that we always keep the swap cache intact in mm/vmscan.c and only
reclaim it in mm/filemap.c, we might in fact be safe omiting the swap
lock.  I'd be nervous about it without a _thorough_ audit of the code,
though, as this particular race is hard to reproduce.

--Stephen
--
This is a majordomo managed list.  To unsubscribe, send a message with
the body 'unsubscribe linux-mm me@address' to: majordomo@kvack.org

  parent reply	other threads:[~1999-01-18 21:47 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-01-18 15:12 Removing swap lockmap Zlatko Calusic
1999-01-18 20:26 ` Andrea Arcangeli
1999-01-18 22:24   ` BUG: deadlock in swap lockmap handling Alan Cox
1999-01-18 21:46 ` Stephen C. Tweedie [this message]
1999-01-19  1:33   ` Removing swap lockmap Zlatko Calusic
1999-01-19  0:34 ` Eric W. Biederman
1999-01-19  1:37   ` Zlatko Calusic
1999-01-19 18:15     ` Andrea Arcangeli
1999-01-20 17:09       ` Stephen C. Tweedie
1999-01-20 18:14         ` Zlatko Calusic

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=199901182146.VAA09942@dax.scot.redhat.com \
    --to=sct@redhat.com \
    --cc=Zlatko.Calusic@CARNet.hr \
    --cc=linux-kernel@vger.rutgers.edu \
    --cc=linux-mm@kvack.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.