Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Graceful failure instead of panicking in kmem_malloc
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  8 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Bharma Ji  
View profile  
 More options Jan 8 2008, 7:23 pm
Newsgroups: fa.freebsd.hackers
From: "Bharma Ji" <bharm...@gmail.com>
Date: Wed, 09 Jan 2008 00:23:35 UTC
Local: Tues, Jan 8 2008 7:23 pm
Subject: Graceful failure instead of panicking in kmem_malloc
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?
_______________________________________________
freebsd-hack...@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Kris Kennaway  
View profile  
 More options Jan 8 2008, 7:30 pm
Newsgroups: fa.freebsd.hackers
From: Kris Kennaway <k...@FreeBSD.org>
Date: Wed, 09 Jan 2008 00:30:50 UTC
Local: Tues, Jan 8 2008 7:30 pm
Subject: Re: Graceful failure instead of panicking in kmem_malloc

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

which implements b) (patch against 7.0, but might apply to 6.2 unchanged).

Kris
_______________________________________________
freebsd-hack...@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Bharma Ji  
View profile  
 More options Jan 8 2008, 10:26 pm
Newsgroups: fa.freebsd.hackers
From: "Bharma Ji" <bharm...@gmail.com>
Date: Wed, 09 Jan 2008 03:26:08 UTC
Local: Tues, Jan 8 2008 10:26 pm
Subject: Re: Graceful failure instead of panicking in kmem_malloc
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 <k...@freebsd.org> wrote:

_______________________________________________
freebsd-hack...@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Joshua Isom  
View profile  
 More options Jan 9 2008, 4:53 am
Newsgroups: fa.freebsd.hackers
From: Joshua Isom <jri...@gmail.com>
Date: Wed, 09 Jan 2008 09:53:53 UTC
Local: Wed, Jan 9 2008 4:53 am
Subject: Re: Graceful failure instead of panicking in kmem_malloc

On Jan 8, 2008, at 9:25 PM, Bharma Ji wrote:

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.

_______________________________________________
freebsd-hack...@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Heiko Wundram (Beenic)  
View profile  
 More options Jan 9 2008, 5:11 am
Newsgroups: fa.freebsd.hackers
From: "Heiko Wundram (Beenic)" <wund...@beenic.net>
Date: Wed, 09 Jan 2008 10:11:17 UTC
Local: Wed, Jan 9 2008 5:11 am
Subject: Re: Graceful failure instead of panicking in kmem_malloc
Am Mittwoch, 9. Januar 2008 10:29:43 schrieb Joshua Isom:

> 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.

Ahemm. No. That's not tolerable in real world conditions. Have you ever had
the OOM-killer strike on Linux (which is known for this, and has been
criticized at other times for its braindead default behavior of overcommiting
virtual memory space almost two-fold)? That's a major, major PITA.

I'd rather have the system reboot and come back up to a clean and initialized
state than to "randomly" kill user processes and leave it crippled but
(somewhat) running (with sshd possibly killed off, which is especially bad on
remote boxes), as basically to recover cleanly from the OOM-killer striking,
you're going to have to reboot the box anyway.

--
Heiko Wundram
Product & Application Development
_______________________________________________
freebsd-hack...@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Kris Kennaway  
View profile  
 More options Jan 9 2008, 5:14 am
Newsgroups: fa.freebsd.hackers
From: Kris Kennaway <k...@FreeBSD.org>
Date: Wed, 09 Jan 2008 10:14:13 UTC
Local: Wed, Jan 9 2008 5:14 am
Subject: Re: Graceful failure instead of panicking in kmem_malloc

This is kernel memory, not user memory.  There is a fixed-size arena for
  mallocs in the kernel, and the panic happens when it fills up and no
free space can be immediately reclaimed.

Kris
_______________________________________________
freebsd-hack...@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mike  
View profile  
 More options Jan 9 2008, 12:59 pm
Newsgroups: fa.freebsd.hackers
From: Mike <deathje...@gmail.com>
Date: Wed, 09 Jan 2008 17:59:35 UTC
Local: Wed, Jan 9 2008 12:59 pm
Subject: Re: Graceful failure instead of panicking in kmem_malloc

Bharma Ji wrote:
> Is there any way to make the system log and then gracefully shut off instead
> of panicking?

Is there any way to make the system log and then gracefully shut off while
guaranteeing that the logging/shutdown procedure won't also run out memory
somewhere?
_______________________________________________
freebsd-hack...@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Bharma Ji  
View profile  
 More options Jan 9 2008, 6:48 pm
Newsgroups: fa.freebsd.hackers
From: "Bharma Ji" <bharm...@gmail.com>
Date: Wed, 09 Jan 2008 23:48:52 UTC
Local: Wed, Jan 9 2008 6:48 pm
Subject: Re: Graceful failure instead of panicking in kmem_malloc
>Is there any way to make the system log and then gracefully shut off while
>guaranteeing that the logging/shutdown procedure won't also run out memory
>somewhere?

For logging procedure, I am hoping that by keeping some memory aside, I
should be able to guarantee that the procedure will not run out of memory.
For shutdown, I don't know. I am not sure if doing the usual shutdown is
even required.
To me this appears to be a generic requirement of any system i.e.
a) Set aside some memory to handle out of memory conditions. Establish a low
threshold
b) When the system reaches the low threshold,
   1) stop all processing (not sure right  now if this translates to
shutdown)
   2) record the error.

Kris
Thanks for sending the patch. The patch essentially will try to reclaim
memory 8 times before panicking. Is the understanding correct? If so, how
did you arrive at the number 8?

On Jan 9, 2008 9:30 AM, Mike <deathje...@gmail.com> wrote:

> Bharma Ji wrote:
> > Is there any way to make the system log and then gracefully shut off
> instead
> > of panicking?

> Is there any way to make the system log and then gracefully shut off while
> guaranteeing that the logging/shutdown procedure won't also run out memory
> somewhere?

_______________________________________________
freebsd-hack...@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »