linux-IllusionX/include
Hugh Dickins 02098feaa4 swapin needs gfp_mask for loop on tmpfs
Building in a filesystem on a loop device on a tmpfs file can hang when
swapping, the loop thread caught in that infamous throttle_vm_writeout.

In theory this is a long standing problem, which I've either never seen in
practice, or long ago suppressed the recollection, after discounting my load
and my tmpfs size as unrealistically high.  But now, with the new aops, it has
become easy to hang on one machine.

Loop used to grab_cache_page before the old prepare_write to tmpfs, which
seems to have been enough to free up some memory for any swapin needed; but
the new write_begin lets tmpfs find or allocate the page (much nicer, since
grab_cache_page missed tmpfs pages in swapcache).

When allocating a fresh page, tmpfs respects loop's mapping_gfp_mask, which
has __GFP_IO|__GFP_FS stripped off, and throttle_vm_writeout is designed to
break out when __GFP_IO or GFP_FS is unset; but when tmfps swaps in,
read_swap_cache_async allocates with GFP_HIGHUSER_MOVABLE regardless of the
mapping_gfp_mask - hence the hang.

So, pass gfp_mask down the line from shmem_getpage to shmem_swapin to
swapin_readahead to read_swap_cache_async to add_to_swap_cache.

Signed-off-by: Hugh Dickins <hugh@veritas.com>
Acked-by: Rik van Riel <riel@redhat.com>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-02-05 09:44:14 -08:00
..
acpi
asm-alpha iommu sg merging: alpha: make pci_iommu respect the segment size limits 2008-02-05 09:44:10 -08:00
asm-arm gpiolib support for the PXA architecture 2008-02-05 09:44:13 -08:00
asm-avr32 gpiolib: avr32 at32ap platform support 2008-02-05 09:44:13 -08:00
asm-blackfin
asm-cris
asm-frv
asm-generic gpiolib: add gpio provider infrastructure 2008-02-05 09:44:12 -08:00
asm-h8300
asm-ia64
asm-m32r
asm-m68k
asm-m68knommu
asm-mips
asm-parisc
asm-powerpc iommu sg: powerpc: convert iommu to use the IOMMU helper 2008-02-05 09:44:11 -08:00
asm-ppc
asm-s390
asm-sh
asm-sparc
asm-sparc64
asm-um
asm-v850
asm-x86 i386: Resolve dependency of asm-i386/pgtable.h on highmem.h 2008-02-05 09:44:14 -08:00
asm-xtensa
crypto
keys
linux swapin needs gfp_mask for loop on tmpfs 2008-02-05 09:44:14 -08:00
math-emu
media
mtd
net
pcmcia
rdma
rxrpc
scsi
sound
video
xen
Kbuild