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 [EMAIL PROTECTED] 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-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to [EMAIL PROTECTED]
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-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to [EMAIL PROTECTED]
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 [EMAIL PROTECTED] 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.patchhttp://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 [EMAIL PROTECTED]
Is there any way to avoid copy between the kernel and userland
Hi I am looking for any FreeBSD facility that will allow a userland process to pass data to the kernel without doing a copyin or copyout e.g. using a shared data structure (queue? ) for example? Any pointers will be useful Thanks ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to [EMAIL PROTECTED]
differences between M_CACHE, M_DEVBUF, M_TEMP
Hi I am trying to understand the difference in these three different memories. Code comments in kern_malloc.c says that M_DEVBUF should be used for device driver. I didn't however see any major difference between the three memories. Can a device theoretically take up memory from M_TEMP (or M_CACHE) segment? Similary can device drivers using M_DEVBUF also allocate from M_CACHE / M_TEMP if needed. ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to [EMAIL PROTECTED]
how to find the physical memory allocated to the kernel
Hi Is there any way to determine the physical memory(not the virtual address space) being allocated to the kernel at any instant? The overall problem is that once I allocate say 512 MB to the kernel (virutal address space) through the config file at compile time, I want to figure out how much of that space is actually being used when the machine is under load. Thanks for any answers ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to [EMAIL PROTECTED]
memory allocation / deallocation within the kernel
I am trying to understand the impact of memory allocation / deallocation within the kernel. As I understand a) Kernel memory is not pageable ie the one you get from using kernel malloc(there may be exceptions) b) Does this imply that if I have 1 GB of RAM - then I cannot reserve more than 1 GB of kernel virtual address space? The reason is that if at any point of time, the kernel has to allocate all of its virtual address space i.e. if it needs to allocate more than 1 GB of address space, there won't be any physical RAM memory to allocate from and thus this scenario is not allowed as a configuration? c) Another scenario is that assume that the kernel has 512 MB of virtual address space with 1 GB of RAM. Now assume that the entire 1 GB of RAM is used up by the kernel and other userland process that are running - with the kernel taking 256 MB and the rest allocated to the processes. Now if the kernel needs to allocate more memory, will some of the processes be swapped out to make way for the kernel(since the kernel can take upto 512 MB) Thanks for any answers. Any URL / literature that explains this will also be appreciated. ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to [EMAIL PROTECTED]
How to pin a userland page in memory(avoid copyin and copyout)
Hi I am trying to explore the option avoiding copyin and copyout when mode switches from user to kernel and vice versa. One way to achieve this, as I understand, is to make the memory address (which contain the data to be copied) non pageable. Then just pass the addresses to the kernel and the data will be used directly from the userland page. Is there already some example code / standard way to do this? Also is there any way one can determine the amount of time / performance hit (CPU %)that happening on a given process due to the copyin and copyout. I want to understand how much performance gain one can gain if I am able to remove copyin/copyout. ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to [EMAIL PROTECTED]