Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 27 Nov 2001 12:11:42 -0500 (EST)
From:      Zhihui Zhang <zzhang@cs.binghamton.edu>
To:        freebsd-hackers@freebsd.org
Subject:   malloc deadlock with M_NOWAIT
Message-ID:  <Pine.SOL.4.21.0111271201200.7858-100000@onyx>

next in thread | raw e-mail | index | archive | help

I am trying to allocate a dynamic number of large memory (128K) by
malloc(128K, M_xxx, M_NOWAIT). Although this is not done in an interrupt
routine, I figure I'd better use M_NOWAIT so that I can deal with the
situation when the memory is low.  However, I experience the following
deadlock:

#1  0xc02d8f4d in vm_object_page_remove (object=0xc03fa060, start=5690,
    end=5722, clean_only=0) at ../../vm/vm_object.c:1459
#2  0xc02d53ce in vm_map_delete (map=0xc03f9ee0, start=3243479040,
    end=3243610112) at ../../vm/vm_map.c:1872
#3  0xc02d35e3 in kmem_malloc (map=0xc03f9ee0, size=131072, flags=1)
    at ../../vm/vm_kern.c:365
#4  0xc01baed7 in malloc (size=131072, type=0xc0f6ab60, flags=1)
    at ../../kern/kern_malloc.c:188

The process that calls mallocs() hangs at the following statement inside
vm_object_page_remove():

     vm_page_sleep_busy(p, TRUE, "vmopar")

At the same time, the entire system also freezes. I am wondering if I am
doing the right thing here. Maybe 128K is too large for such a use? I am
using 4.4-Release.

Any suggestion is appreciated.

-Zhihui


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.SOL.4.21.0111271201200.7858-100000>