Thread (9 messages) 9 messages, 2 authors, 2022-11-23

Re: [PATCH v5 1/5] jump_label: Prevent key->enabled int overflow

From: Peter Zijlstra <peterz@infradead.org>
Date: 2022-11-23 10:22:17
Also in: lkml

On Tue, Nov 22, 2022 at 06:55:30PM +0000, Dmitry Safonov wrote:
key->enabled is indeed a ref-counter as it's documented in multiple
places: top comment in jump_label.h, Documentation/staging/static-keys.rst,
etc.
+/***
+ * static_key_fast_inc_not_negative - adds a user for a static key
+ * @key: static key that must be already enabled
+ *
+ * The caller must make sure that the static key can't get disabled while
+ * in this function. It doesn't patch jump labels, only adds a user to
+ * an already enabled static key.
+ *
+ * Returns true if the increment was done.
+ */
One more thing; it might be useful to point out that unlike refcount_t
this thing does not saturate but will fail to increment on overflow.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help