Document streaming parameter as a strict 0 or 1 value

This commit is contained in:
Andrea Mazzoleni 2026-09-16 08:39:22 +02:00
parent de00981504
commit bfe5ee7643
5 changed files with 12 additions and 10 deletions

View file

@ -160,11 +160,11 @@ MOVNT / non-temporal stores vs cached generation
--------------------------------------------------
* raid_gen(..., streaming) allows the caller to select between non-temporal
streaming stores (streaming != 0, using MOVNTDQ/VMOVNTDQ + sfence on x86) and
streaming stores (streaming == 1, using MOVNTDQ/VMOVNTDQ + sfence on x86) and
normal temporal/cached stores (streaming == 0, using MOVDQA/VMOVDQA without sfence).
* Generation backends select MOVNTDQ / VMOVNTDQ for parity output when
streaming != 0 is requested.
streaming == 1 is requested. Values other than 0 and 1 are invalid.
* The synthetic speedtest naturally favors non-temporal stores because generated
parity is not consumed afterwards. This benchmark therefore measures producer

View file

@ -37,10 +37,10 @@ library startup before normal RAID operations.
Computes 'np' parity blocks from 'nd' data blocks. Vector 'v' contains
'nd + np' block pointers (data blocks v[0..nd-1], parity blocks
v[nd..nd+np-1]). Each block must be aligned to a 64-byte boundary.
Data blocks are read-only; parity blocks are written. If 'streaming' is
non-zero, non-temporal streaming stores are used where supported to avoid
polluting the CPU cache when parity is written directly to disk. If
'streaming' is zero, normal cached stores are used.
Data blocks are read-only; parity blocks are written. 'streaming' must be
either 0 or 1. If it is 1, non-temporal streaming stores are used where
supported to avoid polluting the CPU cache when parity is written directly
to disk. If it is 0, normal cached stores are used.
void raid_rec(int nr, int *ir, int nd, int np, size_t size, void **v)
Recovers 'nr' failed blocks (data or parity) listed in sorted index array

View file

@ -278,7 +278,8 @@ void raid_rec6_neon32(int nr, int *id, int *ip, int nd, size_t size, void **vv);
* It has (@nd + #parities) elements. The starting elements are the blocks
* for data, following with the parity blocks.
* Each block has @size bytes.
* @streaming Nonzero for streaming/non-temporal stores where supported, 0 for cached stores.
* @streaming 1 for streaming/non-temporal stores where supported, 0 for cached stores.
* No other values are valid.
*/
typedef void (raid_gen_fn)(int nd, size_t size, void **vv, int streaming);

View file

@ -88,7 +88,7 @@ void raid_gen(int nd, int np, size_t size, void **v, int streaming)
/* enforce valid vector */
BUG_ON(v == 0);
/* enforce valid streaming flag */
/* enforce the documented 0/1 store policy */
BUG_ON(streaming != 0 && streaming != 1);
BUG_ON(raid_gen_ptr[np - 1] == 0);

View file

@ -200,9 +200,10 @@ int raid_selftest(void);
* data, following with the parity blocks.
* Data entries are used as inputs and parity entries as outputs.
* Entries may point to the same block buffer.
* @streaming Store policy hint: nonzero for streaming / non-temporal stores
* @streaming Store policy hint: 1 for streaming / non-temporal stores
* (bypassing cache) where supported, or 0 for normal cached / temporal stores.
* Use nonzero when generated output will not be read immediately by the CPU
* No other values are valid.
* Use 1 when generated output will not be read immediately by the CPU
* (e.g., parity queued for disk writes during sync), avoiding cache pollution.
* Use 0 when output will be consumed immediately by the CPU (e.g., in-memory
* parity verification or single-disk data recovery).