Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 1 Jul 2006 22:34:44 +1000
From:      Peter Jeremy <peterjeremy@optushome.com.au>
To:        Hans Petter Selasky <hselasky@c2i.net>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: contiguous memory allocation problem
Message-ID:  <20060701123444.GD8447@turion.vk2pj.dyndns.org>
In-Reply-To: <200607011044.54872.hselasky@c2i.net>
References:  <200605271102.19799.hselasky@c2i.net> <200606302029.28563.hselasky@c2i.net> <20060630203226.GG734@turion.vk2pj.dyndns.org> <200607011044.54872.hselasky@c2i.net>

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

--uxuisgdDHaNETlh8
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Sat, 2006-Jul-01 10:44:54 +0200, Hans Petter Selasky wrote:
>Yes, but scatter and gather will add extra complexity to the driver, and m=
aybe
>an extra memory copy in most cases. The idea is to allocate less than or=
=20
>equal to a page of memory, and then avoid the problem?

The idea is to allocate multiple disjoint pages of physical memory.
The USB hardware is capable of supporting this and page translation
hides the lack of contiguousness from userland.  I don't see why
additional memory copies would be required.

>The most important thing is to keep memory allocations of constant size. F=
or=20
>example under my USB system, all memory is allocated at attach. There is n=
o=20
>longer allocation and freeing of memory during usage, with a few exception=
s.=20

Are you talking about USB device attach - which could happen at any
time whilst the system is running - or USB bus attach?

>I was thinking I could pre-allocate 2-4MB for the USB system, then make a=
=20
>list of freed memory blocks, and then search this list first, before=20
>allocating new memory.

That strikes me as wasteful.  Currently, umass needs something like
64K (or maybe 128K) and ulpt needs a few KB (they are the only USB
devices I normally use).  I would be surprised if the peak USB RAM
requirement was more than 256K for most people.  "vmstat -m" on my
systems shows that the current biggest consumer is devbuf - with
3-4MB.  Most other consumers are orders of magnitude smaller than this
(though my video capture card grabs about 4MB RAM when it's in use).

--=20
Peter Jeremy

--uxuisgdDHaNETlh8
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (FreeBSD)

iD8DBQFEpmvj/opHv/APuIcRAryCAJ9Y/Xk3IMRd1KWxs1/hJivW5Cv54wCgn79C
vGZ0NLw5uDP+8ZLkBaNWZ5k=
=0mb4
-----END PGP SIGNATURE-----

--uxuisgdDHaNETlh8--



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