Re: swapfile on btrfs, temporary solution for wiki

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 24 Oct 2013 23:52:01 +0300
Timofey Titovets <nefelim4ag@xxxxxxxxx> wrote:

> Hello, i suggest temporary solution to use swap file under btrfs.
> I test it, and it work good.
> 
> I invent simple the way, how create and using swap file, just see
> following sh code:
> 
> swapfile=$(losetup -f) #free loop device
> truncate -s 8G /swap   #create 8G sparse swap file
> losetup $swapfile /swap #mount file to loop
> mkswap  $swapfile
> swapon  $swapfile
> 
> i just adding this to rc.local and this work good.
> May be, add it to btrfs Wiki as temporary solution to using swap file?

I always thought Btrfs does not allow swap files on purpose, because it is not
deadlock-proof when used in the swapping context.

Imagine you try swapping out pages to free up some memory, and in the process
Btrfs needs to allocate some memory to actually perform the write, the kernel
says "Sure, but for that we need to swap out some more pages..." You see where
that goes.

Same issue is possible with swap on other complex filesystems an example
being networked ones like NFS and SMB/CIFS.

It might work for some time (or even work 99% of time), but you still may be
endangering your system to a possibility of a lock-up, and certainly adding
that to any Wiki/FAQ/website as "the solution" might not be the best choice.

-- 
With respect,
Roman

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux