]> git.proxmox.com Git - mirror_spl.git/commit
Add hooks for disabling direct reclaim
authorRichard Yao <ryao@gentoo.org>
Sun, 13 Jul 2014 18:45:20 +0000 (14:45 -0400)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Fri, 16 Jan 2015 21:55:09 +0000 (13:55 -0800)
commitc2fa09454ef322a34df58655978e79c1c7fab641
tree402e6e539d6eefdc0732bacb84f68fe2f5cc77ee
parentc3eabc75b1ea41a12e3fec06db74a2995bda7514
Add hooks for disabling direct reclaim

The port of XFS to Linux introduced a thread-specific PF_FSTRANS bit
that is used to mark contexts which are processing transactions.  When
set, allocations in this context can dip into kernel memory reserves
to avoid deadlocks during writeback.  Linux 3.9 provided the additional
PF_MEMALLOC_NOIO for disabling __GFP_IO in page allocations, which XFS
began using in 3.15.

This patch implements hooks for marking transactions via PF_FSTRANS.
When an allocation is performed in the context of PF_FSTRANS, any
KM_SLEEP allocation is transparently converted to a GFP_NOIO allocation.

Additionally, when using a Linux 3.9 or newer kernel, it will set
PF_MEMALLOC_NOIO to prevent direct reclaim from entering pageout() on
on any KM_PUSHPAGE or KM_NOSLEEP allocation.  This effectively allows
the spl_vmalloc() helper function to be used safely in a thread which
is responsible for IO.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
include/sys/kmem.h
include/sys/vmem.h
module/spl/spl-kmem-cache.c
module/spl/spl-kmem.c
module/spl/spl-vmem.c