From owner-soc-status@FreeBSD.ORG Mon Jul 16 17:36:44 2012 Return-Path: Delivered-To: soc-status@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id ED7B4106564A for ; Mon, 16 Jul 2012 17:36:43 +0000 (UTC) (envelope-from davide.italiano@gmail.com) Received: from mail-gg0-f182.google.com (mail-gg0-f182.google.com [209.85.161.182]) by mx1.freebsd.org (Postfix) with ESMTP id A8F228FC08 for ; Mon, 16 Jul 2012 17:36:43 +0000 (UTC) Received: by ggnm2 with SMTP id m2so6091691ggn.13 for ; Mon, 16 Jul 2012 10:36:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:date:x-google-sender-auth:message-id:subject :from:to:content-type; bh=uT7/q4DB0Sx7bMo7Kf9Q/HQ5qDsCAsSIQdxPcvOXKiU=; b=b0CiqCX89YZAZ1/XZKDSDtYraAfT7wStvSC4Ft/DpUpp/YowQ+yJQB+jozf8zi91xx L4Dr7AdBZrQU+M9/Ei28EvWPkqlGHeWRu1uKiY/ZFMF1tVft63PXd2c66J91jSjW9xX8 WC5ejN9uynpaJnOVdKack2GdzWCQwqM76+Q+7xK++tUjN9UfNgfeRZ9xtyLwjiPv21FT u0V5lwj7UWP7fycrang1P+kZwJG6N28V3ovEpPwoabaM0kD2H9YY4x2sF5r1/Jlv9mkg X9BfuK7voxhGBlpFwg3jWJKnvW5wBqSs2oZ3K8xFz16XNIi1Uy3pbAbG4w/P7BlgO8sb r7vg== MIME-Version: 1.0 Received: by 10.66.88.68 with SMTP id be4mr24337570pab.23.1342460202520; Mon, 16 Jul 2012 10:36:42 -0700 (PDT) Sender: davide.italiano@gmail.com Received: by 10.66.82.201 with HTTP; Mon, 16 Jul 2012 10:36:42 -0700 (PDT) Date: Mon, 16 Jul 2012 19:36:42 +0200 X-Google-Sender-Auth: LtjqxoZYDPnrrRHTJ-ZXfP4FEXs Message-ID: From: Davide Italiano To: soc-status@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Subject: Re-enginer the wheel: a rejuvenation of BSD callout(9) and timer facilities - report weeks 5-8 X-BeenThere: soc-status@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Summer of Code Status Reports and Discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Jul 2012 17:36:44 -0000 These weeks I've accomplished a fair amount of tasks: Week 5: - Modify a bit the callout(9) public KPI to avoid code duplication and breakages, as well as the sleepqueue(9) one - Event aggregation initial implementation. Augment the callout structure so that consumers other than actual time at which callout should fire may specify a tolerance interval. Rather than looking for the next callout event in callout_tick() determine a range [t-delta;t'+delta'] deriving it from the tolerance parameter specified by clients so that's suitable for a given number of events, and schedule an interrupt in the middle of such range. Week 6: - Experiment a new approach used for low-precision events, try to align them to some time borders on insert. This approach can make system load more bursty, but it is very cheap to be implemented and may be quite effective. Moreover, it can easily coexist with the previously implemented "real-time aggregation". - General polishing of the code as suggested by mav@ and bde@ Week 7: - Add a new CALLOUT_PROFILING option so that SYSCTLs on the wheel may be selectively disabled/enabled. Selectively disabling this sort of rudimentary profiling may have a good effect on CPU caches because same variable is not accessed anymore by different CPUs. - Fix a bug in the 'steps' variable logic in softclock(). It shouldn't be zeroed every time we extract a new event for processing it from cc_expireq. - Take in account aggregation when comparing event times in callout_process() and when we submit events to eventtimers(4). Week 8: - Enable execution of callout from hw interrupt context rather than sw interrupt context for kern_nanosleep() and seltdwait(). This change improves precision for select()/poll()/usleep()/nanosleep() services. - Fix an issue related to old periodic timers. The code in kern_clocksource.c uses interrupt to keep track of time, and this time may not match with binuptime(). In order to address such incoerency, switch periodic timers to binuptime(). While here, modify callout_process() so that it takes present time as argument avoiding to call binuptime() twice even though it's not strictly needed. - Make the interval timings for EVFILT_TIMER more accurate. Next step (for the next week or two) will be implement interrupt compensation in order to achieve even more better precision than now. Indeed this work is sensitive and require proper design so now I'm discussing with my mentor about a proper way to implement. The code has been proposed on freebsd-arch mailing list, and I got some useful comments. Also, Florian Smeets (flo@) offered to benchmark my changes vs HEAD so we'll soon have some results. Davide