aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2014-07-14 17:08:10 -0400
committerDave Chinner <david@fromorbit.com>2014-07-14 17:08:10 -0400
commitaa182e64f16fc29a4984c2d79191b161888bbd9b (patch)
tree248089d2be2a62bcd08ebdf319882dfb1e9dfd18 /fs
parenta497c3ba1d97fc69c1e78e7b96435ba8c2cb42ee (diff)
Revert "xfs: block allocation work needs to be kswapd aware"
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>
Diffstat (limited to 'fs')
-rw-r--r--fs/xfs/xfs_bmap_util.c16
-rw-r--r--fs/xfs/xfs_bmap_util.h13
2 files changed, 9 insertions, 20 deletions
diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c
index 703b3ec1796c..057f671811d6 100644
--- a/fs/xfs/xfs_bmap_util.c
+++ b/fs/xfs/xfs_bmap_util.c
@@ -258,23 +258,14 @@ xfs_bmapi_allocate_worker(
258 struct xfs_bmalloca *args = container_of(work, 258 struct xfs_bmalloca *args = container_of(work,
259 struct xfs_bmalloca, work); 259 struct xfs_bmalloca, work);
260 unsigned long pflags; 260 unsigned long pflags;
261 unsigned long new_pflags = PF_FSTRANS;
262 261
263 /* 262 /* we are in a transaction context here */
264 * we are in a transaction context here, but may also be doing work 263 current_set_flags_nested(&pflags, PF_FSTRANS);
265 * in kswapd context, and hence we may need to inherit that state
266 * temporarily to ensure that we don't block waiting for memory reclaim
267 * in any way.
268 */
269 if (args->kswapd)
270 new_pflags |= PF_MEMALLOC | PF_SWAPWRITE | PF_KSWAPD;
271
272 current_set_flags_nested(&pflags, new_pflags);
273 264
274 args->result = __xfs_bmapi_allocate(args); 265 args->result = __xfs_bmapi_allocate(args);
275 complete(args->done); 266 complete(args->done);
276 267
277 current_restore_flags_nested(&pflags, new_pflags); 268 current_restore_flags_nested(&pflags, PF_FSTRANS);
278} 269}
279 270
280/* 271/*
@@ -293,7 +284,6 @@ xfs_bmapi_allocate(
293 284
294 285
295 args->done = &done; 286 args->done = &done;
296 args->kswapd = current_is_kswapd();
297 INIT_WORK_ONSTACK(&args->work, xfs_bmapi_allocate_worker); 287 INIT_WORK_ONSTACK(&args->work, xfs_bmapi_allocate_worker);
298 queue_work(xfs_alloc_wq, &args->work); 288 queue_work(xfs_alloc_wq, &args->work);
299 wait_for_completion(&done); 289 wait_for_completion(&done);
diff --git a/fs/xfs/xfs_bmap_util.h b/fs/xfs/xfs_bmap_util.h
index 075f72232a64..935ed2b24edf 100644
--- a/fs/xfs/xfs_bmap_util.h
+++ b/fs/xfs/xfs_bmap_util.h
@@ -50,13 +50,12 @@ struct xfs_bmalloca {
50 xfs_extlen_t total; /* total blocks needed for xaction */ 50 xfs_extlen_t total; /* total blocks needed for xaction */
51 xfs_extlen_t minlen; /* minimum allocation size (blocks) */ 51 xfs_extlen_t minlen; /* minimum allocation size (blocks) */
52 xfs_extlen_t minleft; /* amount must be left after alloc */ 52 xfs_extlen_t minleft; /* amount must be left after alloc */
53 bool eof; /* set if allocating past last extent */ 53 char eof; /* set if allocating past last extent */
54 bool wasdel; /* replacing a delayed allocation */ 54 char wasdel; /* replacing a delayed allocation */
55 bool userdata;/* set if is user data */ 55 char userdata;/* set if is user data */
56 bool aeof; /* allocated space at eof */ 56 char aeof; /* allocated space at eof */
57 bool conv; /* overwriting unwritten extents */ 57 char conv; /* overwriting unwritten extents */
58 bool stack_switch; 58 char stack_switch;
59 bool kswapd; /* allocation in kswapd context */
60 int flags; 59 int flags;
61 struct completion *done; 60 struct completion *done;
62 struct work_struct work; 61 struct work_struct work;