Date: Thu, 12 Apr 2001 13:17:57 -0700 From: Alfred Perlstein <bright@wintelcom.net> To: Logan Gabriel <logan@mail.2cactus.com> Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: Kernel malloc problems with M_NOWAIT. Message-ID: <20010412131757.J24582@fw.wintelcom.net> In-Reply-To: <Pine.BSF.4.21.0104121141470.77198-101000@mail.2cactus.com>; from logan@mail.2cactus.com on Thu, Apr 12, 2001 at 11:46:52AM -0700 References: <Pine.BSF.4.21.0104121141470.77198-101000@mail.2cactus.com>
index | next in thread | previous in thread | raw e-mail
* Logan Gabriel <logan@mail.2cactus.com> [010412 11:50] wrote:
> There is a hard to duplicate race condition in freebsd's
> kernel malloc. Bassically it is possiables for the kernel
> to tsleep way down in vm_page_sleep_busy even when M_NOWAIT
> is spefcied. Under some conditions this can block the kernel
> completly.
>
> Attatched is a kernel module that demonstrates this rare condition,
> The module has been tested on 4.2-RELEASE generic kernel configurations
> as well as -STABLE. The module only seems to work about one out of every
> 10 or 15 tries which makes me think there is a race condition happening.
>
Please try the attached patch:
Index: vm_kern.c
===================================================================
RCS file: /home/ncvs/src/sys/vm/vm_kern.c,v
retrieving revision 1.61.2.1
diff -u -r1.61.2.1 vm_kern.c
--- vm_kern.c 2000/08/04 22:31:11 1.61.2.1
+++ vm_kern.c 2001/04/12 20:19:17
@@ -362,7 +362,7 @@
vm_map_lock(map);
goto retry;
}
- vm_map_delete(map, addr, addr + size);
+ vm_map_delete(map, addr, addr + (i - PAGE_SIZE));
vm_map_unlock(map);
if (flags & M_ASLEEP) {
VM_AWAIT;
if it bombs please try:
Index: vm_kern.c
===================================================================
RCS file: /home/ncvs/src/sys/vm/vm_kern.c,v
retrieving revision 1.61.2.1
diff -u -r1.61.2.1 vm_kern.c
--- vm_kern.c 2000/08/04 22:31:11 1.61.2.1
+++ vm_kern.c 2001/04/12 20:19:59
@@ -362,7 +362,7 @@
vm_map_lock(map);
goto retry;
}
- vm_map_delete(map, addr, addr + size);
+ vm_map_delete(map, addr, addr + i);
vm_map_unlock(map);
if (flags & M_ASLEEP) {
VM_AWAIT;
--
-Alfred Perlstein - [bright@wintelcom.net|alfred@freebsd.org]
Instead of asking why a piece of software is using "1970s technology,"
start asking why software is ignoring 30 years of accumulated wisdom.
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010412131757.J24582>
