netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: andi@firstfloor.org
Cc: netdev@vger.kernel.org, ak@linux.intel.com
Subject: Re: [PATCH] ipv4: Handle very small SO_SNDTIMEOs
Date: Fri, 09 Nov 2012 16:58:00 -0500 (EST)	[thread overview]
Message-ID: <20121109.165800.16694284057880590.davem@davemloft.net> (raw)
In-Reply-To: <1352389908-28587-1-git-send-email-andi@firstfloor.org>

From: Andi Kleen <andi@firstfloor.org>
Date: Thu,  8 Nov 2012 07:51:48 -0800

> From: Andi Kleen <ak@linux.intel.com>
> 
> When the SO_SNDTIMEO timeout is short enough it may round down to zero
> jiffies.   This causes unexpected behaviour because the socket
> essentially becomes always non blocking.
> 
> Round up the timeout to at least two jiffies, so that
> we guarantee waiting for at least some time. With one jiffie
> we could potentially still wait zero time because we might
> be just at the edge of the jiffie, and if it flips over
> in the middle of the check it could be still zero.
> 
> This has been observed in a real application.
> 
> Signed-off-by: Andi Kleen <ak@linux.intel.com>

Please use usecs_to_jiffies() and, if necessary, implement the policy
there.

I'm sure that things like poll() et al. have similar if not identical
issues.  Therefore it's better to have some generic spot deal with
this problem generically.

      reply	other threads:[~2012-11-09 21:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-08 15:51 [PATCH] ipv4: Handle very small SO_SNDTIMEOs Andi Kleen
2012-11-09 21:58 ` David Miller [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=20121109.165800.16694284057880590.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=ak@linux.intel.com \
    --cc=andi@firstfloor.org \
    --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).