Revision 2395928158059b8f9858365fce7713ce7fef62e4 authored by Rokudo Yan on 26 February 2021, 01:18:31 UTC, committed by Linus Torvalds on 26 February 2021, 17:41:01 UTC
There exists multiple path may do zram compaction concurrently. 1. auto-compaction triggered during memory reclaim 2. userspace utils write zram<id>/compaction node So, multiple threads may call zs_shrinker_scan/zs_compact concurrently. But pages_compacted is a per zsmalloc pool variable and modification of the variable is not serialized(through under class->lock). There are two issues here: 1. the pages_compacted may not equal to total number of pages freed(due to concurrently add). 2. zs_shrinker_scan may not return the correct number of pages freed(issued by current shrinker). The fix is simple: 1. account the number of pages freed in zs_compact locally. 2. use actomic variable pages_compacted to accumulate total number. Link: https://lkml.kernel.org/r/20210202122235.26885-1-wu-yan@tcl.com Fixes: 860c707dca155a56 ("zsmalloc: account the number of compacted pages") Signed-off-by: Rokudo Yan <wu-yan@tcl.com> Cc: Minchan Kim <minchan@kernel.org> Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com> Cc: <stable@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent f023130
File | Mode | Size |
---|---|---|
mpu401 | ||
opl3 | ||
opl4 | ||
pcsp | ||
vx | ||
Kconfig | -rw-r--r-- | 6.9 KB |
Makefile | -rw-r--r-- | 714 bytes |
aloop.c | -rw-r--r-- | 51.7 KB |
dummy.c | -rw-r--r-- | 31.0 KB |
mtpav.c | -rw-r--r-- | 19.1 KB |
mts64.c | -rw-r--r-- | 25.5 KB |
portman2x4.c | -rw-r--r-- | 24.4 KB |
serial-u16550.c | -rw-r--r-- | 30.0 KB |
virmidi.c | -rw-r--r-- | 4.8 KB |
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...