Revert "xfs: block allocation work needs to be kswapd aware"
authorDave Chinner <dchinner@redhat.com>
Mon, 14 Jul 2014 21:08:10 +0000 (07:08 +1000)
committerDave Chinner <david@fromorbit.com>
Mon, 14 Jul 2014 21:08:10 +0000 (07:08 +1000)
This reverts commit 1f6d64829db78a7e1d63e15c9f48f0a5d2b5a679.

This commit resulted in regressions in performance in low
memory situations where kswapd was doing writeback of delayed
allocation blocks. It resulted in significant parallelism of the
kswapd work and with the special kswapd flags meant that hundreds of
active allocation could dip into kswapd specific memory reserves and
avoid being throttled. This cause a large amount of performance
variation, as well as random OOM-killer invocations that didn't
previously exist.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
fs/xfs/xfs_bmap_util.c
fs/xfs/xfs_bmap_util.h

index 703b3ec1796cd7ed443a13a4fb1a56bad762bab7..057f671811d6128da5c27f5af595ad13c834a42b 100644 (file)
@@ -258,23 +258,14 @@ xfs_bmapi_allocate_worker(
        struct xfs_bmalloca     *args = container_of(work,
                                                struct xfs_bmalloca, work);
        unsigned long           pflags;
-       unsigned long           new_pflags = PF_FSTRANS;
 
-       /*
-        * we are in a transaction context here, but may also be doing work
-        * in kswapd context, and hence we may need to inherit that state
-        * temporarily to ensure that we don't block waiting for memory reclaim
-        * in any way.
-        */
-       if (args->kswapd)
-               new_pflags |= PF_MEMALLOC | PF_SWAPWRITE | PF_KSWAPD;
-
-       current_set_flags_nested(&pflags, new_pflags);
+       /* we are in a transaction context here */
+       current_set_flags_nested(&pflags, PF_FSTRANS);
 
        args->result = __xfs_bmapi_allocate(args);
        complete(args->done);
 
-       current_restore_flags_nested(&pflags, new_pflags);
+       current_restore_flags_nested(&pflags, PF_FSTRANS);
 }
 
 /*
@@ -293,7 +284,6 @@ xfs_bmapi_allocate(
 
 
        args->done = &done;
-       args->kswapd = current_is_kswapd();
        INIT_WORK_ONSTACK(&args->work, xfs_bmapi_allocate_worker);
        queue_work(xfs_alloc_wq, &args->work);
        wait_for_completion(&done);
index 075f72232a64a92de08665d348dd09a7ad6bd1d4..935ed2b24edfb05b4d5893dccf7cebdb09a374ed 100644 (file)
@@ -50,13 +50,12 @@ struct xfs_bmalloca {
        xfs_extlen_t            total;  /* total blocks needed for xaction */
        xfs_extlen_t            minlen; /* minimum allocation size (blocks) */
        xfs_extlen_t            minleft; /* amount must be left after alloc */
-       bool                    eof;    /* set if allocating past last extent */
-       bool                    wasdel; /* replacing a delayed allocation */
-       bool                    userdata;/* set if is user data */
-       bool                    aeof;   /* allocated space at eof */
-       bool                    conv;   /* overwriting unwritten extents */
-       bool                    stack_switch;
-       bool                    kswapd; /* allocation in kswapd context */
+       char                    eof;    /* set if allocating past last extent */
+       char                    wasdel; /* replacing a delayed allocation */
+       char                    userdata;/* set if is user data */
+       char                    aeof;   /* allocated space at eof */
+       char                    conv;   /* overwriting unwritten extents */
+       char                    stack_switch;
        int                     flags;
        struct completion       *done;
        struct work_struct      work;