Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1166288
| From | Steven Rostedt <rostedt@goodmis.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: call_rcu from trace_preempt |
| Date | 2015-06-16 19:40 +0200 |
| Message-ID | <pC307-Sa-29@gated-at.bofh.it> (permalink) |
| References | (3 earlier) <pBODL-5mO-1@gated-at.bofh.it> <pBRUZ-1yj-9@gated-at.bofh.it> <pBYa7-2jk-13@gated-at.bofh.it> <pBYjN-2uo-17@gated-at.bofh.it> <pC2Qr-GT-29@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Tue, 16 Jun 2015 10:20:05 -0700
Alexei Starovoitov <ast@plumgrid.com> wrote:
> On 6/16/15 5:38 AM, Daniel Wagner wrote:
> > static int free_thread(void *arg)
> > +{
> > + unsigned long flags;
> > + struct htab_elem *l;
> > +
> > + while (!kthread_should_stop()) {
> > + spin_lock_irqsave(&elem_freelist_lock, flags);
> > + while (!list_empty(&elem_freelist)) {
> > + l = list_entry(elem_freelist.next,
> > + struct htab_elem, list);
> > + list_del(&l->list);
> > + kfree(l);
>
> that's not right, since such thread defeats rcu protection of lookup.
> We need either kfree_rcu/call_rcu or synchronize_rcu.
> Obviously the former is preferred that's why I'm still digging into it.
> Probably a thread that does kfree_rcu would be ok, but we shouldn't
> be doing it unconditionally. For all networking programs and 99%
> of tracing programs the existing code is fine and I don't want to
> slow it down to tackle the corner case.
> Extra spin_lock just to add it to the list is also quite costly.
Use a irq_work() handler to do the kfree_rcu(), and use llist (lockless
list) to add items to the list.
-- Steve
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: call_rcu from trace_preempt Alexei Starovoitov <ast@plumgrid.com> - 2015-06-16 03:20 +0200
Re: call_rcu from trace_preempt Alexei Starovoitov <ast@plumgrid.com> - 2015-06-16 19:30 +0200
Re: call_rcu from trace_preempt Steven Rostedt <rostedt@goodmis.org> - 2015-06-16 19:40 +0200
Re: call_rcu from trace_preempt "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2015-06-17 22:40 +0200
Re: call_rcu from trace_preempt Alexei Starovoitov <ast@plumgrid.com> - 2015-06-17 23:00 +0200
Re: call_rcu from trace_preempt "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2015-06-17 23:40 +0200
Re: call_rcu from trace_preempt Alexei Starovoitov <ast@plumgrid.com> - 2015-06-18 02:00 +0200
Re: call_rcu from trace_preempt "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2015-06-18 02:30 +0200
Re: call_rcu from trace_preempt "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2015-06-16 19:50 +0200
Re: call_rcu from trace_preempt Steven Rostedt <rostedt@goodmis.org> - 2015-06-16 21:00 +0200
Re: call_rcu from trace_preempt "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2015-06-16 21:30 +0200
Re: call_rcu from trace_preempt Steven Rostedt <rostedt@goodmis.org> - 2015-06-16 21:30 +0200
Re: call_rcu from trace_preempt "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2015-06-16 21:40 +0200
csiph-web