Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1300032
| Path | csiph.com!news.freedyn.net!newsfeed.datemas.de!weretis.net!feeder1.news.weretis.net!news.roellig-ltd.de!open-news-network.org!border2.nntp.ams1.giganews.com!nntp.giganews.com!news.panservice.it!diesel.cu.mi.it!bofh.it!news.nic.it!robomod |
|---|---|
| From | Mike Danese <mikedanese@google.com> |
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] net: refactor icmp_global_allow to improve readability and performance. |
| Date | Sat, 02 Jan 2016 04:30:01 +0100 |
| Message-ID | <qMl3b-2OF-3@gated-at.bofh.it> (permalink) |
| References | <qM2MW-7kN-3@gated-at.bofh.it> <qMgZA-jl-21@gated-at.bofh.it> |
| Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=JYZr4HPrDQCbR1RoASzFoMWWwO7uT/Si26K0s7G0KMg=; b=RQD7EqzRnJHW/kmnnno+vXj2+s2WkwrlHigrXF/0r4UXoY8oZVMJPDX05GeEYo7lRF U5eqdxB0SQpcgVWrFdlpz2T9ScGCQfdmrZBU0U60NThdNrXFVaTO2DivrSeY+xK8gpmp fG6O66odDRxqBdUzeI3roVSi2sBt53KjTIbHR+LDjoz1F3sO2nOQbHebg07uUAh9OzqP eYrUdFtPqyAr3M5sMDqtj9I0sQQDZs4ea32jH/qz3lje2pXLd2q42yM2zqFiajrK38fY A70Eesp+LhQDT0IJiF4pU94U0Oixwgph9g62H/M5sy4xP/PiBybxnBF/pHP/L7GFZrEM gydg== |
| X-Google-Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=JYZr4HPrDQCbR1RoASzFoMWWwO7uT/Si26K0s7G0KMg=; b=Q9msuwDhsWQNnqCubWDNhU58cLf1ujWdLxp52wxEQa6iN2PMNEUBt0NSQKRAzjlc16 H9WcOOHeq27SF/lmAfSAcmJc93r8nQLPmYMghx4Nw7//ND+rwvqV1WucFNiJl+z2Z5h4 SFw2hA3W86H6T+ThpyVlu6OBYr1Cd8JGBwVNYPpcYwD7LYe+1IenGNwH7zL+ghS9EKlv Pw4FO0Mt6d7TOTsgpUxvcrI8EfRXxg/Fa5La4KQAIRZkGmyhEt7zZfO5I4aj77k8Ac60 DnFpidMvMjqzWkiGRy0kH5iqMAAcPRpOfZUqX4yY+9YV/mW4U9MVHLoOTaLPW/CpRGkZ yNfA== |
| X-Gm-Message-State | ALoCoQmoBjeO9FC+le/+2exSLVYkJBVfsznPwXW33A6zUSaavqgeHHqHzPXu6UVauuOjCWd/sb4eNR+nwFMLog3GxlcP9UuRjqa6jPVoTyVOzDJQWyRUt+A= |
| MIME-Version | 1.0 |
| X-Received | by 10.107.136.10 with SMTP id k10mr85268199iod.0.1451704841285; Fri, 01 Jan 2016 19:20:41 -0800 (PST) |
| Content-Type | text/plain; charset=UTF-8 |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 55 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>, Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>, James Morris <jmorris@namei.org>, Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>, Patrick McHardy <kaber@trash.net>, open list <linux-kernel@vger.kernel.org> |
| X-Original-Date | Fri, 1 Jan 2016 19:20:41 -0800 |
| X-Original-Message-ID | <CAMu1AU5vWoV9+vSq-zbfkcT4+8kxZvr-RQZqUY7GmcSe4KyFYg@mail.gmail.com> |
| X-Original-References | <1451635091-109673-1-git-send-email-mikedanese@google.com> <1451689635.8255.71.camel@edumazet-glaptop2.roam.corp.google.com> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1300032 |
Show key headers only | View raw
Yes, I completely missed the purpose of that. As a new year's
resolution, I resolve to read the comments.
Thanks for the review!
On Fri, Jan 1, 2016 at 3:07 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> On Thu, 2015-12-31 at 23:58 -0800, Mike Danese wrote:
>> We can reduce the number of operations performed by icmp_global_allow
>> and make the routine more readable by refactoring it in two ways:
>>
>> First, this patch refactors the meaning of the "delta" variable. Before
>> this change, it meant min("time since last refill of token bucket", HZ).
>> After this change, it means "time since last refill". The original
>> definition is required only once but was being calculated twice. The new
>> meaning is also more intuitive for a variable named "delta".
>>
>> Second, by calculating "delta" (time since last refill of token bucket)
>> and "cbr" (token bucket can be refilled) at the beginning of the
>> routine, we reduce the number of repeated calculations of these two
>> variables.
>>
>> There should be no functional difference.
>>
>> Signed-off-by: Mike Danese <mikedanese@google.com>
>> ---
>> net/ipv4/icmp.c | 17 ++++++++---------
>> 1 file changed, 8 insertions(+), 9 deletions(-)
>
> Hi Mike
>
> Sorry, this is a very broken patch.
>
> There is a comment you apparently missed completely :
>
> /* Check if token bucket is empty and cannot be refilled
> * without taking the spinlock.
> */
>
> There is a reason we compute 'delta' two times.
>
> One without the spinlock held, and a second time with the spinlock held.
>
> This is an opportunistic way to exit early without false sharing in the
> stress case where many cpus might enter this code.
>
> Really I do not think current code needs any 'refactoring', especially
> around December 31th at midnight ;)
>
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH] net: refactor icmp_global_allow to improve readability and performance. Mike Danese <mikedanese@google.com> - 2016-01-01 09:00 +0100
Re: [PATCH] net: refactor icmp_global_allow to improve readability and performance. Eric Dumazet <eric.dumazet@gmail.com> - 2016-01-02 00:10 +0100
Re: [PATCH] net: refactor icmp_global_allow to improve readability and performance. Mike Danese <mikedanese@google.com> - 2016-01-02 04:30 +0100
csiph-web