Re: [PATCH] tcp: splice as many packets as possible at once

From: Herbert Xu
Date: Thu Jan 15 2009 - 18:20:48 EST


On Fri, Jan 16, 2009 at 12:03:31AM +0100, Willy Tarreau wrote:
>
> I'm leaving the patch below for comments, maybe someone will spot
> something ? Don't we need at least one kfree() somewhere to match
> alloc_pages() ?

Indeed.

> > static inline int spd_fill_page(struct splice_pipe_desc *spd, struct page *page,
> > unsigned int len, unsigned int offset,
> > - struct sk_buff *skb)
> > + struct sk_buff *skb, int linear)
> > {
> > if (unlikely(spd->nr_pages == PIPE_BUFFERS))
> > return 1;
> >
> > + if (linear) {
> > + page = linear_to_page(page, len, offset);
> > + if (!page)
> > + return 1;
> > + }
> > +
> > spd->pages[spd->nr_pages] = page;
> > spd->partial[spd->nr_pages].len = len;
> > spd->partial[spd->nr_pages].offset = offset;
> > - spd->partial[spd->nr_pages].private = (unsigned long) skb_get(skb);
> > spd->nr_pages++;
> > + get_page(page);

This get_page needs to be moved into an else clause of the previous
if block.

Cheers,
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
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/