From mboxrd@z Thu Jan 1 00:00:00 1970 From: Neil Horman Subject: Re: [PATCH v2] drop_monitor: dont sleep in atomic context Date: Mon, 4 Jun 2012 06:49:37 -0400 Message-ID: <20120604104937.GC20232@hmsreliant.think-freely.org> References: <1338805099.2760.1798.camel@edumazet-glaptop> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: David Miller , netdev To: Eric Dumazet Return-path: Received: from charlotte.tuxdriver.com ([70.61.120.58]:42860 "EHLO smtp.tuxdriver.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751677Ab2FDKtq (ORCPT ); Mon, 4 Jun 2012 06:49:46 -0400 Content-Disposition: inline In-Reply-To: <1338805099.2760.1798.camel@edumazet-glaptop> Sender: netdev-owner@vger.kernel.org List-ID: On Mon, Jun 04, 2012 at 12:18:19PM +0200, Eric Dumazet wrote: > From: Eric Dumazet > > drop_monitor calls several sleeping functions while in atomic context. > > BUG: sleeping function called from invalid context at mm/slub.c:943 > in_atomic(): 1, irqs_disabled(): 0, pid: 2103, name: kworker/0:2 > Pid: 2103, comm: kworker/0:2 Not tainted 3.5.0-rc1+ #55 > Call Trace: > [] __might_sleep+0xca/0xf0 > [] kmem_cache_alloc_node+0x1b3/0x1c0 > [] ? queue_delayed_work_on+0x11c/0x130 > [] __alloc_skb+0x4b/0x230 > [] ? reset_per_cpu_data+0x160/0x160 [drop_monitor] > [] reset_per_cpu_data+0x2f/0x160 [drop_monitor] > [] send_dm_alert+0x4b/0xb0 [drop_monitor] > [] process_one_work+0x130/0x4c0 > [] worker_thread+0x159/0x360 > [] ? manage_workers.isra.27+0x240/0x240 > [] kthread+0x93/0xa0 > [] kernel_thread_helper+0x4/0x10 > [] ? kthread_freezable_should_stop+0x80/0x80 > [] ? gs_change+0xb/0xb > > Rework the logic to call the sleeping functions in right context. > > Use standard timer/workqueue api to let system chose any cpu to perform > the allocation and netlink send. > > Also avoid a loop if reset_per_cpu_data() cannot allocate memory : > use mod_timer() to wait 1/10 second before next try. > > Signed-off-by: Eric Dumazet > Cc: Neil Horman Reviewed-by: Neil Horman Thanks Eric! Neil