Commit 82e60d0
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
b8e24a9 ("block: annotate refault stalls from IO submission").
Link: https://lkml.kernel.org/r/[email protected]
Fixes: 4088a47 ("btrfs: add manual PSI accounting for compressed reads")
Fixes: 99486c5 ("erofs: add manual PSI accounting for the compressed address space")
Fixes: 118f366 ("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]>1 parent 8cccf05 commit 82e60d0
2 files changed
+19
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
512 | 512 | | |
513 | 513 | | |
514 | 514 | | |
515 | | - | |
| 515 | + | |
516 | 516 | | |
517 | 517 | | |
518 | 518 | | |
| |||
581 | 581 | | |
582 | 582 | | |
583 | 583 | | |
584 | | - | |
| 584 | + | |
585 | 585 | | |
| 586 | + | |
| 587 | + | |
586 | 588 | | |
587 | 589 | | |
588 | 590 | | |
| |||
670 | 672 | | |
671 | 673 | | |
672 | 674 | | |
673 | | - | |
674 | | - | |
| 675 | + | |
| 676 | + | |
675 | 677 | | |
676 | 678 | | |
677 | 679 | | |
| |||
727 | 729 | | |
728 | 730 | | |
729 | 731 | | |
730 | | - | |
| 732 | + | |
731 | 733 | | |
732 | 734 | | |
733 | 735 | | |
| |||
807 | 809 | | |
808 | 810 | | |
809 | 811 | | |
810 | | - | |
| 812 | + | |
811 | 813 | | |
812 | 814 | | |
813 | 815 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1412 | 1412 | | |
1413 | 1413 | | |
1414 | 1414 | | |
1415 | | - | |
1416 | | - | |
| 1415 | + | |
| 1416 | + | |
1417 | 1417 | | |
1418 | 1418 | | |
1419 | 1419 | | |
| |||
1463 | 1463 | | |
1464 | 1464 | | |
1465 | 1465 | | |
1466 | | - | |
1467 | | - | |
1468 | 1466 | | |
| 1467 | + | |
| 1468 | + | |
| 1469 | + | |
| 1470 | + | |
1469 | 1471 | | |
1470 | 1472 | | |
1471 | 1473 | | |
1472 | | - | |
| 1474 | + | |
1473 | 1475 | | |
| 1476 | + | |
| 1477 | + | |
1474 | 1478 | | |
1475 | 1479 | | |
1476 | 1480 | | |
| |||
1500 | 1504 | | |
1501 | 1505 | | |
1502 | 1506 | | |
1503 | | - | |
1504 | | - | |
1505 | 1507 | | |
| 1508 | + | |
| 1509 | + | |
1506 | 1510 | | |
1507 | 1511 | | |
1508 | 1512 | | |
| |||
0 commit comments