OSDN Git Service

module: Annotate nested sleep in resolve_symbol()
authorPeter Zijlstra <peterz@infradead.org>
Wed, 11 Feb 2015 04:31:13 +0000 (15:01 +1030)
committerRusty Russell <rusty@rustcorp.com.au>
Wed, 11 Feb 2015 04:32:04 +0000 (15:02 +1030)
Because wait_event() loops are safe vs spurious wakeups we can allow the
occasional sleep -- which ends up being very similar.

Reported-by: Dave Jones <davej@codemonkey.org.uk>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Tested-by: Dave Jones <davej@codemonkey.org.uk>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
kernel/module.c

index 2461370..d7a9268 100644 (file)
@@ -1225,6 +1225,12 @@ static const struct kernel_symbol *resolve_symbol(struct module *mod,
        const unsigned long *crc;
        int err;
 
+       /*
+        * The module_mutex should not be a heavily contended lock;
+        * if we get the occasional sleep here, we'll go an extra iteration
+        * in the wait_event_interruptible(), which is harmless.
+        */
+       sched_annotate_sleep();
        mutex_lock(&module_mutex);
        sym = find_symbol(name, &owner, &crc,
                          !(mod->taints & (1 << TAINT_PROPRIETARY_MODULE)), true);