Re: Allocating my own skbuff data

From: Andi Kleen (ak@suse.de)
Date: Mon Sep 04 2000 - 11:45:17 EST


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
problems.

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

-Andi
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Thu Sep 07 2000 - 21:00:18 EST