Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 3 Nov 1998 19:41:03 +0000 (GMT)
From:      Terry Lambert <tlambert@primenet.com>
To:        julian@whistle.com (Julian Elischer)
Cc:        dg@root.com, lile@stdio.com, hackers@FreeBSD.ORG
Subject:   Re: "panic: free: multiple frees" VM bug? (long)
Message-ID:  <199811031941.MAA03979@usr05.primenet.com>
In-Reply-To: <Pine.BSF.3.95.981102205545.404A-100000@current1.whistle.com> from "Julian Elischer" at Nov 2, 98 08:56:38 pm

next in thread | previous in thread | raw e-mail | index | archive | help
> I also doubt if you really want to free them either..
> 
> possibly keep a pool of them and recycle them in your own free list.

Exactly what I was thinking, actually.  The problem with allocating
and freeing these things is that you could very easily fragment
the KVA space to the point where subsequent contigalloc's will fail.

FreeBSD can not (currently) relocate pages in physical memory
in order to "defrag" the KPA (Kernel Physical Address) space,
and thus most drivers that want a contiguous chunk of memory
allocate the memory early on -- usually at device attach -- to
ensure that the memory will actually be available when they
later need it.

Yes, it's theoretically possible to resolve these issues, but
they haven't been resolved yet, so it's not safe to code as if
they have.

Even so, assuming these issues *were* resolved, you'd probably
*still* want to keep a pool around to avoid the allocator overhead,
which is not inconsiderable, and at worst if you insisted on trying
to free as much memory back as possible instead of just swallowing
it forever like everyone else does, you'd high/low watermark the
usage to delay allocations and deallocations in the hopes that they
would be unnecessary, on average.

This is all more complicated than you should be working with in
the current kernel environment for the amount of memory you are
likely to be using at any one time.


					Terry Lambert
					terry@lambert.org
---
Any opinions in this posting are my own and not those of my present
or previous employers.

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?199811031941.MAA03979>