From: Hugh Dickins <hugh@veritas.com>
To: Vegard Nossum <vegard.nossum@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Swap on loop device on tmpfs locks up machine
Date: Sun, 28 Sep 2008 16:18:35 +0100 (BST) [thread overview]
Message-ID: <Pine.LNX.4.64.0809281604100.17064@blonde.site> (raw)
In-Reply-To: <19f34abd0809261146j72a68765i964466336a3a34dc@mail.gmail.com>
On Fri, 26 Sep 2008, Vegard Nossum wrote:
>
> It turns out that swap over loop device on tmpfs will lock up the
> machine. That is, all programs become blocked, but I can still do
> things like switch VT consoles.
>
> To reproduce (as root):
>
> mount -t tmpfs tmpfs /mnt
> dd if=/dev/zero of=/mnt/disk
> swapoff -a
> losetup -f /mnt/disk
> mkswap /dev/loop0 # replace loop0 with actual loop device
> swapon /dev/loop0
> <memory hog, like continuous malloc()>
>
> I'm not sure it's really a very good idea to do this in the first
> place, but should something give a warning or prevent a user from
> doing it?
It's just a "don't do that" in my opinion, and it doesn't seem
to have caused much trouble for sysadmins down the years.
It's good to have a loop driver that can make regular files look
like block devices, and it's good to have that working on tmpfs;
and I'm glad that trying to swapon a tmpfs file directly just
happens to fail because tmpfs doesn't support bmap().
But I don't think it's worth adding in some "valid for swap" call
to block devices, and saying no when loop or when loop over tmpfs.
Trying to swap to loop over tmpfs is a particularly clear example
of something that will end badly - unless the tmpfs file is locked
in memory? haven't tried that - but I wouldn't recommend swapping
to loop over anything (it interposes levels between swap and device
which just increase the likelihood of hang).
Just don't do that.
Hugh
prev parent reply other threads:[~2008-09-28 15:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-26 18:46 Vegard Nossum
2008-09-27 12:49 ` David Newall
2008-09-27 17:38 ` Bill Davidsen
2008-09-27 18:30 ` Vegard Nossum
2008-09-28 15:18 ` Hugh Dickins [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=Pine.LNX.4.64.0809281604100.17064@blonde.site \
--to=hugh@veritas.com \
--cc=linux-kernel@vger.kernel.org \
--cc=vegard.nossum@gmail.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
all inboxes | Powered by JetHome®