Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756982AbbFPRUO (ORCPT ); Tue, 16 Jun 2015 13:20:14 -0400 Received: from mail-pa0-f45.google.com ([209.85.220.45]:33792 "EHLO mail-pa0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752992AbbFPRUI (ORCPT ); Tue, 16 Jun 2015 13:20:08 -0400 Message-ID: <55805AC5.8020507@plumgrid.com> Date: Tue, 16 Jun 2015 10:20:05 -0700 From: Alexei Starovoitov User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Daniel Wagner , paulmck@linux.vnet.ibm.com CC: Daniel Wagner , LKML , rostedt@goodmis.org Subject: Re: call_rcu from trace_preempt References: <557F509D.2000509@plumgrid.com> <20150615230702.GB3913@linux.vnet.ibm.com> <557F7764.5060707@plumgrid.com> <20150616021458.GE3913@linux.vnet.ibm.com> <557FB7E1.6080004@plumgrid.com> <20150616122733.GG3913@linux.vnet.ibm.com> <558018DD.1080701@monom.org> In-Reply-To: <558018DD.1080701@monom.org> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1130 Lines: 28 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. -- 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/