lkml.org 
[lkml]   [2000]   [Feb]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [patch] adaptive semaphores: better performance for "short semaphores" or "long spinlocks"
Date
In article <m12PK8P-000OXCC@amadeus.home.nl>, you write:
>Nice idea! One more thought: Would it be possible (and useful) if the
>time
>spent in spinning is changed dynamically?
>I mean:
> 1) If a lock needed schedule the previous time, decrease the time
> spinning for the next time the lock is contented
> 2) If a lock didn't need to schedule, have a little more patience
> and spin somewhat longer the next time
>
>The heuristic can look a bit like the read-ahead in the vfs....
>

Wouldn't that lead to rather unstable positive feedback? I suspect that
you'd find that all semaphores used with spin_adapt() would pretty
quickly have timeouts set to 0 or infinity.

It may well be somewhat non-deterministic, based on the amount of time
spent waiting at the first contention for each semaphore, and would be
very dependent on the value that you choose for the initial timeout
(i.e. all semaphores that take less than the initial timeout to acquire
in the first few contended cases would become spin locks, and those
that take longer than the initial timeout to acquire in the first few
contended cases would become normal semaphores).

You could possibly get more effective results if you based the timeout
adaptation on the difference between the times taken on the previous
and current attempts to acquire the lock - but that would hit the fast
path quite hard.

Paul

--
Paul Menage Paul.Menage@cl.cam.ac.uk http://www.cl.cam.ac.uk/~pbm1001/
Magdalene College, Cambridge: (01223) 768063
Atlas Room, University of Cambridge Computer Laboratory: (01223) 331859



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:56    [W:1.365 / U:0.084 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site