From owner-freebsd-hackers Fri Oct 12 8: 1:21 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from web.cs.ndsu.nodak.edu (web.cs.ndsu.NoDak.edu [134.129.125.7]) by hub.freebsd.org (Postfix) with ESMTP id 9A8D837B405 for ; Fri, 12 Oct 2001 08:01:10 -0700 (PDT) Received: (from tinguely@localhost) by web.cs.ndsu.nodak.edu (8.11.4/8.11.4) id f9CF17Y14052; Fri, 12 Oct 2001 10:01:07 -0500 (CDT) (envelope-from tinguely) Date: Fri, 12 Oct 2001 10:01:07 -0500 (CDT) From: mark tinguely Message-Id: <200110121501.f9CF17Y14052@web.cs.ndsu.nodak.edu> To: dillon@earth.backplane.com, Patrick.Cipiere@UDcast.com Subject: Re: contigfree, free what? Cc: freebsd-hackers@FreeBSD.ORG Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Patrick Cipiere says: > > :We are currently working with FreeBSD 4.3 and we found out that > :kldloading/kldunloading modules working with contigmalloc()/contigfree() > :like if_xl.ko produces a memory leak. > : > :This is due to the contigfree() function which seems to uncompletely release > :the memory ressource allocated in vm_page_array. > : > :When contigmalloc() steps in vm_page_array, it does not find back > :the pages previously released by contigfree() > :The loop vm/vm_page.c is this one: In FreeBSD 4.4 (and I do not think there is any change from 4.3), I placed the contigmalloc/free using the if_xl.c structures in a new PCI probe routine so it gets called several times in a boot process. I also placed some checks on vm_map_delete to see if the range of map gets modified (and therefore some pages are not freed. Everything works correctly; the correct amount is free, and the entry that this map is found in is completely the amount of the contigmalloc. Most of the time, I get the very same range, but as I started adding drivers and reserving memory, the start of contigmalloc creaps up, as expected. I think you are hitting the problem that contigmalloc cannot be guarrenteed to work once the physical memory becomes used and there is no range large enough for your new contigmalloc. That is why large contigmallocs are done at boot time. I did not try this with a loadable module, so I can't say if there is or is not a feature of the loading/unloading of the module that allocates memory that fills part of your contiguous range. Do you wish patches to VM code to verify that the free is done completely? --mark tinguely To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message