Commit 4b5d1e4
zsmalloc: fix races between modifications of fullness and isolated
We encountered many kernel exceptions of VM_BUG_ON(zspage->isolated ==
0) in dec_zspage_isolation() and BUG_ON(!pages[1]) in zs_unmap_object()
lately. This issue only occurs when migration and reclamation occur at
the same time.
With our memory stress test, we can reproduce this issue several times
a day. We have no idea why no one else encountered this issue. BTW,
we switched to the new kernel version with this defect a few months
ago.
Since fullness and isolated share the same unsigned int, modifications of
them should be protected by the same lock.
[andrew.yang@mediatek.com: move comment]
Link: https://lkml.kernel.org/r/20230727062910.6337-1-andrew.yang@mediatek.com
Link: https://lkml.kernel.org/r/20230721063705.11455-1-andrew.yang@mediatek.com
Fixes: c4549b8 ("zsmalloc: remove zspage isolation for migration")
Signed-off-by: Andrew Yang <andrew.yang@mediatek.com>
Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Cc: Matthias Brugger <matthias.bgg@gmail.com>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>1 parent 5d0c230 commit 4b5d1e4
1 file changed
Lines changed: 9 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1798 | 1798 | | |
1799 | 1799 | | |
1800 | 1800 | | |
| 1801 | + | |
1801 | 1802 | | |
1802 | 1803 | | |
1803 | 1804 | | |
| |||
1807 | 1808 | | |
1808 | 1809 | | |
1809 | 1810 | | |
1810 | | - | |
| 1811 | + | |
| 1812 | + | |
1811 | 1813 | | |
1812 | | - | |
| 1814 | + | |
1813 | 1815 | | |
1814 | 1816 | | |
1815 | 1817 | | |
| |||
1875 | 1877 | | |
1876 | 1878 | | |
1877 | 1879 | | |
| 1880 | + | |
1878 | 1881 | | |
1879 | 1882 | | |
1880 | 1883 | | |
1881 | 1884 | | |
1882 | 1885 | | |
1883 | | - | |
1884 | 1886 | | |
1885 | 1887 | | |
1886 | 1888 | | |
| |||
1897 | 1899 | | |
1898 | 1900 | | |
1899 | 1901 | | |
| 1902 | + | |
1900 | 1903 | | |
1901 | 1904 | | |
1902 | 1905 | | |
1903 | 1906 | | |
1904 | 1907 | | |
1905 | | - | |
| 1908 | + | |
| 1909 | + | |
1906 | 1910 | | |
1907 | | - | |
| 1911 | + | |
1908 | 1912 | | |
1909 | 1913 | | |
1910 | 1914 | | |
| |||
0 commit comments