linux-mips
[Top] [All Lists]

Re: [PATCH] Staging: Octeon Ethernet: Fix memory allocation.

To: David Daney <ddaney@caviumnetworks.com>
Subject: Re: [PATCH] Staging: Octeon Ethernet: Fix memory allocation.
From: Ralf Baechle <ralf@linux-mips.org>
Date: Wed, 27 Jan 2010 22:33:51 +0100
Cc: linux-mips@linux-mips.org
In-reply-to: <1264627373-31780-1-git-send-email-ddaney@caviumnetworks.com>
References: <1264627373-31780-1-git-send-email-ddaney@caviumnetworks.com>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Mutt/1.5.20 (2009-08-17)
On Wed, Jan 27, 2010 at 01:22:53PM -0800, David Daney wrote:

> After aligning the blocks returned by kmalloc, we need to save the
> original pointer so they can be correctly freed.
> 
> There are no guarantees about the alignment of SKB data, so we need to
> handle worst case alignment.
> 
> Since right shifts over subtraction have no distributive property, we
> need to fix the back pointer calculation.
> 
> Signed-off-by: David Daney <ddaney@caviumnetworks.com>
> ---
> 
> The original in the linux-queue tree is broken as it assumes the
> kmalloc returns aligned blocks.  This is not the case when slab
> debugging is enabled.

Queue updated - but shouldn't the magic numbers 128 rsp 256 all over this
patch be replaced by L1_CACHE_SHIFT rsp 2 * L1_CACHE_SHIFT?

  Ralf

<Prev in Thread] Current Thread [Next in Thread>