* RFC: Use of "jiffies" vs "jiffies64" in the neighbour system.
@ 2015-03-25 10:11 Ulf Samuelsson
2015-03-25 10:27 ` Michal Kubecek
0 siblings, 1 reply; 3+ messages in thread
From: Ulf Samuelsson @ 2015-03-25 10:11 UTC (permalink / raw)
To: netdev
If you run HZ = 1000, then jiffies will wrap around after 49,71 days.
This means that all time compares in the neighbour system will fail.
From what I can see from "jiffies,h" there is no attempt to detect the
wrap-around.
#define time_after(a,b) \
(typecheck(unsigned long, a) && \
typecheck(unsigned long, b) && \
((long)(b) - (long)(a) < 0))
#define time_before(a,b) time_after(b,a)
#define time_after_eq(a,b) \
(typecheck(unsigned long, a) && \
typecheck(unsigned long, b) && \
((long)(a) - (long)(b) >= 0))
#define time_before_eq(a,b) time_after_eq(b,a)
While the problem is not big for most users, I suspect it will
affect quality at the time of wrap-around.
It looks like garbage collection will stop in neigh_alloc,
since time has not passed time of last flush.
reachable time will no longer be recomputed in periodic_work
When you are in REACHABLE state, you will stay there,
since "now" will be before "confirmed" +"reachable_time",
so the entry will not be moved to DELAY or STALE,
If you are in delay state, you will move the entry
into REACHABLE even if you did not get a response.
and so on....
--
Best Regards,
Ulf Samuelsson
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: RFC: Use of "jiffies" vs "jiffies64" in the neighbour system.
2015-03-25 10:11 RFC: Use of "jiffies" vs "jiffies64" in the neighbour system Ulf Samuelsson
@ 2015-03-25 10:27 ` Michal Kubecek
2015-03-25 12:35 ` Ulf Samuelsson
0 siblings, 1 reply; 3+ messages in thread
From: Michal Kubecek @ 2015-03-25 10:27 UTC (permalink / raw)
To: Ulf Samuelsson; +Cc: netdev
On Wed, Mar 25, 2015 at 11:11:45AM +0100, Ulf Samuelsson wrote:
> If you run HZ = 1000, then jiffies will wrap around after 49,71 days.
> This means that all time compares in the neighbour system will fail.
>
> From what I can see from "jiffies,h" there is no attempt to detect
> the wrap-around.
>
> #define time_after(a,b) \
> (typecheck(unsigned long, a) && \
> typecheck(unsigned long, b) && \
> ((long)(b) - (long)(a) < 0))
> #define time_before(a,b) time_after(b,a)
>
> #define time_after_eq(a,b) \
> (typecheck(unsigned long, a) && \
> typecheck(unsigned long, b) && \
> ((long)(a) - (long)(b) >= 0))
> #define time_before_eq(a,b) time_after_eq(b,a)
I might have misunderstood you but those macros do handle the
wrap-around. For example, with 64-bit long and a = 1,
b = 0xffffffffffffffff, you get
((long)(b) - (long)(a)) = (-1) - (1) = -2 < 0
so that time_after(1, 0xffffffffffffffff) is true. It will give correct
results as long as the difference is less than half of range of the
type.
Michal Kubecek
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: RFC: Use of "jiffies" vs "jiffies64" in the neighbour system.
2015-03-25 10:27 ` Michal Kubecek
@ 2015-03-25 12:35 ` Ulf Samuelsson
0 siblings, 0 replies; 3+ messages in thread
From: Ulf Samuelsson @ 2015-03-25 12:35 UTC (permalink / raw)
To: Michal Kubecek; +Cc: netdev
On 03/25/2015 11:27 AM, Michal Kubecek wrote:
> On Wed, Mar 25, 2015 at 11:11:45AM +0100, Ulf Samuelsson wrote:
>> If you run HZ = 1000, then jiffies will wrap around after 49,71 days.
>> This means that all time compares in the neighbour system will fail.
>>
>> From what I can see from "jiffies,h" there is no attempt to detect
>> the wrap-around.
>>
>> #define time_after(a,b) \
>> (typecheck(unsigned long, a) && \
>> typecheck(unsigned long, b) && \
>> ((long)(b) - (long)(a) < 0))
>> #define time_before(a,b) time_after(b,a)
>>
>> #define time_after_eq(a,b) \
>> (typecheck(unsigned long, a) && \
>> typecheck(unsigned long, b) && \
>> ((long)(a) - (long)(b) >= 0))
>> #define time_before_eq(a,b) time_after_eq(b,a)
> I might have misunderstood you but those macros do handle the
> wrap-around. For example, with 64-bit long and a = 1,
> b = 0xffffffffffffffff, you get
>
> ((long)(b) - (long)(a)) = (-1) - (1) = -2 < 0
>
> so that time_after(1, 0xffffffffffffffff) is true. It will give correct
> results as long as the difference is less than half of range of the
> type.
>
> Michal Kubecek
>
OK, Now I see why it works.
Best Regards,
Ulf Samuelsson
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-03-25 12:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-25 10:11 RFC: Use of "jiffies" vs "jiffies64" in the neighbour system Ulf Samuelsson
2015-03-25 10:27 ` Michal Kubecek
2015-03-25 12:35 ` Ulf Samuelsson
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).