xfs: warn if direct reclaim tries to writeback pages
authorMel Gorman <[email protected]>
Tue, 1 Nov 2011 00:07:45 +0000 (17:07 -0700)
committerLinus Torvalds <[email protected]>
Tue, 1 Nov 2011 00:30:46 +0000 (17:30 -0700)
Direct reclaim should never writeback pages.  For now, handle the
situation and warn about it.  Ultimately, this will be a BUG_ON.

Signed-off-by: Mel Gorman <[email protected]>
Cc: Dave Chinner <[email protected]>
Cc: Christoph Hellwig <[email protected]>
Cc: Johannes Weiner <[email protected]>
Cc: Wu Fengguang <[email protected]>
Cc: Jan Kara <[email protected]>
Cc: Minchan Kim <[email protected]>
Cc: Rik van Riel <[email protected]>
Cc: Mel Gorman <[email protected]>
Cc: Alex Elder <[email protected]>
Cc: Theodore Ts'o <[email protected]>
Cc: Chris Mason <[email protected]>
Cc: Dave Hansen <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
fs/xfs/xfs_aops.c

index 11b2aad982d46b0704ade9aa02347d712c0cc23f..33b13310ee0c2f2ddf0c68abaa57e95c7f47d963 100644 (file)
@@ -902,11 +902,11 @@ xfs_vm_writepage(
         * random callers for direct reclaim or memcg reclaim.  We explicitly
         * allow reclaim from kswapd as the stack usage there is relatively low.
         *
-        * This should really be done by the core VM, but until that happens
-        * filesystems like XFS, btrfs and ext4 have to take care of this
-        * by themselves.
+        * This should never happen except in the case of a VM regression so
+        * warn about it.
         */
-       if ((current->flags & (PF_MEMALLOC|PF_KSWAPD)) == PF_MEMALLOC)
+       if (WARN_ON_ONCE((current->flags & (PF_MEMALLOC|PF_KSWAPD)) ==
+                       PF_MEMALLOC))
                goto redirty;
 
        /*