From: Christoph Rohland <cr@sap.com>
To: Linus Torvalds <torvalds@transmeta.com>
Cc: Marcelo Tosatti <marcelo@conectiva.com.br>, linux-kernel@vger.kernel.org
Subject: Re: [Patch] shmem_unuse race fix
Date: 28 Dec 2000 23:13:15 +0100 [thread overview]
Message-ID: <m3n1dgus5n.fsf@linux.local> (raw)
In-Reply-To: <Pine.LNX.4.10.10012281003360.12064-100000@penguin.transmeta.com>
In-Reply-To: <Pine.LNX.4.10.10012281003360.12064-100000@penguin.transmeta.com>
Linus Torvalds <torvalds@transmeta.com> writes:
> On 28 Dec 2000, Christoph Rohland wrote:
> >
> > First we need the following patch since otherwise we use a swap entry
> > without having the count increased:
>
> No, that shouldn't be needed.
>
> Look at the code-path: the kernel has the page locked, so nothing will
> de-allocate the swap entry - so it's perfectly ok to increase it
> later.
I am not sure that page locking is done very strictly in the swap
cache. I had to fiddle around that sometimes in shmem.c.
The patch actually is getting me the 'right error': Undead swap
entries in swapoff instead of bad swap entries in nopage. The latter
means there is a swapentry noted in the page table which was legally
removed. And that's definitely wrong.
> I dislike the "magic" __get_swap_page(2) thing - we might make
> get_swap_page() itself _always_ return a swap entry with count two
> (one fot eh swap cache, one for the user), or we should keep it the
> way it was (where we explicitly increment it for the user).
Yes, I agree. I was too lazy to check the other uses of get_swap_page
for this patchlet. But at least shmem.c uses the same and I think it's
logical. We always need a swap cache and a user reference.
> Ok. How about making try_to_unuse() just get the VM semaphore instead of
> the page table lock?
>
> Then try_to_unuse() would follow all the right rules, and the above
> problem wouldn't exist..
If this is right we should do this. There is no need to care about
contention in swapoff. It's definitely not the common path. But we
have to be careful about deadlocks....
Greetings
Christoph
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
prev parent reply other threads:[~2000-12-28 22:42 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-12-27 10:32 [Patch] shmem_unuse race fix Christoph Rohland
2000-12-27 15:14 ` Marcelo Tosatti
2000-12-27 18:36 ` Christoph Rohland
2000-12-28 4:35 ` Linus Torvalds
2000-12-28 12:02 ` Christoph Rohland
2000-12-28 18:07 ` Linus Torvalds
2000-12-28 22:13 ` Christoph Rohland [this message]
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=m3n1dgus5n.fsf@linux.local \
--to=cr@sap.com \
--cc=linux-kernel@vger.kernel.org \
--cc=marcelo@conectiva.com.br \
--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