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

Herbert Xu
2009-01-15T23:20:46Z

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@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt