From owner-freebsd-fs@FreeBSD.ORG Sat Jan 29 10:30:06 2011 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1C4A81065674 for ; Sat, 29 Jan 2011 10:30:06 +0000 (UTC) (envelope-from artemb@gmail.com) Received: from mail-bw0-f54.google.com (mail-bw0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id 965BF8FC14 for ; Sat, 29 Jan 2011 10:30:05 +0000 (UTC) Received: by bwz12 with SMTP id 12so4081093bwz.13 for ; Sat, 29 Jan 2011 02:30:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:date:x-google-sender-auth :message-id:subject:from:to:content-type; bh=+DnuSuqpt9wE08Ar59IwjEO5K1uJ6gJrFcV2WMWqP8I=; b=HI96FoyfLH9/AgdQUW8AZGa45QR522i/CQv01pD24iO3GdM8YKmYT2BjzOflVPgTMO rR9aJpBzDR6iBKeBsIqnnDlG1uvh3x092avhxkxsNIkqr9DeVE+0+xXucWTUAequLeQe UDoByJZhD2JdqeADrkbYbL6NJx6/KWQsz6PvU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:date:x-google-sender-auth:message-id:subject :from:to:content-type; b=SL844dkub5NNmJh3Pl1exDeIQW9ZrbKHr04+ldcbHQkPc5/NGlxzDaBXZUbyKx3kE7 oJieDAzAieJMH+xxK7/XQ7t6bOAPmBi2mWxt2FYE9vlzlB/tCJXih896An7Lg5Y15ClS 2q6/Amf0RJwRjUeazKeJTunIOpst3ydY5qCl0= MIME-Version: 1.0 Received: by 10.204.72.20 with SMTP id k20mr3299297bkj.184.1296297004129; Sat, 29 Jan 2011 02:30:04 -0800 (PST) Sender: artemb@gmail.com Received: by 10.204.49.13 with HTTP; Sat, 29 Jan 2011 02:30:04 -0800 (PST) Date: Sat, 29 Jan 2011 02:30:04 -0800 X-Google-Sender-Auth: jSKLG_wCLhCDD0ZKMxR86iFhJEQ Message-ID: From: Artem Belevich To: freebsd-fs Content-Type: text/plain; charset=ISO-8859-1 Subject: ZFS: clock_t overflow in l2arc_feed_thread X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Jan 2011 10:30:06 -0000 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