Re: Add wakeup_with() before 7.0?



2007/6/28, Jeff Roberson <jroberson@xxxxxxxxxxxxxx>:
On Thu, 28 Jun 2007, John Baldwin wrote:

> On Thursday 28 June 2007 03:41:15 pm 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.
>>
>> 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.
>
> We have something like WAKEUP_TAIL (but different, it also prefers non-swapped
> out processes in addition to taking the most recently suspended thread) at
> work for accept() and it just modifies the sleepq code's choice in
> sleepq_signal() of which thread to pick, it doesn't touch any of the
> scheduler stuff at all. OTOH, I think the scheduler ABIs are ok to change
> during 7.x as they aren't exposed to any KLD's (no well-behaving ones anyway)
> as drivers, etc. should all be using higher-level APIs like cv_*() or
> *sleep().

In my implementation the WAKEUP_TAIL call just changes the sleepq as well.
It doesn't go down to the scheduler. I agree that well behaving drivers
should not use setrunnable() or sched_wakeup(). Maybe that is ok to
break later. Any other opinions?

1) I would like to call the function wakeup_flags() as wakeup_with()
is not approprate IMHO
2) I would commit just for 8.0 since currently there is no real
consumer of it. For 8.0 we can have time to rework the accept code in
order to use it
3) Is the code of wakeup_with() alredy available?

Thanks,
Attilio


--
Peace can only be achieved by understanding - A. Einstein
_______________________________________________
freebsd-arch@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "freebsd-arch-unsubscribe@xxxxxxxxxxx"



Relevant Pages

  • Re: Add wakeup_with() before 7.0?
    ... This allows wakeup callers to hint the scheduler about various ... waking cpu. ... To implement this change sched_wakeupand setrunnableneed the flags ... Alternatively we could break the api later or just skip it until 8.0. ...
    (freebsd-arch)
  • Add wakeup_with() before 7.0?
    ... This new api would accept a wait channel and a flags argument. ... This allows wakeup callers to hint the scheduler about various information. ... WAKEUP_TAIL could be used for acceptwhich I have heard can significantly improve webserver performance. ... To implement this change sched_wakeupand setrunnableneed the flags plummed all the way through. ...
    (freebsd-arch)
  • Re: [RFC] [Patch 7/8] statistics infrastructure - exploitation prerequisite
    ... Andrew Morton wrote: ... scheduler thing and has a number of accuracy problems. ... I would be happy to exploit an API that may result from that discussion. ...
    (Linux-Kernel)
  • Re: Win32_ScheduledJob
    ... >>When i am trying to list scheduled jobs via Win32_ScheduledJob ... >>should i use something else than WMI? ... > support to use these API, you need to write some COM Interop in your .NET ... > Wrapper Classes for the Windows Task Scheduler ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: posix scheduler
    ... I'm confused about scheduling pthreads in RTP when using posix scheduler. ... and pthread_getconcurrencyAPI. ...
    (comp.os.vxworks)