From owner-freebsd-arch@FreeBSD.ORG Fri Jun 29 00:36:00 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 74DBC16A421 for ; Fri, 29 Jun 2007 00:36:00 +0000 (UTC) (envelope-from davidxu@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [69.147.83.40]) by mx1.freebsd.org (Postfix) with ESMTP id 2B1C713C45A; Fri, 29 Jun 2007 00:36:00 +0000 (UTC) (envelope-from davidxu@freebsd.org) Received: from [127.0.0.1] (root@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id l5T0Zwru042982; Fri, 29 Jun 2007 00:35:59 GMT (envelope-from davidxu@freebsd.org) Message-ID: <46845414.609@freebsd.org> Date: Fri, 29 Jun 2007 08:36:36 +0800 From: David Xu User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.13) Gecko/20070516 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Jeff Roberson References: <20070628123314.W552@10.0.0.1> In-Reply-To: <20070628123314.W552@10.0.0.1> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Cc: arch@freebsd.org Subject: Re: 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: Fri, 29 Jun 2007 00:36:00 -0000 Jeff Roberson wrote: > 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. > Add my 1 cent here, AFAIK WAKEUP_LOCAL means the current thread will sleep or give up cpu soon, so there is no needs to wake up a thread on another cpu, right ? > 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