* scheduling with spinlocks held ?
@ 2003-07-02 0:10 Muthian Sivathanu
2003-07-02 0:19 ` Robert Love
0 siblings, 1 reply; 5+ messages in thread
From: Muthian Sivathanu @ 2003-07-02 0:10 UTC (permalink / raw)
To: linux-kernel
Hi,
Is it safe to assume that the kernel will not preempt
a process when its holding a spinlock ? I know most
parts of the code make sure they dont yield the cpu
when they are holding spinlocks, but I was just
curious if there is any place that does that.
Basically, the context is, I need to change the
scheduler a bit to implement "perfect nice -19"
semantics, i.e. give cpu to nice 19 process only if no
other normal process is ready to run. I am wondering
if there is a possibility of priority inversion if the
nice-d process happens to yield the cpu and then never
get scheduled because a normal process is spinning on
the lock.
thanks for any input,
Muthian.
__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: scheduling with spinlocks held ?
2003-07-02 0:10 scheduling with spinlocks held ? Muthian Sivathanu
@ 2003-07-02 0:19 ` Robert Love
2003-07-02 17:58 ` Muthian Sivathanu
2003-07-02 18:36 ` Muthian Sivathanu
0 siblings, 2 replies; 5+ messages in thread
From: Robert Love @ 2003-07-02 0:19 UTC (permalink / raw)
To: Muthian Sivathanu; +Cc: linux-kernel
On Tue, 2003-07-01 at 17:10, Muthian Sivathanu wrote:
> Is it safe to assume that the kernel will not preempt
> a process when its holding a spinlock ? I know most
> parts of the code make sure they dont yield the cpu
> when they are holding spinlocks, but I was just
> curious if there is any place that does that.
Correct.
> Basically, the context is, I need to change the
> scheduler a bit to implement "perfect nice -19"
> semantics, i.e. give cpu to nice 19 process only if no
> other normal process is ready to run. I am wondering
> if there is a possibility of priority inversion if the
> nice-d process happens to yield the cpu and then never
> get scheduled because a normal process is spinning on
> the lock.
You will hit priority inversion... not with spinlocks but with
semaphores (and possibly more subtle issues).
The only safe way to do this safely is to boost the task's priority out
of the "idle" class when the task is inside the kernel.
It is nontrivial to juggle user vs. kernel returns such as that. Google
for Ingo Molnar's SCHED_BATCH addition to the O(1) scheduler.
Robert Love
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: scheduling with spinlocks held ?
2003-07-02 0:19 ` Robert Love
@ 2003-07-02 17:58 ` Muthian Sivathanu
2003-07-02 18:36 ` Muthian Sivathanu
1 sibling, 0 replies; 5+ messages in thread
From: Muthian Sivathanu @ 2003-07-02 17:58 UTC (permalink / raw)
To: Robert Love; +Cc: linux-kernel
thanks for the pointers !
in general, would it make sense to explicitly
distinguish between mutex semaphores and others (maybe
for producer consumer queues), i.e. have a separate
structure mutex_semaphore with its own up() and down()
-- this will probably facilitate more fine grained
handling of such priority inversion problems since one
can accurately track the number of mutexes, if any,
that a process is holding at any given point ?
Muthian.
--- Robert Love <rml@tech9.net> wrote:
> On Tue, 2003-07-01 at 17:10, Muthian Sivathanu
> wrote:
>
> > Is it safe to assume that the kernel will not
> preempt
> > a process when its holding a spinlock ? I know
> most
> > parts of the code make sure they dont yield the
> cpu
> > when they are holding spinlocks, but I was just
> > curious if there is any place that does that.
>
> Correct.
>
> > Basically, the context is, I need to change the
> > scheduler a bit to implement "perfect nice -19"
> > semantics, i.e. give cpu to nice 19 process only
> if no
> > other normal process is ready to run. I am
> wondering
> > if there is a possibility of priority inversion if
> the
> > nice-d process happens to yield the cpu and then
> never
> > get scheduled because a normal process is spinning
> on
> > the lock.
>
> You will hit priority inversion... not with
> spinlocks but with
> semaphores (and possibly more subtle issues).
>
> The only safe way to do this safely is to boost the
> task's priority out
> of the "idle" class when the task is inside the
> kernel.
>
> It is nontrivial to juggle user vs. kernel returns
> such as that. Google
> for Ingo Molnar's SCHED_BATCH addition to the O(1)
> scheduler.
>
> Robert Love
>
>
__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: scheduling with spinlocks held ?
2003-07-02 0:19 ` Robert Love
2003-07-02 17:58 ` Muthian Sivathanu
@ 2003-07-02 18:36 ` Muthian Sivathanu
2003-07-02 18:46 ` Robert Love
1 sibling, 1 reply; 5+ messages in thread
From: Muthian Sivathanu @ 2003-07-02 18:36 UTC (permalink / raw)
To: Robert Love; +Cc: linux-kernel
Hi,
Is there a version of Ingo Molnar's patch for the 2.4
line kernels ?
thanks,
Muthian.
--- Robert Love <rml@tech9.net> wrote:
> On Tue, 2003-07-01 at 17:10, Muthian Sivathanu
> wrote:
>
> > Is it safe to assume that the kernel will not
> preempt
> > a process when its holding a spinlock ? I know
> most
> > parts of the code make sure they dont yield the
> cpu
> > when they are holding spinlocks, but I was just
> > curious if there is any place that does that.
>
> Correct.
>
> > Basically, the context is, I need to change the
> > scheduler a bit to implement "perfect nice -19"
> > semantics, i.e. give cpu to nice 19 process only
> if no
> > other normal process is ready to run. I am
> wondering
> > if there is a possibility of priority inversion if
> the
> > nice-d process happens to yield the cpu and then
> never
> > get scheduled because a normal process is spinning
> on
> > the lock.
>
> You will hit priority inversion... not with
> spinlocks but with
> semaphores (and possibly more subtle issues).
>
> The only safe way to do this safely is to boost the
> task's priority out
> of the "idle" class when the task is inside the
> kernel.
>
> It is nontrivial to juggle user vs. kernel returns
> such as that. Google
> for Ingo Molnar's SCHED_BATCH addition to the O(1)
> scheduler.
>
> Robert Love
>
>
__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2003-07-02 18:29 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-07-02 0:10 scheduling with spinlocks held ? Muthian Sivathanu
2003-07-02 0:19 ` Robert Love
2003-07-02 17:58 ` Muthian Sivathanu
2003-07-02 18:36 ` Muthian Sivathanu
2003-07-02 18:46 ` Robert Love
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox