]> git.karo-electronics.de Git - linux-beck.git/commit
xfs: block allocation work needs to be kswapd aware
authorDave Chinner <dchinner@redhat.com>
Fri, 6 Jun 2014 05:59:59 +0000 (15:59 +1000)
committerDave Chinner <david@fromorbit.com>
Fri, 6 Jun 2014 05:59:59 +0000 (15:59 +1000)
commit1f6d64829db78a7e1d63e15c9f48f0a5d2b5a679
treeaa4692eeb903340f84953001667e5c03c53d309c
parentd6d211db37e75de2ddc3a4f979038c40df7cc79c
xfs: block allocation work needs to be kswapd aware

Upon memory pressure, kswapd calls xfs_vm_writepage() from
shrink_page_list(). This can result in delayed allocation occurring
and that gets deferred to the the allocation workqueue.

The allocation then runs outside kswapd context, which means if it
needs memory (and it does to demand page metadata from disk) it can
block in shrink_inactive_list() waiting for IO congestion. These
blocking waits are normally avoiding in kswapd context, so under
memory pressure writeback from kswapd can be arbitrarily delayed by
memory reclaim.

To avoid this, pass the kswapd context to the allocation being done
by the workqueue, so that memory reclaim understands correctly that
the work is being done for kswapd and therefore it is not blocked
and does not delay memory reclaim.

To avoid issues with int->char conversion of flag fields (as noticed
in v1 of this patch) convert the flag fields in the struct
xfs_bmalloca to bool types. pahole indicates these variables are
still single byte variables, so no extra space is consumed by this
change.

cc: <stable@vger.kernel.org>
Reported-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
fs/xfs/xfs_bmap_util.c
fs/xfs/xfs_bmap_util.h