From owner-freebsd-current Mon Jan 18 14:21:00 1999 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id OAA22484 for freebsd-current-outgoing; Mon, 18 Jan 1999 14:21:00 -0800 (PST) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from dingo.cdrom.com (castles250.castles.com [208.214.165.250]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id OAA22471 for ; Mon, 18 Jan 1999 14:20:58 -0800 (PST) (envelope-from mike@dingo.cdrom.com) Received: from dingo.cdrom.com (localhost [127.0.0.1]) by dingo.cdrom.com (8.9.1/8.8.8) with ESMTP id OAA19112; Mon, 18 Jan 1999 14:17:04 -0800 (PST) (envelope-from mike@dingo.cdrom.com) Message-Id: <199901182217.OAA19112@dingo.cdrom.com> X-Mailer: exmh version 2.0.2 2/24/98 To: Brian Feldman cc: Mike Smith , Julian Elischer , Matthew Dillon , current@FreeBSD.ORG Subject: Re: kernel malloc and M_CANWAIT In-reply-to: Your message of "Mon, 18 Jan 1999 16:34:49 EST." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Mon, 18 Jan 1999 14:17:03 -0800 From: Mike Smith Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > On Mon, 18 Jan 1999, Mike Smith wrote: > > > > > So malloc() will generally not return NULL even in low memory situations > > > > unless the KVM map fills up, which isn't supposed to happen but can in > > > > certain severe circumstances. Callers should therefore check for NULL. > > > > > > why not just put it in a loop and block on lbolt? > > > (or call panic) > > > > Because you shouldn't panic unless there's no alternative. Panicking > > on resource starvation is just totally lame. > > And what's wrong with spinning inside malloc until the resources are free? If you have to ask this, you have a lot of reading to do before you're going to be able to understand any of the deadlock issues. Just as a hint for this one though - if you're spinning inside malloc() waiting for the resources to be freed, who is going to free them? > There are places that architecturally require M_WAITOK to not return NULL. > Look at the void () functions that call malloc/MALLOC. These are (obviously) bogus code. So they need to be fixed... > Also, commit the > attached patch; it was OKed by Bruce to disallow this, but he seems to forget > to commit it. I'm not going to second-guess Bruce on this one. -- \\ Sometimes you're ahead, \\ Mike Smith \\ sometimes you're behind. \\ mike@smith.net.au \\ The race is long, and in the \\ msmith@freebsd.org \\ end it's only with yourself. \\ msmith@cdrom.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message