netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net: Fix page seeking for skb_splice_bits().
@ 2009-02-11 21:58 Jarek Poplawski
  2009-02-13  0:50 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Jarek Poplawski @ 2009-02-11 21:58 UTC (permalink / raw)
  To: David Miller; +Cc: Herbert Xu, netdev

Hi,

So, you both were right there is something wrong with splice for
multipage linear regions, at least theoretically. Since I don't know
if this can really matter in practice (could NUMA slab allocate these
pages from different tables?), I've done it against -net, but maybe
-net-next is enough?

Thanks,
Jarek P.
------------->
net: Fix page seeking for skb_splice_bits().

struct page walking should be done with proper accessor functions, not
directly.

With doubts from David S. Miller and Herbert Xu.

Signed-off-by: Jarek Poplawski <jarkao2@gmail.com>
---

 net/core/skbuff.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index da74b84..7aacd95 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -1373,8 +1373,13 @@ static inline int spd_fill_page(struct splice_pipe_desc *spd, struct page *page,
 static inline void __segment_seek(struct page **page, unsigned int *poff,
 				  unsigned int *plen, unsigned int off)
 {
+	unsigned long n;
+
 	*poff += off;
-	*page += *poff / PAGE_SIZE;
+	n = *poff / PAGE_SIZE;
+	if (n)
+		*page = nth_page(*page, n);
+
 	*poff = *poff % PAGE_SIZE;
 	*plen -= off;
 }


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net] net: Fix page seeking for skb_splice_bits().
  2009-02-11 21:58 [PATCH net] net: Fix page seeking for skb_splice_bits() Jarek Poplawski
@ 2009-02-13  0:50 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2009-02-13  0:50 UTC (permalink / raw)
  To: jarkao2; +Cc: herbert, netdev

From: Jarek Poplawski <jarkao2@gmail.com>
Date: Wed, 11 Feb 2009 22:58:06 +0100

> So, you both were right there is something wrong with splice for
> multipage linear regions, at least theoretically. Since I don't know
> if this can really matter in practice (could NUMA slab allocate these
> pages from different tables?), I've done it against -net, but maybe
> -net-next is enough?

I'll add this to net-next-2.6 because I think it's theoretical at
best.  In fact I don't think we would get allocations across
NUMA nodes in this situation.

Thanks Jarek.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-02-13  0:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-11 21:58 [PATCH net] net: Fix page seeking for skb_splice_bits() Jarek Poplawski
2009-02-13  0:50 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).