lkml.org 
[lkml]   [2011]   [Oct]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 11/26] dynamic_debug: hoist locking in ddebug_change to callers
Date
From: Jim Cromie <jim.cromie@gmail.com>

Hoist locking out of ddebug_change() into ddebug_exec_queries().
This reduces lock fiddling, but will increase hold-times slightly,
at least when many queries are submitted.

With verbose off, on a 266 MHz, takes, I get a reasonable:

#> time cat query-file-w-300-pending-queries > $CONTROL
real 0m0.508s
user 0m0.009s
sys 0m0.290s

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

diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
index 2b3393f..0676de0 100644
--- a/lib/dynamic_debug.c
+++ b/lib/dynamic_debug.c
@@ -113,7 +113,7 @@ static char *ddebug_describe_flags(struct _ddebug *dp, char *buf,
* Search the tables for _ddebug's which match the given
* `query' and apply the `flags' and `mask' to them. Tells
* the user which ddebug's were changed, or whether none
- * were matched.
+ * were matched. Called with ddebug_lock held.
*/
static void ddebug_change(const struct ddebug_query *query,
unsigned int flags, unsigned int mask)
@@ -125,7 +125,6 @@ static void ddebug_change(const struct ddebug_query *query,
char flagbuf[8];

/* search for matching ddebugs */
- mutex_lock(&ddebug_lock);
list_for_each_entry(dt, &ddebug_tables, link) {

/* match against the module name */
@@ -175,8 +174,6 @@ static void ddebug_change(const struct ddebug_query *query,
sizeof(flagbuf)));
}
}
- mutex_unlock(&ddebug_lock);
-
if (!nfound && verbose)
pr_info("no matches for query\n");
}
@@ -450,6 +447,7 @@ static int ddebug_exec_queries(char *query)
char *split;
int i, errs = 0, exitcode = 0, rc;

+ mutex_lock(&ddebug_lock);
for (i = 0; query; query = split) {
split = strpbrk(query, ";\n");
if (split)
@@ -468,6 +466,7 @@ static int ddebug_exec_queries(char *query)
}
i++;
}
+ mutex_unlock(&ddebug_lock);
pr_info("processed %d queries, with %d errs\n", i, errs);

return exitcode;
--
1.7.4.4


\
 
 \ /
  Last update: 2011-10-07 22:37    [W:0.281 / U:8.904 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site