diff options
| author | Petr Mladek <pmladek@suse.com> | 2025-11-07 20:47:20 +0100 |
|---|---|---|
| committer | Petr Mladek <pmladek@suse.com> | 2025-11-10 13:09:43 +0100 |
| commit | 394aa576c0b783ae728d87ed98fe4f1831dfd720 (patch) | |
| tree | b4dcba6f80ddbe45e9780e106b206c1f2ce9f058 /tools/lib/python/kdoc/kdoc_re.py | |
| parent | cc3bad11de6e0d6012460487903e7167d3e73957 (diff) | |
printk_ringbuffer: Create a helper function to decide whether more space is needed
The decision whether some more space is needed is tricky in the printk
ring buffer code:
1. The given lpos values might overflow. A subtraction must be used
instead of a simple "lower than" check.
2. Another CPU might reuse the space in the mean time. It can be
detected when the subtraction is bigger than DATA_SIZE(data_ring).
3. There is exactly enough space when the result of the subtraction
is zero. But more space is needed when the result is exactly
DATA_SIZE(data_ring).
Add a helper function to make sure that the check is done correctly
in all situations. Also it helps to make the code consistent and
better documented.
Suggested-by: John Ogness <john.ogness@linutronix.de>
Link: https://lore.kernel.org/r/87tsz7iea2.fsf@jogness.linutronix.de
Reviewed-by: John Ogness <john.ogness@linutronix.de>
Link: https://patch.msgid.link/20251107194720.1231457-3-pmladek@suse.com
[pmladek@suse.com: Updated wording as suggested by John]
Signed-off-by: Petr Mladek <pmladek@suse.com>
Diffstat (limited to 'tools/lib/python/kdoc/kdoc_re.py')
0 files changed, 0 insertions, 0 deletions
