From owner-soc-status@FreeBSD.ORG Tue Jun 19 15:53:32 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 C238B1065672 for ; Tue, 19 Jun 2012 15:53:32 +0000 (UTC) (envelope-from davide.italiano@gmail.com) Received: from mail-vc0-f182.google.com (mail-vc0-f182.google.com [209.85.220.182]) by mx1.freebsd.org (Postfix) with ESMTP id 7A12F8FC18 for ; Tue, 19 Jun 2012 15:53:32 +0000 (UTC) Received: by vcbfy7 with SMTP id fy7so4241088vcb.13 for ; Tue, 19 Jun 2012 08:53:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=KZX4mbxJH22qUK3Vf+L9VBZ5yRd8APiSJrV9xfDJUcs=; b=Zj8PH0/sxi/CGHjJ6lHCZ+AwLAi8tjqm0Il19+f+fsgovYDlJHli99CcweFApjtuQ2 IQML1ybOCZMA8yCuYKAnI2YukKIqgNryMlUOHmEFBlu6fibwEgps/KrmiBRtcaHY01xG bRMMoqqal4lSQAxtAXXyfUUoNEzNC2ULdogKmJr6XipF9o32JeqqL2hYcLSlFFiet9aP Nj0Y4V0E7YHGjgzcgcishgcUJ11Ud/7nRDzz+MDKIhE+38hfIFTI+bmloDwALuq2fQdg Tvrbp4mrAaBd/eIIJNqJvvcqaVSiUQugKsPnaUbu2md3BjsYoKCiOZTEVJBoMtirtVpr JqoA== MIME-Version: 1.0 Received: by 10.220.215.136 with SMTP id he8mr10021596vcb.13.1340121211953; Tue, 19 Jun 2012 08:53:31 -0700 (PDT) Received: by 10.52.28.132 with HTTP; Tue, 19 Jun 2012 08:53:31 -0700 (PDT) Date: Tue, 19 Jun 2012 17:53:31 +0200 Message-ID: From: Davide Italiano To: soc-status@FreeBSD.org Content-Type: text/plain; charset=ISO-8859-1 Cc: Subject: Re-enginer the wheel: a rejuvenation of BSD callout(9) and timer facilities - report weeks 1-4 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: Tue, 19 Jun 2012 15:53:32 -0000 Hi, I apologize for the delay in submitting but here's what I've done recently. A complete commit history may be found here: http://freshbsd.org/search?q=committer%3Adavide&branch=PROJECT_CALLOUTNG Week 1: - Switch the callout(9) backend from ticks to struct bintime in order achieve better precision - Rework the callout data-structure in order to survive to these changes paying attention to avoid breakages (if possible) - Introducing a separate per-cpu queue in order to process callout once they're examined in callout_tick - Convert some tcp_timer related code that rely on tick-based nature of backend, without this change, world won't build Week 2: - Fix some bug that causes random memory corruption on the list and so unexpected behaviour of the system - Optimize the callout_tick() code to scan the entire wheel only when it's needed - Integrate the switched backend with the eventtimers(4) infrastructure to exploit better precision - refactor the cpu_new_callout() function in sys/kern/kern_clocksource.c to adapt to the aforementioned changes Week 3: - Start to experiment an extension of the current KPI adding the callout_reset_bt_on() in which we specify timeouts in terms of struct bintime rather than ticks. - Add (experimentally) a function to the sleepqueue(9) KPI sleepq_set_timeout_bt() in which the timeout may be specified in terms of bintime rather than ticks, and which takes advantage of the new precision capabilities of the callout subsystem. - Convert usleep() service to the new KPI callout_reset_bt_on() - Run some benchmarks to see how much we gained: resutls may be found here http://blogs.freebsdish.org/davide/2012/06/07/the-tale-of-usleep-a-k-a-sometimes-precision-matters/ Week 4: -Fix (or at least, workaround) an include conflict in libprocstat which causes buildworld to fail, after my recent changes to sys/sys/_callout.h header. - Extend the condvar(9) KPI introducing a new cv_timedwait_bt_sig() function so that we can specify timeout precision in terms of struct bintime. - Refactor the kern_select() and the sys_poll() code so that these two services may rely on cv_timedwait_bt_sig() rather than on the previous less precise cv_timedwait_sig(). - Optimize callout_tick() code avoiding some computation of the callwheel bucket when it's not needed - Run benchmark on usleep() again, as well as on select(). Results are so much better than before: : http://blogs.freebsdish.org/davide/2012/06/17/random-updates/ Davide