lkml.org 
[lkml]   [1996]   [Oct]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: Could this become a race condition?
Date
From
Linus comments at my answer on the list:
> > .. is there a deadlock ? ..
> > ...
> > > Is there any way to avoid that?
> >
> > Yes. Yes:
> >
> > while (set_bit(1,&sb->s_lock) != 0)
> > __wait_on_super(sb);
> >
> > While the old value of the s_lock is non-zero, call
> > __wait_on_super(), else leave with s_lock set.
> > See <asm/bitops.h> for the routines.
>
> Actually, the old code is not a race condition, because "sb_lock" is only
> modified in a "process context" and never from interrupts. As such, the
> general non-re-entrancy of the kernel will guarantee that you can do
> "atomic" operations like the above without using the setbit() etc atomic
> stuff

Indeed, however I have understood that a long-term goal is to
get the SMP locks deeper/wider into the kernel from current
SINGLE spin-lock at system-call entrance. That way there can
be multiple processors running in kernel, and thus having a
need for this kind of atomic stuff.

> Linus

/Matti Aarnio <matti.aarnio@tele.fi>

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