[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20121109.165800.16694284057880590.davem@davemloft.net>
Date: Fri, 09 Nov 2012 16:58:00 -0500 (EST)
From: David Miller <davem@...emloft.net>
To: andi@...stfloor.org
Cc: netdev@...r.kernel.org, ak@...ux.intel.com
Subject: Re: [PATCH] ipv4: Handle very small SO_SNDTIMEOs
From: Andi Kleen <andi@...stfloor.org>
Date: Thu, 8 Nov 2012 07:51:48 -0800
> From: Andi Kleen <ak@...ux.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@...ux.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.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists