From owner-freebsd-hackers@FreeBSD.ORG Wed Jan 9 09:53:09 2008 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5F19316A41A for ; Wed, 9 Jan 2008 09:53:09 +0000 (UTC) (envelope-from jrisom@gmail.com) Received: from py-out-1112.google.com (py-out-1112.google.com [64.233.166.179]) by mx1.freebsd.org (Postfix) with ESMTP id 14F3A13C461 for ; Wed, 9 Jan 2008 09:53:08 +0000 (UTC) (envelope-from jrisom@gmail.com) Received: by py-out-1112.google.com with SMTP id u52so296513pyb.10 for ; Wed, 09 Jan 2008 01:53:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:in-reply-to:references:mime-version:content-type:message-id:content-transfer-encoding:cc:from:subject:date:to:x-mailer; bh=l1GCgg+eMHFiWMCf6lg1mtWTka3JdNlWamhTqdpRNyo=; b=qvGH2OL9V1PPkWLMrjyYWYrUB2SIUshT2fPo7naeoZD8Y80zImXETAW6zGanQOmrY6MMrX+KEG4w42tcOYtESDIh+5v0fQ6umU85J5kbwEsXf2J4vnfDVMLY+tcvhDHTqH7mc99kFVk7U2FfJ851BkNF0UmW7nVYKDJY0l6sR+A= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=in-reply-to:references:mime-version:content-type:message-id:content-transfer-encoding:cc:from:subject:date:to:x-mailer; b=SQXitBCIPYnw9J/W7cDFO3pka+FAIZciucieWhAaMAswuGDu+x8WSOxG7qUor9rVjzSo4seat9BHBMU9QbZpV77uliafb6d70OZf5b8Tx2EImRBhc9O6P0tTWdyGDaNF8Ap/WLL4vJg3OW6ZUaRLIV07Ii0NBDdyMSTAmo6PeQ0= Received: by 10.35.33.5 with SMTP id l5mr572561pyj.30.1199870925885; Wed, 09 Jan 2008 01:28:45 -0800 (PST) Received: from ?192.168.1.4? ( [74.134.230.123]) by mx.google.com with ESMTPS id f45sm1639141pyh.6.2008.01.09.01.28.44 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 09 Jan 2008 01:28:45 -0800 (PST) In-Reply-To: <67beabb0801081925t67f995b8hc4cc779f88c2ba@mail.gmail.com> References: <67beabb0801081555v4ca3b729x294322fa724afa09@mail.gmail.com> <4784159E.9040905@FreeBSD.org> <67beabb0801081925t67f995b8hc4cc779f88c2ba@mail.gmail.com> Mime-Version: 1.0 (Apple Message framework v624) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <66462bcb31fb347796200bd5260d7cdc@gmail.com> Content-Transfer-Encoding: 7bit From: Joshua Isom Date: Wed, 9 Jan 2008 03:29:43 -0600 To: "Bharma Ji" X-Mailer: Apple Mail (2.624) Cc: freebsd-hackers@freebsd.org Subject: Re: Graceful failure instead of panicking in kmem_malloc X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Jan 2008 09:53:09 -0000 On Jan 8, 2008, at 9:25 PM, Bharma Ji wrote: > Thanks for the response. I am hoping to keep some memory aside > specifically > for handling out of memory allocation situations. Yes the real fix is > to > avoid out of memory allocation. Thanks for the patch. Will try that. > As a > first cut I am just trying to handle failure gracefully. > > So asking again - if there is any way already discussed or > standardized to > make the system handle failures gracefully > > On Jan 8, 2008 4:30 PM, Kris Kennaway wrote: > >> Bharma Ji wrote: >>> In FreeBSD 6_2, if kmem_malloc is unable to find space it panics. The >>> relevant code is in vm_kern.c >>> if ((flags & M_NOWAIT) == 0) >>> panic("kmem_malloc(%ld): kmem_map too small: >> %ld >>> total allocated", >>> (long)size, (long)map->size); >>> >>> Is there any way to make the system log and then gracefully shut off >> instead >>> of panicking? >> >> Not really, because those actions require memory allocation. The real >> fix is to either >> >> a) avoid running out of memory in the first place by tuning >> vm.kmem_size >> >> b) perhaps trying harder to avoid panicking by first trying to more >> aggressively reclaim memory. >> >> You can try >> >> >> http://www.freebsd.org/~pjd/patches/vm_kern.c.2.patch> www.freebsd.org/%7Epjd/patches/vm_kern.c.2.patch> >> >> which implements b) (patch against 7.0, but might apply to 6.2 >> unchanged). >> >> Kris >> > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to > "freebsd-hackers-unsubscribe@freebsd.org" Why not try to take out some user processes? Going with a combination of process priority and memory usage, it should at least be more tolerable than a panic.