From owner-freebsd-arch@FreeBSD.ORG Mon Nov 13 21:44:27 2006 Return-Path: X-Original-To: arch@freebsd.org Delivered-To: freebsd-arch@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5845C16A4D0 for ; Mon, 13 Nov 2006 21:44:27 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from phk.freebsd.dk (phk.freebsd.dk [130.225.244.222]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9A03A44116 for ; Mon, 13 Nov 2006 21:38:30 +0000 (GMT) (envelope-from phk@critter.freebsd.dk) Received: from critter.freebsd.dk (critter.freebsd.dk [192.168.48.2]) by phk.freebsd.dk (Postfix) with ESMTP id 57B64170C5; Mon, 13 Nov 2006 21:38:22 +0000 (UTC) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.13.8/8.13.8) with ESMTP id kADLcL5q007328; Mon, 13 Nov 2006 21:38:22 GMT (envelope-from phk@critter.freebsd.dk) To: Luigi Rizzo From: "Poul-Henning Kamp" In-Reply-To: Your message of "Mon, 13 Nov 2006 13:32:37 PST." <20061113133236.A28926@xorpc.icir.org> Date: Mon, 13 Nov 2006 21:38:21 +0000 Message-ID: <7327.1163453901@critter.freebsd.dk> Sender: phk@critter.freebsd.dk Cc: arch@freebsd.org Subject: Re: a proposed callout API X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Nov 2006 21:44:27 -0000 In message <20061113133236.A28926@xorpc.icir.org>, Luigi Rizzo writes: >On Mon, Nov 13, 2006 at 08:53:41PM +0000, Poul-Henning Kamp wrote: >> >i am a bit curious on why you want to split the callouts among >multiple data structures. A binary heap is optimal for the timeouts that will happen, but filling it up with timeouts that are unlikely to, and in most cases won't happen for a very long time will soak up CPU time used for pointlessly ordering the heap. Also, many of the "non-happening" timeouts are repeatedly rescheduled, the TCP keepalives for instance, having a data structure where this is free of cost is a big advantage. The other thing is that covering the entire range from hour long callouts to nanosecond callouts would require a 64 bit value or a tricky pseudo-FP encoding. By splitting them in two classes, I can use two different 31 bit encodings separated by the top bit. -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence.