From: David Woodhouse <dwmw2@infradead.org>
To: Nathan Williams <nathan@traverse.com.au>
Cc: Karl Hiramoto <karl@hiramoto.org>,
"David S. Miller" <davem@davemloft.net>,
netdev@vger.kernel.org, Paul Mackerras <paulus@samba.org>,
John Crispin <blogic@openwrt.org>
Subject: Re: PPPoE performance regression
Date: Wed, 13 Jun 2012 14:50:01 +0100 [thread overview]
Message-ID: <1339595401.11011.48.camel@shinybook.infradead.org> (raw)
In-Reply-To: <1339581421.11011.18.camel@shinybook.infradead.org>
[-- Attachment #1: Type: text/plain, Size: 2129 bytes --]
On Wed, 2012-06-13 at 10:57 +0100, David Woodhouse wrote:
> This doesn't look *so* evil... if the basic concept of using
> skb_orphan() and then setting our own destructor is OK, then I'll work
> out the rest of the details and do it for l2tp too.
Stupid dwmw2. With patch this time...
diff --git a/drivers/net/ppp/pppoe.c b/drivers/net/ppp/pppoe.c
index cbf7047..ddaf156 100644
--- a/drivers/net/ppp/pppoe.c
+++ b/drivers/net/ppp/pppoe.c
@@ -689,6 +689,8 @@ static int pppoe_connect(struct socket *sock, struct sockaddr *uservaddr,
sk->sk_state = PPPOX_CONNECTED;
}
+ atomic_set(&po->inflight, -2);
+
po->num = sp->sa_addr.pppoe.sid;
end:
@@ -952,9 +954,34 @@ abort:
* sends PPP frame over PPPoE socket
*
***********************************************************************/
+static void pppoe_skb_destructor(struct sk_buff *skb)
+{
+ struct sock *sk = skb->sk;
+ struct pppox_sock *po = pppox_sk(sk);
+
+ atomic_dec(&po->inflight);
+ /* Schedule a call to ppp_output_wakeup(chan), if it was already blocked.
+ Mind for race conditions with another CPU which is in pppoe_xmit()
+ right now. See commit 9d02daf7 in pppoatm. */
+ sock_put(sk);
+}
+
static int pppoe_xmit(struct ppp_channel *chan, struct sk_buff *skb)
{
struct sock *sk = (struct sock *)chan->private;
+ struct pppox_sock *po = pppox_sk(sk);
+
+ if (!atomic_inc_not_zero(&po->inflight))
+ return 0;
+
+ /* mine! all mine! */
+ skb_orphan(skb);
+ skb->destructor = pppoe_skb_destructor;
+ /* XXX: Are there other implications of setting this? Should we use ->cb? */
+ skb->sk = sk;
+
+ sock_hold(sk);
+
return __pppoe_xmit(sk, skb);
}
diff --git a/include/linux/if_pppox.h b/include/linux/if_pppox.h
index 09c474c..339c75d 100644
--- a/include/linux/if_pppox.h
+++ b/include/linux/if_pppox.h
@@ -186,6 +186,7 @@ struct pppox_sock {
/* struct sock must be the first member of pppox_sock */
struct sock sk;
struct ppp_channel chan;
+ atomic_t inflight;
struct pppox_sock *next; /* for hash table */
union {
struct pppoe_opt pppoe;
--
dwmw2
[-- Attachment #2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 6171 bytes --]
next prev parent reply other threads:[~2012-06-13 13:51 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1339143949.24571.72.camel@dualcore.traverse>
[not found] ` <1339144110.13998.1.camel@i7.infradead.org>
[not found] ` <1339144954.24571.80.camel@dualcore.traverse>
[not found] ` <1339147045.13998.3.camel@i7.infradead.org>
[not found] ` <1339289425.2661.27.camel@laptop>
2012-06-10 8:32 ` PPPoE performance regression David Woodhouse
2012-06-13 9:57 ` David Woodhouse
2012-06-13 13:50 ` David Woodhouse [this message]
2012-06-13 15:55 ` Benjamin LaHaise
2012-06-13 16:11 ` David Woodhouse
2012-06-13 16:31 ` Benjamin LaHaise
2012-06-13 16:32 ` David Laight
2012-06-13 16:59 ` David Woodhouse
2012-06-13 16:53 ` David Woodhouse
2012-06-13 17:21 ` Benjamin LaHaise
2012-06-13 17:43 ` David Woodhouse
2012-06-14 6:18 ` Paul Mackerras
2012-06-14 6:49 ` David Woodhouse
2012-06-14 10:35 ` David Woodhouse
2012-06-13 20:17 ` Karl Hiramoto
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1339595401.11011.48.camel@shinybook.infradead.org \
--to=dwmw2@infradead.org \
--cc=blogic@openwrt.org \
--cc=davem@davemloft.net \
--cc=karl@hiramoto.org \
--cc=nathan@traverse.com.au \
--cc=netdev@vger.kernel.org \
--cc=paulus@samba.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).