Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 15 Oct 1997 00:25:22 +0200 (CEST)
From:      Mikael Karpberg <karpen@ocean.campus.luth.se>
To:        rhh@ct.picker.com (Randall Hopper)
Cc:        hackers@FreeBSD.ORG
Subject:   Re: LKM & Large contig malloc failure (Re: lkms versus hard linked drivers)
Message-ID:  <199710142225.AAA03324@ocean.campus.luth.se>
In-Reply-To: <19971014165143.34402@ct.picker.com> from Randall Hopper at "Oct 14, 97 04:51:43 pm"

next in thread | previous in thread | raw e-mail | index | archive | help
According to Randall Hopper:
> Julian Elischer:
>  |mdean wrote:
>  |> My question is very simple: What can't be a lkm?
>  |
>  |the only function that MUST be done at bootup is allocation of LARGE
>  |physically contiguous buffers of ram.  because after running a few
>  |seconds ram get's fragmented..  large VIRTUALLY contiguous buffers are
>  |ok.
> 
> That explains it.  I just spent some time LKMizing the Brooktree (bktr) PCI
> capture driver to speed up development, only to find last night that
> vm_page_alloc_contig would just hang, whittling away swap and consuming 50%
> CPU with no end in sight.  
> 
> The driver is one of the few that does large contiguous mallocs (first a
> 32K bite; then a 3.5Meg gulp).
> 
> Searching the list archives for tips, I happened upon your post.
> 
> What's the best way around this?  Have a dummy "grab the memory" stub driver
> that runs on bootup, and then have the real driver in the LKM "borrow" this
> memory chunk away when it loads.  Not real clean, so this would of course
> just be a "for-development-only" hack.
> 
> Would sure be nice to make the driver generally available as an LKM though.
> Can anyone see a cleaner way around this problem?

Umm... fix vm_page.c:contigmalloc() so it can, when needed, compact the
memory, and maybe force stuff out of the swap, etc, so that the request
can always be fulfilled if there is enough non-wired memory in the machine?

That's the best solution, isn't it? Many people have wanted it, but no one
has done it. Is that because it's impossible with the current VM (and would
therefor require major rewrites of the VM system, which is non trivial), or
is it because it's a lot of work, but even so, not rocket sience? Dunno.

Dyson should know, as should a few more people, I guess. If it's just lots
of work, and not rocket sience, maybe you could give it a shot? I'm sure it
would be appreciented. Could someone with Real Knowledge (tm) or this let
us know if it's possible, and maybe estimate quickly what would have to be
done and how much work it is?

If it's possible to do without any real hanges in the VM system, etc,
this seems like fine project for someone;
not desperately needed, but very practical.

I might be able to look at it myself after exams, since I basically have
to update my workstation to -current soon anyway for the pnp, etc.

But then again... I'm just bored enough to answer this without any real
knowledge in the subject, adding more mails to everyones mailbox.... :-)

  /Mikael



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199710142225.AAA03324>