Re: kernel 3.2.27 on arm: WARNING: at mm/page_alloc.c:2109__alloc_pages_nodemask+0x1d4/0x68c()

From: Eric Dumazet
Date: Fri Oct 05 2012 - 08:39:46 EST


On Fri, 2012-10-05 at 14:37 +0200, Eric Dumazet wrote:

> diff --git a/net/core/skbuff.c b/net/core/skbuff.c
> index cdc2859..f6c1f52 100644
> --- a/net/core/skbuff.c
> +++ b/net/core/skbuff.c
> @@ -1053,11 +1053,22 @@ int pskb_expand_head(struct sk_buff *skb, int nhead, int ntail,
> {
> int i;
> u8 *data;
> - int size = nhead + skb_end_offset(skb) + ntail;
> + unsigned int tail_offset = skb_tail_pointer(skb) - skb->head;
> + int size = nhead + ntail;
> long off;
>
> BUG_ON(nhead < 0);
>
> + /* callers using nhead == 0 and ntail == 0 wants to get a fresh copy,
> + * so allocate same amount of memory (skb_end_offset)
> + * For others, they want extra head or tail against the currently
> + * used portion of header (skb->head -> skb_tail_pointer).
> + * But we dont shrink the head.
> + */
> + if (size)
> + size += tail_offset;
> + size = max_t(int, size, skb_end_offset(skb));
> +
>

This can be factorized to :

size = tail_offset + nhead + ntail;
size = max_t(int, size, skb_end_offset(skb));



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