Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Dave Chinner and committed by
Dave Chinner
aa182e64 a497c3ba

+9 -20
+3 -13
fs/xfs/xfs_bmap_util.c
··· 258 258 struct xfs_bmalloca *args = container_of(work, 259 259 struct xfs_bmalloca, work); 260 260 unsigned long pflags; 261 - unsigned long new_pflags = PF_FSTRANS; 262 261 263 - /* 264 - * we are in a transaction context here, but may also be doing work 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); 262 + /* we are in a transaction context here */ 263 + current_set_flags_nested(&pflags, PF_FSTRANS); 273 264 274 265 args->result = __xfs_bmapi_allocate(args); 275 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 /* ··· 284 293 285 294 286 295 args->done = &done; 287 - args->kswapd = current_is_kswapd(); 288 296 INIT_WORK_ONSTACK(&args->work, xfs_bmapi_allocate_worker); 289 297 queue_work(xfs_alloc_wq, &args->work); 290 298 wait_for_completion(&done);
+6 -7
fs/xfs/xfs_bmap_util.h
··· 50 50 xfs_extlen_t total; /* total blocks needed for xaction */ 51 51 xfs_extlen_t minlen; /* minimum allocation size (blocks) */ 52 52 xfs_extlen_t minleft; /* amount must be left after alloc */ 53 - bool eof; /* set if allocating past last extent */ 54 - bool wasdel; /* replacing a delayed allocation */ 55 - bool userdata;/* set if is user data */ 56 - bool aeof; /* allocated space at eof */ 57 - bool conv; /* overwriting unwritten extents */ 58 - bool stack_switch; 59 - bool kswapd; /* allocation in kswapd context */ 53 + char eof; /* set if allocating past last extent */ 54 + char wasdel; /* replacing a delayed allocation */ 55 + char userdata;/* set if is user data */ 56 + char aeof; /* allocated space at eof */ 57 + char conv; /* overwriting unwritten extents */ 58 + char stack_switch; 60 59 int flags; 61 60 struct completion *done; 62 61 struct work_struct work;