Add wakeup_with() before 7.0?

Robert Watson rwatson at FreeBSD.org
Fri Jun 29 01:18:07 UTC 2007


On Thu, 28 Jun 2007, 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.

What will this flag do if there are no sleepers on the current CPU, but there 
are sleepers on other CPUs?

> */
> +#define        WAKEUP_TAIL     0x00008         /* Wake-up the newest waiter. 
> */

Another flag I've played with adding in the past has been WAKEUP_NOPREEMPT, 
which would hint to the scheduler that a brief priority inversion is preferred 
to excessive context switching.

> 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.

I've not looked at the details here, but my general feeling is that if we 
think that making the API change now is low-risk (i.e., won't be error-prone), 
and we think it's very unlikely we might want to further revise them, I'm OK 
with it happening before the branch.  I think I wouldn't expose the flags 
themselves at this point in 7.x, just the function prototype change.

Robert N M Watson
Computer Laboratory
University of Cambridge


More information about the freebsd-arch mailing list