netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Imre Deak <imre.deak@intel.com>
To: Michal Kubecek <mkubecek@suse.cz>
Cc: linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Daniel Vetter <daniel.vetter@ffwll.ch>,
	Jay Vosburgh <fubar@us.ibm.com>,
	Andy Gospodarek <andy@greyhouse.net>,
	netdev@vger.kernel.org
Subject: Re: [PATCH 06/11] net/bonding: take msecs_to_jiffies_min into use
Date: Sat, 11 May 2013 00:19:36 +0300	[thread overview]
Message-ID: <1368220776.18714.30.camel@ideak-mobl> (raw)
In-Reply-To: <20130510135810.GA30139@unicorn.suse.cz>

On Fri, 2013-05-10 at 15:58 +0200, Michal Kubecek wrote:
> On Fri, May 10, 2013 at 03:13:24PM +0300, Imre Deak wrote:
> > --- a/drivers/net/bonding/bond_main.c
> > +++ b/drivers/net/bonding/bond_main.c
> > @@ -1751,7 +1751,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
> >  	read_lock(&bond->lock);
> >  
> >  	new_slave->last_arp_rx = jiffies -
> > -		(msecs_to_jiffies(bond->params.arp_interval) + 1);
> > +		(msecs_to_jiffies_min(bond->params.arp_interval));
> >  
> >  	if (bond->params.miimon && !bond->params.use_carrier) {
> >  		link_reporting = bond_check_dev_link(bond, slave_dev, 1);
> 
> This "+ 1" was actually meant as "plus one". We need to ensure that
> 
>   slave->last_arp_rx + msecs_to_jiffies(bond->params.arp_interval)
> 
> is strictly less than current value of jiffies.

Ok, I see, the adjustment here is for a different reason and
msecs_to_jiffies_min wouldn't express this properly. So we should drop
this patch. Perhaps it'd be nice to add something like the above
explanation as a code comment, to make it clear that the adjustment is
not for guaranteeing a minimum duration as it is in many other places.

--Imre

> So with proposed
> definition of msecs_to_jiffies_min() it works correctly but if the
> implementation ever changes in such way that
> 
>   msecs_to_jiffies_min(x) >= msecs_to_jiffies(x)
> 
> for some value of x, the code would be incorrect.
> 
>                                                        Michal Kubeček
> 

  reply	other threads:[~2013-05-10 21:19 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1368542918-8861-1-git-send-email-imre.deak@intel.com>
     [not found] ` <1368188011-23661-1-git-send-email-imre.deak@intel.com>
2013-05-10 12:13   ` [PATCH 06/11] net/bonding: take msecs_to_jiffies_min into use Imre Deak
2013-05-10 13:58     ` Michal Kubecek
2013-05-10 21:19       ` Imre Deak [this message]
2013-05-10 12:13   ` [PATCH 07/11] net/peak_pcmcia: " Imre Deak
2013-05-15  9:12     ` Marc Kleine-Budde
2013-05-15 11:45       ` Marc Kleine-Budde
2013-05-10 12:13   ` [PATCH 09/11] net/sunrpc: " Imre Deak
2013-05-10 12:13   ` [PATCH 10/11] net/tipc: " Imre Deak
2013-05-14 14:48   ` [PATCH v2 6/8] net/sunrpc: take msecs_to_jiffies_timeout " Imre Deak
2013-05-14 14:48   ` [PATCH v2 7/8] net/tipc: " Imre Deak

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=1368220776.18714.30.camel@ideak-mobl \
    --to=imre.deak@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=andy@greyhouse.net \
    --cc=daniel.vetter@ffwll.ch \
    --cc=fubar@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mkubecek@suse.cz \
    --cc=netdev@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;
as well as URLs for NNTP newsgroup(s).