FlawAtlas
Search the atlas
UBUNTU-CVE-2026-23157 Moderate

UBUNTU-CVE-2026-23157

In the Linux kernel, the following vulnerability has been resolved: btrfs: do not strictly require dirty metadata threshold for metadata writepages [BUG] There is an internal report that over 1000 processes are waiting at the io_schedule_timeout() of balance_dirty_pages(), causing a system hang and trigger a kernel coredump. The kernel is v6.4 kernel based, but the root problem still applies to any upstream kernel before v6.18. [CAUSE] From Jan Kara for his wisdom on the dirty page balance behavior first. This cgroup dirty limit was what was actually playing the role here because the cgroup had only a small amount of memory and so the dirty limit for it was something like 16MB. Dirty throttling is responsible for enforcing that nobody can dirty (significantly) more dirty memory than there's dirty limit. Thus when a task is dirtying pages it periodically enters into balance_dirty_pages() and we let it sleep there to slow down the dirtying. When the system is over dirty limit already (either globally or within a cgroup of the running task), we will not let the task exit from balance_dirty_pages() until the number of dirty pages drops below the limit. So in this particular case, as I already mentioned, there was a cgroup with relatively small amount of memory and as a result with dirty limit set at 16MB. A task from that cgroup has dirtied about 28MB worth of pages in btrfs btree inode and these were practically the only dirty pages in that cgroup. So that means the only way to reduce the dirty pages of that cgroup is to writeback the dirty pages of btrfs btree inode, and only after that those processes can exit balance_dirty_pages(). Now back to the btrfs part, btree_writepages() is responsible for writing back dirty btree inode pages. The problem here is, there is a btrfs internal threshold that if the btree inode's dirty bytes are below the 32M threshold, it will not do any writeback. This behavior is to batch as much metadata as possible so we won't write back those tree blocks and then later re-COW them again for another modification. This internal 32MiB is higher than the existing dirty page size (28MiB), meaning no writeback will happen, causing a deadlock between btrfs and cgroup: - Btrfs doesn't want to write back btree inode until more dirty pages - Cgroup/MM doesn't want more dirty pages for btrfs btree inode Thus any process touching that btree inode is put into sleep until the number of dirty pages is reduced. Thanks Jan Kara a lot for the analysis of the root cause. [ENHANCEMENT] Since kernel commit b55102826d7d ("btrfs: set AS_KERNEL_FILE on the btree_inode"), btrfs btree inode pages will only be charged to the root cgroup which should have a much larger limit than btrfs' 32MiB threshold. So it should not affect newer kernels. But for all current LTS kernels, they are all affected by this problem, and backporting the whole AS_KERNEL_FILE may not be a good idea. Even for newer kernels I still think it's a good idea to get rid of the internal threshold at btree_writepages(), since for most cases cgroup/MM has a better view of full system memory usage than btrfs' fixed threshold. For internal callers using btrfs_btree_balance_dirty() since that function is already doing internal threshold check, we don't need to bother them. But for external callers of btree_writepages(), just respect their requests and write back whatever they want, ignoring the internal btrfs threshold to avoid such deadlock on btree inode dirty page balancing.

Exploit probability Not scored
Published February 14, 2026
Required by Not available
Last source change August 19, 2026

02 / AFFECTED SOFTWARE

Affected packages

Ubuntu:22.04:LTS linux-hwe-5.19

11 explicit affected versions

Ubuntu:22.04:LTS linux-nvidia-6.2

7 explicit affected versions

Ubuntu:18.04:LTS linux-aws-5.0

6 explicit affected versions

Ubuntu:Pro:20.04:LTS linux-azure-fde-5.15

59 explicit affected versions

Ubuntu:22.04:LTS linux-starfive-6.5

11 explicit affected versions

Ubuntu:Pro:20.04:LTS linux-iot

53 explicit affected versions

Ubuntu:Pro:20.04:LTS linux-azure

116 explicit affected versions

Ubuntu:22.04:LTS linux-ibm

87 explicit affected versions

Ubuntu:18.04:LTS linux-oem

50 explicit affected versions

Ubuntu:20.04:LTS linux-aws-5.11

12 explicit affected versions

Ubuntu:22.04:LTS linux-oem-6.5

19 explicit affected versions

Ubuntu:24.04:LTS linux-hwe-6.14

10 explicit affected versions

Ubuntu:20.04:LTS linux-raspi2

6 explicit affected versions

Ubuntu:22.04:LTS linux

97 explicit affected versions

Ubuntu:24.04:LTS linux-riscv

24 explicit affected versions

Ubuntu:22.04:LTS linux-gkeop

82 explicit affected versions

Ubuntu:Pro:20.04:LTS linux-lowlatency-hwe-5.15

83 explicit affected versions

Ubuntu:Pro:FIPS-updates:20.04:LTS linux-fips

91 explicit affected versions

Ubuntu:22.04:LTS linux-azure

84 explicit affected versions

Ubuntu:Pro:20.04:LTS linux-gcp-5.15

76 explicit affected versions

Ubuntu:22.04:LTS linux-riscv-6.5

10 explicit affected versions

Ubuntu:22.04:LTS linux-ibm-6.8

37 explicit affected versions

Ubuntu:Pro:18.04:LTS linux

154 explicit affected versions

Ubuntu:24.04:LTS linux-oem-6.8

26 explicit affected versions

Ubuntu:22.04:LTS linux-gke

89 explicit affected versions

Ubuntu:Pro:14.04:LTS linux

191 explicit affected versions

Ubuntu:22.04:LTS linux-azure-5.19

7 explicit affected versions

Ubuntu:22.04:LTS linux-raspi

84 explicit affected versions

Ubuntu:22.04:LTS linux-oracle-6.8

40 explicit affected versions

Ubuntu:22.04:LTS linux-gcp-6.5

13 explicit affected versions

Ubuntu:Pro:FIPS-updates:18.04:LTS linux-azure-fips

85 explicit affected versions

Ubuntu:24.04:LTS linux-nvidia

44 explicit affected versions

Ubuntu:20.04:LTS linux-oem-5.14

35 explicit affected versions

Ubuntu:Pro:FIPS-updates:22.04:LTS linux-gcp-fips

49 explicit affected versions

Ubuntu:22.04:LTS linux-nvidia-tegra

47 explicit affected versions

Ubuntu:22.04:LTS linux-lowlatency-hwe-5.19

10 explicit affected versions

Ubuntu:20.04:LTS linux-gke-5.15

18 explicit affected versions

Ubuntu:Pro:FIPS-updates:22.04:LTS linux-azure-fips

40 explicit affected versions

Ubuntu:Pro:18.04:LTS linux-oracle

118 explicit affected versions

Ubuntu:22.04:LTS linux-azure-fde

62 explicit affected versions

Ubuntu:24.04:LTS linux-oracle

45 explicit affected versions

Ubuntu:Pro:18.04:LTS linux-hwe-5.4

120 explicit affected versions

Ubuntu:20.04:LTS linux-aws-5.13

13 explicit affected versions

Ubuntu:20.04:LTS linux-aws-5.8

4 explicit affected versions

Ubuntu:Pro:16.04:LTS linux-kvm

121 explicit affected versions

Ubuntu:16.04:LTS linux-hwe-edge

23 explicit affected versions

Ubuntu:24.04:LTS linux

52 explicit affected versions

Ubuntu:Pro:20.04:LTS linux-gcp

124 explicit affected versions

Ubuntu:Pro:FIPS:18.04:LTS linux-gcp-fips

1 explicit affected versions

Ubuntu:24.04:LTS linux-raspi-realtime

1 explicit affected versions

Ubuntu:20.04:LTS linux-hwe-5.8

21 explicit affected versions

Ubuntu:22.04:LTS linux-azure-fde-6.8

7 explicit affected versions

Ubuntu:20.04:LTS linux-hwe-5.13

16 explicit affected versions

Ubuntu:22.04:LTS linux-lowlatency-hwe-6.2

10 explicit affected versions

Ubuntu:25.10 linux

20 explicit affected versions

Ubuntu:Pro:FIPS-updates:20.04:LTS linux-aws-fips

76 explicit affected versions

Ubuntu:Pro:FIPS:18.04:LTS linux-aws-fips

1 explicit affected versions

Ubuntu:22.04:LTS linux-nvidia-tegra-igx

43 explicit affected versions

Ubuntu:24.04:LTS linux-aws

48 explicit affected versions

Ubuntu:24.04:LTS linux-hwe-6.11

8 explicit affected versions

Ubuntu:18.04:LTS linux-oracle-5.0

7 explicit affected versions

Ubuntu:20.04:LTS linux-riscv

12 explicit affected versions

Ubuntu:24.04:LTS linux-oracle-6.14

11 explicit affected versions

Ubuntu:Pro:16.04:LTS linux-oracle

111 explicit affected versions

Ubuntu:22.04:LTS linux-intel-iot-realtime

1 explicit affected versions

Ubuntu:24.04:LTS linux-azure-6.11

7 explicit affected versions

Ubuntu:20.04:LTS linux-gcp-5.11

12 explicit affected versions

Ubuntu:22.04:LTS linux-azure-6.5

14 explicit affected versions

Ubuntu:25.10 linux-azure-fde

10 explicit affected versions

Ubuntu:20.04:LTS linux-intel-5.13

7 explicit affected versions

Ubuntu:24.04:LTS linux-nvidia-tegra

17 explicit affected versions

Ubuntu:Pro:18.04:LTS linux-azure-5.4

104 explicit affected versions

Ubuntu:20.04:LTS linux-oem-5.13

12 explicit affected versions

Ubuntu:24.04:LTS linux-oracle-6.17

8 explicit affected versions

Ubuntu:Pro:20.04:LTS linux-raspi

105 explicit affected versions

Ubuntu:20.04:LTS linux-oracle-5.11

12 explicit affected versions

Ubuntu:Pro:Realtime:22.04:LTS linux-realtime-6.8

41 explicit affected versions

Ubuntu:Pro:14.04:LTS linux-aws

120 explicit affected versions

Ubuntu:Pro:FIPS:20.04:LTS linux-fips

1 explicit affected versions

Ubuntu:24.04:LTS linux-oem-6.14

16 explicit affected versions

Ubuntu:25.10 linux-gcp

17 explicit affected versions

Ubuntu:22.04:LTS linux-azure-6.8

27 explicit affected versions

Ubuntu:24.04:LTS linux-gkeop

34 explicit affected versions

Ubuntu:22.04:LTS linux-lowlatency

95 explicit affected versions

Ubuntu:18.04:LTS linux-hwe-edge

10 explicit affected versions

Ubuntu:18.04:LTS linux-gke-5.4

37 explicit affected versions

Ubuntu:24.04:LTS linux-azure-nvidia

10 explicit affected versions

Ubuntu:24.04:LTS linux-gcp-6.17

9 explicit affected versions

Ubuntu:22.04:LTS linux-oracle-6.5

13 explicit affected versions

Ubuntu:22.04:LTS linux-lowlatency-hwe-6.8

39 explicit affected versions

Ubuntu:24.04:LTS linux-azure-nvidia-6.14

3 explicit affected versions

Ubuntu:22.04:LTS linux-azure-fde-6.2

10 explicit affected versions

Ubuntu:24.04:LTS linux-gcp-6.14

11 explicit affected versions

Ubuntu:Pro:Realtime:22.04:LTS linux-intel-iot-realtime

65 explicit affected versions

Ubuntu:Pro:FIPS:20.04:LTS linux-aws-fips

1 explicit affected versions

Ubuntu:20.04:LTS linux-oem-5.10

26 explicit affected versions

Ubuntu:Pro:FIPS-updates:24.04:LTS linux-azure-fips

10 explicit affected versions

Ubuntu:20.04:LTS linux-gcp-5.13

13 explicit affected versions

Ubuntu:Pro:16.04:LTS linux-aws

144 explicit affected versions

Ubuntu:22.04:LTS linux-xilinx-zynqmp

34 explicit affected versions

Ubuntu:Pro:FIPS:18.04:LTS linux-fips

1 explicit affected versions

Ubuntu:20.04:LTS linux-oem-5.6

29 explicit affected versions

Ubuntu:Pro:18.04:LTS linux-gcp-5.4

111 explicit affected versions

Ubuntu:18.04:LTS linux-gcp-5.3

13 explicit affected versions

Ubuntu:24.04:LTS linux-riscv-6.14

12 explicit affected versions

Ubuntu:24.04:LTS linux-nvidia-lowlatency

41 explicit affected versions

Ubuntu:22.04:LTS linux-gcp-6.8

40 explicit affected versions

Ubuntu:24.04:LTS linux-riscv-6.17

8 explicit affected versions

Ubuntu:Pro:FIPS:18.04:LTS linux-azure-fips

1 explicit affected versions

Ubuntu:Pro:18.04:LTS linux-raspi-5.4

100 explicit affected versions

Ubuntu:22.04:LTS linux-aws

89 explicit affected versions

Ubuntu:Pro:FIPS-updates:22.04:LTS linux-aws-fips

52 explicit affected versions

Ubuntu:18.04:LTS linux-gke-4.15

33 explicit affected versions

Ubuntu:22.04:LTS linux-riscv

23 explicit affected versions

Ubuntu:Pro:20.04:LTS linux-ibm-5.15

58 explicit affected versions

Ubuntu:18.04:LTS linux-aws-5.3

10 explicit affected versions

Ubuntu:Pro:FIPS-updates:24.04:LTS linux-fips

20 explicit affected versions

Ubuntu:Pro:16.04:LTS linux

188 explicit affected versions

Ubuntu:Pro:FIPS-updates:24.04:LTS linux-gcp-fips

19 explicit affected versions

Ubuntu:20.04:LTS linux-azure-5.8

7 explicit affected versions

Ubuntu:Nvidia-BlueField:24.04:LTS linux-bluefield

11 explicit affected versions

Ubuntu:24.04:LTS linux-azure-fde-6.14

5 explicit affected versions

Ubuntu:20.04:LTS linux-hwe-5.11

12 explicit affected versions

Ubuntu:Pro:Realtime:24.04:LTS linux-realtime-6.17

9 explicit affected versions

Ubuntu:22.04:LTS linux-gcp-6.2

12 explicit affected versions

Ubuntu:24.04:LTS linux-hwe-6.17

8 explicit affected versions

Ubuntu:25.10 linux-azure

16 explicit affected versions

Ubuntu:Pro:16.04:LTS linux-gcp

138 explicit affected versions

Ubuntu:Pro:FIPS:16.04:LTS linux-fips

2 explicit affected versions

Ubuntu:24.04:LTS linux-azure-6.14

5 explicit affected versions

Ubuntu:22.04:LTS linux-nvidia

74 explicit affected versions

Ubuntu:Pro:18.04:LTS linux-kvm

132 explicit affected versions

Ubuntu:22.04:LTS linux-oracle

90 explicit affected versions

Ubuntu:Pro:14.04:LTS linux-lts-xenial

165 explicit affected versions

Ubuntu:22.04:LTS linux-oem-5.17

26 explicit affected versions

Ubuntu:24.04:LTS linux-azure

39 explicit affected versions

Ubuntu:Pro:FIPS-preview:22.04:LTS linux-azure-fips

1 explicit affected versions

Ubuntu:Pro:20.04:LTS linux-intel-iotg-5.15

66 explicit affected versions

Ubuntu:24.04:LTS linux-ibm

46 explicit affected versions

Ubuntu:22.04:LTS linux-hwe-6.8

35 explicit affected versions

Ubuntu:24.04:LTS linux-raspi

48 explicit affected versions

Ubuntu:24.04:LTS linux-aws-6.14

11 explicit affected versions

Ubuntu:24.04:LTS linux-aws-6.17

10 explicit affected versions

Ubuntu:22.04:LTS linux-azure-6.2

13 explicit affected versions

Ubuntu:Pro:18.04:LTS linux-aws

139 explicit affected versions

Ubuntu:Pro:18.04:LTS linux-ibm-5.4

78 explicit affected versions

Ubuntu:22.04:LTS linux-oem-6.0

16 explicit affected versions

Ubuntu:22.04:LTS linux-kvm

88 explicit affected versions

Ubuntu:Pro:FIPS:20.04:LTS linux-azure-fips

1 explicit affected versions

Ubuntu:24.04:LTS linux-gcp

50 explicit affected versions

Ubuntu:Pro:16.04:LTS linux-aws-hwe

116 explicit affected versions

Ubuntu:22.04:LTS linux-azure-fde-5.19

3 explicit affected versions

Ubuntu:Pro:20.04:LTS linux

132 explicit affected versions

Ubuntu:Pro:18.04:LTS linux-gcp-4.15

93 explicit affected versions

Ubuntu:24.04:LTS linux-gcp-6.11

7 explicit affected versions

Ubuntu:Pro:FIPS-preview:22.04:LTS linux-aws-fips

2 explicit affected versions

Ubuntu:25.10 linux-riscv

15 explicit affected versions

Ubuntu:20.04:LTS linux-gke

51 explicit affected versions

Ubuntu:25.10 linux-oracle

16 explicit affected versions

Ubuntu:Pro:18.04:LTS linux-azure-4.15

92 explicit affected versions

Ubuntu:22.04:LTS linux-intel-iotg

77 explicit affected versions

Ubuntu:24.04:LTS linux-oem-6.11

18 explicit affected versions

Ubuntu:Pro:Realtime:24.04:LTS linux-raspi-realtime

43 explicit affected versions

Ubuntu:20.04:LTS linux-azure-5.13

12 explicit affected versions

Ubuntu:Pro:20.04:LTS linux-azure-5.15

70 explicit affected versions

Ubuntu:22.04:LTS linux-riscv-5.19

8 explicit affected versions

Ubuntu:24.04:LTS linux-nvidia-6.17

7 explicit affected versions

Ubuntu:22.04:LTS linux-oem-6.1

27 explicit affected versions

Ubuntu:Nvidia-BlueField:22.04:LTS linux-bluefield

63 explicit affected versions

Ubuntu:Pro:20.04:LTS linux-oracle

121 explicit affected versions

Ubuntu:Pro:FIPS-updates:18.04:LTS linux-fips

98 explicit affected versions

Ubuntu:22.04:LTS linux-nvidia-6.8

43 explicit affected versions

Ubuntu:22.04:LTS linux-gcp-5.19

8 explicit affected versions

Ubuntu:Pro:FIPS-updates:22.04:LTS linux-fips

54 explicit affected versions

Ubuntu:20.04:LTS linux-oracle-5.8

5 explicit affected versions

Ubuntu:Pro:FIPS:20.04:LTS linux-gcp-fips

1 explicit affected versions

Ubuntu:22.04:LTS linux-hwe-6.2

10 explicit affected versions

Ubuntu:24.04:LTS linux-lowlatency-hwe-6.11

7 explicit affected versions

Ubuntu:Pro:Realtime:24.04:LTS linux-realtime

46 explicit affected versions

Ubuntu:22.04:LTS linux-lowlatency-hwe-6.5

13 explicit affected versions

Ubuntu:Pro:18.04:LTS linux-oracle-5.4

110 explicit affected versions

Ubuntu:20.04:LTS linux-azure-5.11

13 explicit affected versions

Ubuntu:Pro:FIPS-updates:20.04:LTS linux-azure-fips

72 explicit affected versions

Ubuntu:22.04:LTS linux-starfive-5.19

7 explicit affected versions

Ubuntu:Pro:16.04:LTS linux-azure

140 explicit affected versions

Ubuntu:24.04:LTS linux-nvidia-6.11

8 explicit affected versions

Ubuntu:Pro:FIPS-updates:18.04:LTS linux-aws-fips

94 explicit affected versions

Ubuntu:20.04:LTS linux-riscv-5.8

10 explicit affected versions

Ubuntu:20.04:LTS linux-oracle-5.13

12 explicit affected versions

Ubuntu:Pro:Realtime:24.04:LTS linux-realtime-6.14

9 explicit affected versions

Ubuntu:Pro:16.04:LTS linux-hwe

167 explicit affected versions

Ubuntu:Pro:20.04:LTS linux-nvidia-tegra-5.15

36 explicit affected versions

Ubuntu:Pro:18.04:LTS linux-aws-5.4

108 explicit affected versions

Ubuntu:Pro:20.04:LTS linux-bluefield

80 explicit affected versions

Ubuntu:Pro:20.04:LTS linux-xilinx-zynqmp

56 explicit affected versions

Ubuntu:18.04:LTS linux-azure

44 explicit affected versions

Ubuntu:18.04:LTS linux-azure-5.3

16 explicit affected versions

Ubuntu:22.04:LTS linux-starfive-6.2

3 explicit affected versions

Ubuntu:20.04:LTS linux-riscv-5.11

13 explicit affected versions

Ubuntu:20.04:LTS linux-azure-fde

26 explicit affected versions

Ubuntu:20.04:LTS linux-gkeop-5.15

45 explicit affected versions

Ubuntu:18.04:LTS linux-oracle-5.3

9 explicit affected versions

Ubuntu:25.10 linux-aws

17 explicit affected versions

Ubuntu:18.04:LTS linux-gkeop-5.4

37 explicit affected versions

Ubuntu:24.04:LTS linux-lowlatency

50 explicit affected versions

Ubuntu:22.04:LTS linux-aws-6.5

14 explicit affected versions

Ubuntu:18.04:LTS linux-gcp

38 explicit affected versions

Ubuntu:22.04:LTS linux-riscv-6.8

39 explicit affected versions

Ubuntu:24.04:LTS linux-xilinx

18 explicit affected versions

Ubuntu:25.10 linux-raspi

14 explicit affected versions

Ubuntu:22.04:LTS linux-gcp

90 explicit affected versions

Ubuntu:24.04:LTS linux-azure-fde

6 explicit affected versions

Ubuntu:Pro:FIPS:16.04:LTS linux-fips

97 explicit affected versions

Ubuntu:Pro:14.04:LTS linux-azure

121 explicit affected versions

Ubuntu:20.04:LTS linux-gcp-5.8

4 explicit affected versions

Ubuntu:Pro:20.04:LTS linux-riscv-5.15

79 explicit affected versions

Ubuntu:24.04:LTS linux-azure-6.17

8 explicit affected versions

Ubuntu:24.04:LTS linux-realtime

1 explicit affected versions

Ubuntu:Pro:FIPS-preview:22.04:LTS linux-fips

1 explicit affected versions

Ubuntu:Pro:FIPS-preview:22.04:LTS linux-gcp-fips

1 explicit affected versions

Ubuntu:Pro:Realtime:22.04:LTS linux-realtime

88 explicit affected versions

Ubuntu:Pro:20.04:LTS linux-hwe-5.15

78 explicit affected versions

Ubuntu:Pro:20.04:LTS linux-aws-5.15

78 explicit affected versions

Ubuntu:22.04:LTS linux-hwe-6.5

13 explicit affected versions

Ubuntu:18.04:LTS linux-hwe

43 explicit affected versions

Ubuntu:Pro:FIPS-updates:20.04:LTS linux-gcp-fips

77 explicit affected versions

Ubuntu:24.04:LTS linux-oem-6.17

14 explicit affected versions

Ubuntu:Pro:20.04:LTS linux-kvm

119 explicit affected versions

Ubuntu:22.04:LTS linux-aws-5.19

10 explicit affected versions

Ubuntu:22.04:LTS linux-allwinner-5.19

8 explicit affected versions

Ubuntu:24.04:LTS linux-gke

45 explicit affected versions

Ubuntu:Pro:20.04:LTS linux-ibm

88 explicit affected versions

Ubuntu:22.04:LTS linux-aws-6.2

14 explicit affected versions

Ubuntu:18.04:LTS linux-azure-edge

4 explicit affected versions

Ubuntu:20.04:LTS linux-gkeop

78 explicit affected versions

Ubuntu:25.10 linux-realtime

14 explicit affected versions

Ubuntu:22.04:LTS linux-nvidia-6.5

11 explicit affected versions

Ubuntu:22.04:LTS linux-realtime

1 explicit affected versions

Ubuntu:Pro:FIPS-updates:18.04:LTS linux-gcp-fips

69 explicit affected versions

Ubuntu:Pro:20.04:LTS linux-aws

123 explicit affected versions

Ubuntu:Pro:FIPS-updates:24.04:LTS linux-aws-fips

19 explicit affected versions

Ubuntu:22.04:LTS linux-aws-6.8

39 explicit affected versions

Ubuntu:Pro:20.04:LTS linux-oracle-5.15

77 explicit affected versions

03 / CONNECTIONS

Connected vulnerabilities

related USN-8595-2
related USN-8608-1
related USN-8609-1

04 / EVIDENCE

Source records

Open Source Vulnerabilities UBUNTU-CVE-2026-23157

In the Linux kernel, the following vulnerability has been resolved: btrfs: do not strictly require dirty metadata threshold for metadata writepages [BUG] There is an internal report that over 1000 processes are waiting at the io_schedule_timeout() of balance_dirty_pages(), causing a system hang and trigger a kernel coredump. The kernel is v6.4 kernel based, but the root problem still applies to any upstream kernel before v6.18. [CAUSE] From Jan Kara for his wisdom on the dirty page balance behavior first. This cgroup dirty limit was what was actually playing the role here because the cgroup had only a small amount of memory and so the dirty limit for it was something like 16MB. Dirty throttling is responsible for enforcing that nobody can dirty (significantly) more dirty memory than there's dirty limit. Thus when a task is dirtying pages it periodically enters into balance_dirty_pages() and we let it sleep there to slow down the dirtying. When the system is over dirty limit already (either globally or within a cgroup of the running task), we will not let the task exit from balance_dirty_pages() until the number of dirty pages drops below the limit. So in this particular case, as I already mentioned, there was a cgroup with relatively small amount of memory and as a result with dirty limit set at 16MB. A task from that cgroup has dirtied about 28MB worth of pages in btrfs btree inode and these were practically the only dirty pages in that cgroup. So that means the only way to reduce the dirty pages of that cgroup is to writeback the dirty pages of btrfs btree inode, and only after that those processes can exit balance_dirty_pages(). Now back to the btrfs part, btree_writepages() is responsible for writing back dirty btree inode pages. The problem here is, there is a btrfs internal threshold that if the btree inode's dirty bytes are below the 32M threshold, it will not do any writeback. This behavior is to batch as much metadata as possible so we won't write back those tree blocks and then later re-COW them again for another modification. This internal 32MiB is higher than the existing dirty page size (28MiB), meaning no writeback will happen, causing a deadlock between btrfs and cgroup: - Btrfs doesn't want to write back btree inode until more dirty pages - Cgroup/MM doesn't want more dirty pages for btrfs btree inode Thus any process touching that btree inode is put into sleep until the number of dirty pages is reduced. Thanks Jan Kara a lot for the analysis of the root cause. [ENHANCEMENT] Since kernel commit b55102826d7d ("btrfs: set AS_KERNEL_FILE on the btree_inode"), btrfs btree inode pages will only be charged to the root cgroup which should have a much larger limit than btrfs' 32MiB threshold. So it should not affect newer kernels. But for all current LTS kernels, they are all affected by this problem, and backporting the whole AS_KERNEL_FILE may not be a good idea. Even for newer kernels I still think it's a good idea to get rid of the internal threshold at btree_writepages(), since for most cases cgroup/MM has a better view of full system memory usage than btrfs' fixed threshold. For internal callers using btrfs_btree_balance_dirty() since that function is already doing internal threshold check, we don't need to bother them. But for external callers of btree_writepages(), just respect their requests and write back whatever they want, ignoring the internal btrfs threshold to avoid such deadlock on btree inode dirty page balancing.

View original source

05 / REFERENCES

Further evidence