Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Thu, 27 Mar 2003 13:59:33 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Thu, 27 Mar 2003 13:59:33 -0500 Received: from neon-gw-l3.transmeta.com ([63.209.4.196]:7173 "EHLO neon-gw.transmeta.com") by vger.kernel.org with ESMTP id ; Thu, 27 Mar 2003 13:59:30 -0500 Date: Thu, 27 Mar 2003 11:08:26 -0800 (PST) From: Linus Torvalds To: Dan Eble cc: "David S. Miller" , , , , , , , , Subject: Re: BUG or not? GFP_KERNEL with interrupts disabled. In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1180 Lines: 38 On Thu, 27 Mar 2003, Dan Eble wrote: > > This makes checks like the following (in alloc_skb) asymmetric: > > if (in_interrupt() && (gfp_mask & __GFP_WAIT)) { > static int count = 0; > if (++count < 5) { > printk(KERN_ERR "alloc_skb called nonatomically " > "from interrupt %p\n", NET_CALLER(size)); > BUG(); > > In a driver I'm writing, this bug was hidden until I switched from using > write_lock_irqsave() to write_lock_bh(). Shouldn't this bug also be > announced if interrupts are disabled? Yeah. It should also probably use "in_atomic()" instead of "in_interrupt()", since that also finds people who have marked themselves non-preemptible. So what the test SHOULD look like is this: if (gfp_mask & __GFP_WAIT) { if (in_atomic() || irqs_disabled()) { static int count = 0; ... } } which should catch all the cases we really care about. Linus - 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/