ftrace: Avoid synchronize_rcu_tasks_rude() call when not necessary
[platform/kernel/linux-rpi.git] / kernel / trace / ftrace.c
index 72ef4dc..4fbcf56 100644 (file)
@@ -4212,8 +4212,7 @@ static void process_mod_list(struct list_head *head, struct ftrace_ops *ops,
                if (!func) /* warn? */
                        continue;
 
-               list_del(&ftrace_mod->list);
-               list_add(&ftrace_mod->list, &process_mods);
+               list_move(&ftrace_mod->list, &process_mods);
 
                /* Use the newly allocated func, as it may be "*" */
                kfree(ftrace_mod->func);
@@ -5986,7 +5985,8 @@ ftrace_graph_release(struct inode *inode, struct file *file)
                 * infrastructure to do the synchronization, thus we must do it
                 * ourselves.
                 */
-               synchronize_rcu_tasks_rude();
+               if (old_hash != EMPTY_HASH)
+                       synchronize_rcu_tasks_rude();
 
                free_ftrace_hash(old_hash);
        }