diff options
author | Johannes Weiner <[email protected]> | 2022-11-03 17:34:31 -0400 |
---|---|---|
committer | Andrew Morton <[email protected]> | 2022-11-08 15:57:25 -0800 |
commit | 82e60d00b753bb5cfecce22b8e952436b14d02a3 (patch) | |
tree | 631fb24b9dcf69eb3010c2f05d2098f46f827abf /lib/memory-notifier-error-inject.c | |
parent | 8cccf05fe857a18ee26e20d11a8455a73ffd4efd (diff) |
fs: fix leaked psi pressure state
When psi annotations were added to to btrfs compression reads, the psi
state tracking over add_ra_bio_pages and btrfs_submit_compressed_read was
faulty. A pressure state, once entered, is never left. This results in
incorrectly elevated pressure, which triggers OOM kills.
pflags record the *previous* memstall state when we enter a new one. The
code tried to initialize pflags to 1, and then optimize the leave call
when we either didn't enter a memstall, or were already inside a nested
stall. However, there can be multiple PageWorkingset pages in the bio, at
which point it's that path itself that enters repeatedly and overwrites
pflags. This causes us to miss the exit.
Enter the stall only once if needed, then unwind correctly.
erofs has the same problem, fix that up too. And move the memstall exit
past submit_bio() to restore submit accounting originally added by
b8e24a9300b0 ("block: annotate refault stalls from IO submission").
Link: https://lkml.kernel.org/r/[email protected]
Fixes: 4088a47e78f9 ("btrfs: add manual PSI accounting for compressed reads")
Fixes: 99486c511f68 ("erofs: add manual PSI accounting for the compressed address space")
Fixes: 118f3663fbc6 ("block: remove PSI accounting from the bio layer")
Link: https://lore.kernel.org/r/[email protected]/
Signed-off-by: Johannes Weiner <[email protected]>
Reported-by: Thorsten Leemhuis <[email protected]>
Tested-by: Thorsten Leemhuis <[email protected]>
Cc: Chao Yu <[email protected]>
Cc: Chris Mason <[email protected]>
Cc: Christoph Hellwig <[email protected]>
Cc: David Sterba <[email protected]>
Cc: Gao Xiang <[email protected]>
Cc: Jens Axboe <[email protected]>
Cc: Josef Bacik <[email protected]>
Cc: Suren Baghdasaryan <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Diffstat (limited to 'lib/memory-notifier-error-inject.c')
0 files changed, 0 insertions, 0 deletions