Commit 28325df0 authored by Mathieu Desnoyers's avatar Mathieu Desnoyers Committed by Linus Torvalds

markers: use rcu_barrier_sched() and call_rcu_sched()

rcu_barrier_sched() and call_rcu_sched() were introduced in 2.6.26 for the
Markers.  Change the marker code to use them.

It can be seen as a fix since the marker code was using an ugly,
temporary, #ifdef hack to work around CONFIG_PREEMPT_RCU.
Signed-off-by: default avatarMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Acked-by: default avatarPaul McKenney <paulmck@us.ibm.com>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 24879a8e
...@@ -441,7 +441,7 @@ static int remove_marker(const char *name) ...@@ -441,7 +441,7 @@ static int remove_marker(const char *name)
hlist_del(&e->hlist); hlist_del(&e->hlist);
/* Make sure the call_rcu has been executed */ /* Make sure the call_rcu has been executed */
if (e->rcu_pending) if (e->rcu_pending)
rcu_barrier(); rcu_barrier_sched();
kfree(e); kfree(e);
return 0; return 0;
} }
...@@ -476,7 +476,7 @@ static int marker_set_format(struct marker_entry **entry, const char *format) ...@@ -476,7 +476,7 @@ static int marker_set_format(struct marker_entry **entry, const char *format)
hlist_del(&(*entry)->hlist); hlist_del(&(*entry)->hlist);
/* Make sure the call_rcu has been executed */ /* Make sure the call_rcu has been executed */
if ((*entry)->rcu_pending) if ((*entry)->rcu_pending)
rcu_barrier(); rcu_barrier_sched();
kfree(*entry); kfree(*entry);
*entry = e; *entry = e;
trace_mark(core_marker_format, "name %s format %s", trace_mark(core_marker_format, "name %s format %s",
...@@ -655,7 +655,7 @@ int marker_probe_register(const char *name, const char *format, ...@@ -655,7 +655,7 @@ int marker_probe_register(const char *name, const char *format,
* make sure it's executed now. * make sure it's executed now.
*/ */
if (entry->rcu_pending) if (entry->rcu_pending)
rcu_barrier(); rcu_barrier_sched();
old = marker_entry_add_probe(entry, probe, probe_private); old = marker_entry_add_probe(entry, probe, probe_private);
if (IS_ERR(old)) { if (IS_ERR(old)) {
ret = PTR_ERR(old); ret = PTR_ERR(old);
...@@ -670,10 +670,7 @@ int marker_probe_register(const char *name, const char *format, ...@@ -670,10 +670,7 @@ int marker_probe_register(const char *name, const char *format,
entry->rcu_pending = 1; entry->rcu_pending = 1;
/* write rcu_pending before calling the RCU callback */ /* write rcu_pending before calling the RCU callback */
smp_wmb(); smp_wmb();
#ifdef CONFIG_PREEMPT_RCU call_rcu_sched(&entry->rcu, free_old_closure);
synchronize_sched(); /* Until we have the call_rcu_sched() */
#endif
call_rcu(&entry->rcu, free_old_closure);
end: end:
mutex_unlock(&markers_mutex); mutex_unlock(&markers_mutex);
return ret; return ret;
...@@ -704,7 +701,7 @@ int marker_probe_unregister(const char *name, ...@@ -704,7 +701,7 @@ int marker_probe_unregister(const char *name,
if (!entry) if (!entry)
goto end; goto end;
if (entry->rcu_pending) if (entry->rcu_pending)
rcu_barrier(); rcu_barrier_sched();
old = marker_entry_remove_probe(entry, probe, probe_private); old = marker_entry_remove_probe(entry, probe, probe_private);
mutex_unlock(&markers_mutex); mutex_unlock(&markers_mutex);
marker_update_probes(); /* may update entry */ marker_update_probes(); /* may update entry */
...@@ -716,10 +713,7 @@ int marker_probe_unregister(const char *name, ...@@ -716,10 +713,7 @@ int marker_probe_unregister(const char *name,
entry->rcu_pending = 1; entry->rcu_pending = 1;
/* write rcu_pending before calling the RCU callback */ /* write rcu_pending before calling the RCU callback */
smp_wmb(); smp_wmb();
#ifdef CONFIG_PREEMPT_RCU call_rcu_sched(&entry->rcu, free_old_closure);
synchronize_sched(); /* Until we have the call_rcu_sched() */
#endif
call_rcu(&entry->rcu, free_old_closure);
remove_marker(name); /* Ignore busy error message */ remove_marker(name); /* Ignore busy error message */
ret = 0; ret = 0;
end: end:
...@@ -786,7 +780,7 @@ int marker_probe_unregister_private_data(marker_probe_func *probe, ...@@ -786,7 +780,7 @@ int marker_probe_unregister_private_data(marker_probe_func *probe,
goto end; goto end;
} }
if (entry->rcu_pending) if (entry->rcu_pending)
rcu_barrier(); rcu_barrier_sched();
old = marker_entry_remove_probe(entry, NULL, probe_private); old = marker_entry_remove_probe(entry, NULL, probe_private);
mutex_unlock(&markers_mutex); mutex_unlock(&markers_mutex);
marker_update_probes(); /* may update entry */ marker_update_probes(); /* may update entry */
...@@ -797,10 +791,7 @@ int marker_probe_unregister_private_data(marker_probe_func *probe, ...@@ -797,10 +791,7 @@ int marker_probe_unregister_private_data(marker_probe_func *probe,
entry->rcu_pending = 1; entry->rcu_pending = 1;
/* write rcu_pending before calling the RCU callback */ /* write rcu_pending before calling the RCU callback */
smp_wmb(); smp_wmb();
#ifdef CONFIG_PREEMPT_RCU call_rcu_sched(&entry->rcu, free_old_closure);
synchronize_sched(); /* Until we have the call_rcu_sched() */
#endif
call_rcu(&entry->rcu, free_old_closure);
remove_marker(entry->name); /* Ignore busy error message */ remove_marker(entry->name); /* Ignore busy error message */
end: end:
mutex_unlock(&markers_mutex); mutex_unlock(&markers_mutex);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment