From owner-freebsd-arch@FreeBSD.ORG Thu Jun 28 19:41:28 2007 Return-Path: X-Original-To: arch@freebsd.org Delivered-To: freebsd-arch@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A284416A400 for ; Thu, 28 Jun 2007 19:41:28 +0000 (UTC) (envelope-from jroberson@chesapeake.net) Received: from webaccess-cl.virtdom.com (webaccess-cl.virtdom.com [216.240.101.25]) by mx1.freebsd.org (Postfix) with ESMTP id 6DDC013C455 for ; Thu, 28 Jun 2007 19:41:28 +0000 (UTC) (envelope-from jroberson@chesapeake.net) Received: from [192.168.1.101] (c-71-231-138-78.hsd1.or.comcast.net [71.231.138.78]) (authenticated bits=0) by webaccess-cl.virtdom.com (8.13.6/8.13.6) with ESMTP id l5SJfQsu032817 (version=TLSv1/SSLv3 cipher=DHE-DSS-AES256-SHA bits=256 verify=NO) for ; Thu, 28 Jun 2007 15:41:27 -0400 (EDT) (envelope-from jroberson@chesapeake.net) Date: Thu, 28 Jun 2007 12:41:15 -0700 (PDT) From: Jeff Roberson X-X-Sender: jroberson@10.0.0.1 To: arch@freebsd.org Message-ID: <20070628123314.W552@10.0.0.1> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: Subject: Add wakeup_with() before 7.0? 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: Thu, 28 Jun 2007 19:41:28 -0000 I propose to add a new api for wakeup before 7.0. This new api would accept a wait channel and a flags argument. here's the relevant part of the diff: +void wakeup_with(void *chan, int flags) __nonnull(1); +#define WAKEUP_ONE 0x00001 /* Only wakeup on thread. */ +#define WAKEUP_ALL 0x00002 /* Wake-up all waiters. */ +#define WAKEUP_LOCAL 0x00004 /* Wake-up on the local cpu. */ +#define WAKEUP_TAIL 0x00008 /* Wake-up the newest waiter. */ This allows wakeup callers to hint the scheduler about various information. WAKEUP_LOCAL would allow us to prefer affinity for the waking cpu. I have patches to use this in pipe code and socket buffer code that improve performance in some workloads. WAKEUP_TAIL could be used for accept() which I have heard can significantly improve webserver performance. To implement this change sched_wakeup() and setrunnable() need the flags plummed all the way through. I would like feedback on whether people think the api breakage should go in now to enable these optimizations for 7.0, potentially without committing users of these flags right away. Alternatively we could break the api later or just skip it until 8.0. Thanks, Jeff