From: Jesper Dangaard Brouer <brouer@redhat•com>
To: Eric Dumazet <eric.dumazet@gmail•com>
Cc: netdev@vger•kernel.org, brouer@redhat•com
Subject: Re: [net-next PATCH] net: reduce cycles spend on ICMP replies that gets rate limited
Date: Sat, 7 Jan 2017 10:28:01 +0100 [thread overview]
Message-ID: <20170107102801.49fdf5f0@redhat.com> (raw)
In-Reply-To: <1483740486.9712.41.camel@edumazet-glaptop3.roam.corp.google.com>
On Fri, 06 Jan 2017 14:08:06 -0800
Eric Dumazet <eric.dumazet@gmail•com> wrote:
> On Fri, 2017-01-06 at 11:40 -0800, Eric Dumazet wrote:
> > On Fri, 2017-01-06 at 18:39 +0100, Jesper Dangaard Brouer wrote:
> >
> >
> > > @@ -648,13 +668,17 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info)
> > > }
> > > }
> > >
> > > - icmp_param = kmalloc(sizeof(*icmp_param), GFP_ATOMIC);
> > > - if (!icmp_param)
> > > - return;
> > > -
> > > sk = icmp_xmit_lock(net);
> > > if (!sk)
> > > - goto out_free;
> > > + goto out;
> > > +
> > > + /* Check global sysctl_icmp_msgs_per_sec ratelimit */
> > > + if (!icmpv4_global_allow(net, type, code))
> > > + goto out_unlock;
> > > +
> > > + icmp_param = kmalloc(sizeof(*icmp_param), GFP_ATOMIC);
> > > + if (!icmp_param)
> > > + goto out_unlock;
> >
>
> You could call icmp_xmit_lock() _after_ checking global limit perhaps.
>
> That would remove one atomic op.
The reason I don't do this is, because icmp_xmit_lock() disables BH and
icmp_global_allow() have a comment that it need to run with BH-disabled.
Thus, I'm depending on the BH-disable from icmp_xmit_lock().
I would have to move out the BH-disable part of icmp_xmit_lock, to do
this. Would that be acceptable?
--
Best regards,
Jesper Dangaard Brouer
MSc.CS, Principal Kernel Engineer at Red Hat
LinkedIn: http://www.linkedin.com/in/brouer
prev parent reply other threads:[~2017-01-07 9:28 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-06 17:39 [net-next PATCH] net: reduce cycles spend on ICMP replies that gets rate limited Jesper Dangaard Brouer
2017-01-06 19:40 ` Eric Dumazet
2017-01-06 22:08 ` Eric Dumazet
2017-01-07 3:10 ` David Miller
2017-01-07 10:31 ` Jesper Dangaard Brouer
2017-01-07 9:28 ` Jesper Dangaard Brouer [this message]
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=20170107102801.49fdf5f0@redhat.com \
--to=brouer@redhat$(echo .)com \
--cc=eric.dumazet@gmail$(echo .)com \
--cc=netdev@vger$(echo .)kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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