* David Schwartz <davids@webmaster.com> wrote:These are generic statements, but i'm _really_ interested in the specifics. Real, specific code that i can look at. The typical Linux distro consists of in execess of 500 millions of lines of code, in tens of thousands of apps, so there really must be some good, valid and "right" use of sched_yield() somewhere in there, in some mainstream app, right? (because, as you might have guessed it, in the past decade of sched_yield() existence i _have_ seen my share of sched_yield() utilizing user-space code, and at the moment i'm not really impressed by those examples.) Preferably that example should show that the best quality user-space lock implementation in a given scenario is best done via sched_yield(). Actual code and numbers. (And this isnt _that_ hard. I'm not asking for a full RDBMS implementation that must run through SQL99 spec suite. This is about a simple locking primitive, or a simple pointer to an existing codebase.) (user-space spinlocks are broken beyond words for anything but perhaps SCHED_FIFO tasks.) at a quick glance this seems broken too - but if you show the specific code i might be able to point out the breakage in detail. (One underlying problem here appears to be fairness: a quick unlock/lock sequence may starve out other threads. yield wont solve that fundamental problem either, and it will introduce random latencies into apps using this memory allocator.) sure. (and i described that flag on lkml before) The sched_yield flag does two things: - if 0 ("opportunistic mode"), then the task will reschedule to any other task that is in "bigger need for CPU time" than the currently running task, as indicated by CFS's ->wait_runtime metric. (or as indicated by the similar ->vruntime metric in sched-devel.git) - if 1 ("agressive mode"), then the task will be one-time requeued to the right end of the CFS rbtree. This means that for one instance, all other tasks will run before this task will run again - after that this task's natural ordering within the rbtree is restored. do you realize that this "desired behavior" you just described is not achieved by the old scheduler, and that this random behavior _is_ the main problem here? If yield was well-specified then we could implement it in a well-specified way - even if the API was poor. But fact is that it is _not_ well-specified, and apps grew upon a random scheduler implementation details in random ways. (in the lkml discussion about this topic, Linus offered a pretty sane theoretical definition for yield but it's not simple to implement [and no scheduler implements it at the moment] - nor will it map to the old scheduler's yield behavior so we'll end up breaking more apps.) Ingo -
| Joe Perches | [PATCH 0/148] include/asm-x86: checkpatch cleanups - formatting only |
| Andreas Gruenbacher | Re: LSM conversion to static interface |
| Artem Bityutskiy | [RFC PATCH 06/26] UBIFS: add superblock and master node |
| Thomas Gleixner | Re: Linux 2.6.23-rc9 and a heads-up for the 2.6.24 series.. |
git: | |
| David Miller | Re: [GIT]: Networking |
| Gregory Haskins | [RFC PATCH 09/17] net: Add vbus_enet driver |
| Jarek Poplawski | [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock(). |
| Gerrit Renker | [PATCH 02/37] dccp: Implement lookup table for feature-negotiation information |
