DCCP protocol discussions
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
To: dccp@vger.kernel.org
Subject: Re: [PATCH v2  4/5]: Rate-limit DCCP-Syncs
Date: Tue, 25 Sep 2007 11:35:27 +0000	[thread overview]
Message-ID: <20070925113527.GA18348@ghostprotocols.net> (raw)
In-Reply-To: <200709251058.41805@strip-the-willow>

Em Tue, Sep 25, 2007 at 10:58:41AM +0100, Gerrit Renker escreveu:
> Arnaldo -
> 
> |  Algorithm is fine, just use time_after when comparing jiffies based
> |  timestamps, here:
> Many thanks for pointing this out - it was a stupid oversight. The interdiff
> to the previous patch is:
> 
>  		 *   These Syncs are rate-limited as per RFC 4340, 7.5.4:
>  		 *   at most 1 / (dccp_sync_rate_limit * HZ) Syncs per second.
>  		 */
> -		if (now - dp->dccps_rate_last >= sysctl_dccp_sync_ratelimit) {
> +		if (time_after(now, dp->dccps_rate_last 
> +				  + sysctl_dccp_sync_ratelimit)) {
>  			dp->dccps_rate_last = now;
>  			/* ... */
> 
> I have only compile-tested this, but verified twice on paper, and it looks correct
> (the `>=' has been replaced with `>', using `time_after_eq' does not seem necessary).
> Please find update below.

Thanks, some nits below:
 
>  
> --- a/net/dccp/sysctl.c
> +++ b/net/dccp/sysctl.c
> @@ -18,6 +18,9 @@
>  #error This file should not be compiled without CONFIG_SYSCTL defined
>  #endif
>  
> +/* rate-limit for syncs in reply to sequence-invalid packets; RFC 4340, 7.5.4 */
> +int sysctl_dccp_sync_ratelimit	__read_mostly = HZ / 8;

Why the extra spaces/tabs before __read_mostly? Don't worry about this
one or the other ones you submitted so far, I'll eventually do a coding
style cleanup once the number of outstanding patches gets to some
manageable level, but please take this in consideration for your next
patches, ok? One more:

> --- a/net/dccp/proto.c
> +++ b/net/dccp/proto.c
> +		if (time_after(now, dp->dccps_rate_last
> +				  + sysctl_dccp_sync_ratelimit)) {

In linux networking code what has been the most accepted form for
multiline expressions is:

		if (time_after(now, (dp->dccps_rate_last +
				     sysctl_dccp_sync_ratelimit))) {

Either form produces the same code, but as the later is what I, David
and others are most confortable with and have been using for quite a
while, please try to get used to doing it this way, ok?

Thanks!

- Arnaldo

  reply	other threads:[~2007-09-25 11:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-25  9:58 [PATCH v2 4/5]: Rate-limit DCCP-Syncs Gerrit Renker
2007-09-25 11:35 ` Arnaldo Carvalho de Melo [this message]
2007-09-25 12:16 ` Gerrit Renker
2007-09-25 12:27 ` Arnaldo Carvalho de Melo

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=20070925113527.GA18348@ghostprotocols.net \
    --to=acme@ghostprotocols.net \
    --cc=dccp@vger.kernel.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