mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 10:41:38 -04:00
time: jiffies_delta_to_clock_t() helper to the rescue
Various /proc/net files sometimes report crazy timer values, expressed
in clock_t units.
This happens when an expired timer delta (expires - jiffies) is passed
to jiffies_to_clock_t().
This function has an overflow in :
return div_u64((u64)x * TICK_NSEC, NSEC_PER_SEC / USER_HZ);
commit cbbc719fcc (time: Change jiffies_to_clock_t() argument type
to unsigned long) only got around the problem.
As we cant output negative values in /proc/net/tcp without breaking
various tools, I suggest adding a jiffies_delta_to_clock_t() wrapper
that caps the negative delta to a 0 value.
Signed-off-by: Eric Dumazet <[email protected]>
Reported-by: Maciej Żenczykowski <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Paul Gortmaker <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: hank <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
This commit is contained in:
parent
79cda75a10
commit
a399a80531
7 changed files with 22 additions and 19 deletions
|
|
@ -312,7 +312,7 @@ int br_fdb_fillbuf(struct net_bridge *br, void *buf,
|
|||
|
||||
fe->is_local = f->is_local;
|
||||
if (!f->is_static)
|
||||
fe->ageing_timer_value = jiffies_to_clock_t(jiffies - f->updated);
|
||||
fe->ageing_timer_value = jiffies_delta_to_clock_t(jiffies - f->updated);
|
||||
++fe;
|
||||
++num;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -170,5 +170,5 @@ void br_stp_port_timer_init(struct net_bridge_port *p)
|
|||
unsigned long br_timer_value(const struct timer_list *timer)
|
||||
{
|
||||
return timer_pending(timer)
|
||||
? jiffies_to_clock_t(timer->expires - jiffies) : 0;
|
||||
? jiffies_delta_to_clock_t(timer->expires - jiffies) : 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue