From 67d4e8403fe12592f99cf6fc51e4f33684899d6b Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Wed, 20 Apr 2011 23:35:42 +0200 Subject: Warn once when part of the kernel is lacking memory * kern/printf.h (printf_once): New macro. * ipc/mach_port.c (mach_port_names, mach_port_get_set_status): Warn when returning KERN_RESOURCE_SHORTAGE. * vm/vm_kern.c: Include printf.h. (kmem_alloc, kmem_realloc, kmem_alloc_wired, kmem_alloc_aligned, kmem_alloc_pageable): Warn when failing. * vm/vm_resident.c (vm_page_grab_contiguous_pages): Warn when returning KERN_RESOURCE_SHORTAGE. --- vm/vm_resident.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'vm/vm_resident.c') diff --git a/vm/vm_resident.c b/vm/vm_resident.c index b23e0f35..a6334989 100644 --- a/vm/vm_resident.c +++ b/vm/vm_resident.c @@ -976,6 +976,7 @@ vm_page_grab_contiguous_pages( if ((vm_page_free_count < vm_page_free_reserved) || (vm_page_external_count >= vm_page_external_limit)) { + printf_once("no more room for vm_page_grab_contiguous_pages"); simple_unlock(&vm_page_queue_free_lock); return KERN_RESOURCE_SHORTAGE; } @@ -1064,6 +1065,7 @@ count_ones: */ simple_unlock(&vm_page_queue_free_lock); + printf_once("no contiguous room for vm_page_grab_contiguous_pages"); ret = KERN_RESOURCE_SHORTAGE; goto out; -- cgit v1.2.3