linux/Documentation/admin-guide/blockdev
Sergey Senozhatsky 58652f2b6d zram: permit only one post-processing operation at a time
Both recompress and writeback soon will unlock slots during processing,
which makes things too complex wrt possible race-conditions.  We still
want to clear PP_SLOT in slot_free, because this is how we figure out that
slot that was selected for post-processing has been released under us and
when we start post-processing we check if slot still has PP_SLOT set.  At
the same time, theoretically, we can have something like this:

CPU0			    CPU1

recompress
scan slots
set PP_SLOT
unlock slot
			slot_free
			clear PP_SLOT

			allocate PP_SLOT
			writeback
			scan slots
			set PP_SLOT
			unlock slot
select PP-slot
test PP_SLOT

So recompress will not detect that slot has been re-used and re-selected
for concurrent writeback post-processing.

Make sure that we only permit on post-processing operation at a time.  So
now recompress and writeback post-processing don't race against each
other, we only need to handle slot re-use (slot_free and write), which is
handled individually by each pp operation.

Having recompress and writeback competing for the same slots is not
exactly good anyway (can't imagine anyone doing that).

Link: https://lkml.kernel.org/r/20240917021020.883356-3-senozhatsky@chromium.org
Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: Minchan Kim <minchan@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2024-11-05 16:56:22 -08:00
..
drbd docs: admin-guide/blockdev: Remove digraph of node-states 2021-11-29 14:39:43 -07:00
floppy.rst Replace HTTP links with HTTPS ones: DRBD driver 2020-07-05 14:16:44 -06:00
index.rst docs: blockdev: change title to match section content 2022-06-01 09:30:53 -06:00
nbd.rst docs nbd: userspace NBD now favors github over sourceforge 2023-04-27 19:15:11 -06:00
paride.rst drivers/block: Remove PARIDE core and high-level protocols 2023-01-31 10:41:32 +09:00
ramdisk.rst Documentation/admin-guide: blockdev/ramdisk: remove use of "rdev" 2020-09-24 10:50:31 -06:00
zram.rst zram: permit only one post-processing operation at a time 2024-11-05 16:56:22 -08:00