Terry Lambert wrote:
> Poul-Henning Kamp wrote:
> > In message <[EMAIL PROTECTED]>, Peter Wemm writes:
> > >As you said, _sleeping_ is the problem.  M_WAITOK means "you may sleep if
> > >you like".   ie: it is a time bomb waiting for the right low memory condit
    ion
> > >which will then explode with a 100% authentic crash or lock up.
> > >
> > >Pretend it said M_SLEEPOK instead of M_WAITOK.
> > 
> > Uhm, I'm actually seeing the opposite behaviour as well: after I
> > changed the md(4) driver to use M_NOWAIT I still see malloc/zalloc
> > sleeping...
> 
> I'm with Poul on this one, Peter: M_WAITOK doesn't mean what
> you think it means: it's doesn't mean tsleep may be called,
> and M_NOWAIT doesn't mean tsleep() _won't_ be called, in
> practice.

No, it is exactly what it means, eg:
        if (!(flags & M_NOWAIT))
                KASSERT(curthread->td_intr_nesting_level == 0,
                   ("malloc(M_WAITOK) in interrupt context"));

tsleep() in interrupt context is the kiss-of-death.  M_NOWAIT means
"you must not call tsleep!", which is what I have been saying all along.

There is a known bug in UMA where it recurses and calls itself with with
M_WAITOK even if it was explicitly called with M_NOWAIT set.  The bug is
real and would cause a panic if we actually ran low on memory at that
point.

Cheers,
-Peter
--
Peter Wemm - [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]
"All of this is for nothing if we don't go to the stars" - JMS/B5


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to