[lkml]   [2000]   [Sep]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: Allocating my own skbuff data
On Mon, Sep 04, 2000 at 05:25:56PM +0100, Adrian Cox wrote:
> I'm working on network drivers emulating ethernet over a PCI backplane.
> For receives I need packet data located in a region of memory visible to
> the backplane. I also want this data to be referenced by an skb, without
> the expense of an extra memcpy. This region of memory will be somewhere
> between 4MB and total memory in size, and must be located at a local
> address which is a multiple of its size.
> Which is least ugly:
> 0) Making ZONE_DMA the smaller of my region and 16MB,
> 1) making a new zone, so I can use kmalloc/kfree
> or
> 2) using my own allocator and doing the free with skb->destructor?
> 0 is a bit of a hack, and I'm using it now in PowerPC systems with no
> ISA bus.
> 1 has logical consistency, but requires changes to the mm code.
> 2 has the huge advantage of not requiring changes to the mm code, but
> I'm not sure that destructors are really meant for this sort of trick.

You can't currently use the destructors for that (at least not without
changes). They are used by the socket accounting mechanism and there is
no way to prevent the final kfree from the constructor (the only way to
make it work without source changes is to always keep the refcnt > 0 and
collect them with a timer -- not recommended)

A zone may work, but it is possible that you'll run into VM balancing

The sanest way is to probably add your own destructor to skbs.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
Please read the FAQ at

 \ /
  Last update: 2005-03-22 12:39    [W:0.032 / U:8.184 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site