[PATCH 3/5] dyndbg: use static-key queueing API in dynamic-debug

Jim Cromie posted 5 patches 3 days, 22 hours ago
[PATCH 3/5] dyndbg: use static-key queueing API in dynamic-debug
Posted by Jim Cromie 3 days, 22 hours ago
Use the new static-key queueing API in dynamic-debug to reduce IPIs.

this replaces the 2 calls to static_branch_{enable.disable}() in
ddebug_change() with their _queued() counterparts, and adds a call to
static_branch_apply_queued() at the bottom.

This gives a theoretical reduction of IPIs up to 256x, and a practical
reduction by 120-180x.

Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
---
 lib/dynamic_debug.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
index b5060749464e..9bee7dde5148 100644
--- a/lib/dynamic_debug.c
+++ b/lib/dynamic_debug.c
@@ -250,9 +250,9 @@ static int ddebug_change(const struct ddebug_query *query,
 #ifdef CONFIG_JUMP_LABEL
 			if (dp->flags & _DPRINTK_FLAGS_PRINT) {
 				if (!(newflags & _DPRINTK_FLAGS_PRINT))
-					static_branch_disable(&dp->key.dd_key_true);
+					static_branch_disable_queued(&dp->key.dd_key_true);
 			} else if (newflags & _DPRINTK_FLAGS_PRINT) {
-				static_branch_enable(&dp->key.dd_key_true);
+				static_branch_enable_queued(&dp->key.dd_key_true);
 			}
 #endif
 			v4pr_info("changed %s:%d [%s]%s %s => %s\n",
@@ -263,6 +263,7 @@ static int ddebug_change(const struct ddebug_query *query,
 			dp->flags = newflags;
 		}
 	}
+	static_branch_apply_queued();
 	mutex_unlock(&ddebug_lock);
 	v2pr_info("applied %d queued updates to sites in total\n", nfound);
 
-- 
2.53.0