From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753616AbbGNJia (ORCPT ); Tue, 14 Jul 2015 05:38:30 -0400 Received: from mail-wi0-f178.google.com ([209.85.212.178]:35846 "EHLO mail-wi0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751961AbbGNJi2 (ORCPT ); Tue, 14 Jul 2015 05:38:28 -0400 Date: Tue, 14 Jul 2015 11:38:25 +0200 From: Thomas Graf To: Cong Wang Cc: "Kirill A. Shutemov" , "David S. Miller" , netdev , "linux-kernel@vger.kernel.org" Subject: Re: mmap()ed AF_NETLINK: lockdep and sleep-in-atomic warnings Message-ID: <20150714093825.GC20597@pox.localdomain> References: <20150713131825.GA16186@node.dhcp.inet.fi> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07/13/15 at 10:11pm, Cong Wang wrote: > Caused by: > > commit 21e4902aea80ef35afc00ee8d2abdea4f519b7f7 > Author: Thomas Graf > Date: Fri Jan 2 23:00:22 2015 +0100 > > netlink: Lockless lookup with RCU grace period in socket release > > Defers the release of the socket reference using call_rcu() to > allow using an RCU read-side protected call to rhashtable_lookup() > > This restores behaviour and performance gains as previously > introduced by e341694 ("netlink: Convert netlink_lookup() to use > RCU protected hash table") without the side effect of severely > delayed socket destruction. > > Signed-off-by: Thomas Graf > Signed-off-by: David S. Miller > > > We can't hold mutex lock in a rcu callback, perhaps we could > defer the mmap ring cleanup to a workqueue. The socket should be dead at this point. It might be simpler to add a netlink_release_ring() function which doesn't require locking at all. It would also get rid of all the special handling for closing vs. non-closing.