Date: Sat, 29 Jan 2011 02:30:04 -0800 From: Artem Belevich <fbsdlist@src.cx> To: freebsd-fs <freebsd-fs@freebsd.org> Subject: ZFS: clock_t overflow in l2arc_feed_thread Message-ID: <AANLkTikciV_XHvrurytr0-r11W4u=_p5bRi-xfX3S%2BQm@mail.gmail.com>
next in thread | raw e-mail | index | archive | help
Hi, I'm using ZFS v15 on RELENG_8/amd64 box. Some time back I've noticed that after a while ZFS starts to consume 100% of CPU time on one of the cores. After a bit of digging it appears that the problem is due to an integer overflow. On amd64 (as wel as most other FreeBSD platforms) clock_t is a signed 32-bit integer. On OpenSolaris clock_t is long. In compat/opensolaris/sys/time.h LBOLT is defined as #define LBOLT ((gethrtime() * hz) / NANOSEC) With HZ=1000 LBOLT overflows clock_t variables when uptime reaches ~24days. This affects l2arc_write_interval() which calculates the time when L2ARC feed thread should be woken up. The end result is that for the next 24 days l2arc_feed_thread no longer sleeps as long as it should have. Changing clock_t to a larger type globally looks somewhat risky to me. It's probably easier to change those few places in ZFS code that use clock_t to uint64_t instead. In case someone is interested, I've posted my patch here: http://pastebin.com/Q2T3x2AB --Artem
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTikciV_XHvrurytr0-r11W4u=_p5bRi-xfX3S%2BQm>