Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 23 Sep 2004 19:04:46 -0600 (MDT)
From:      Scott Long <scottl@freebsd.org>
To:        John Baldwin <jhb@freebsd.org>
Cc:        Nate Lawson <nate@root.org>
Subject:   Re: cvs commit: src/sys/dev/fdc fdc.c fdcvar.h
Message-ID:  <20040923190353.L39925@pooker.samsco.org>
In-Reply-To: <200409232057.19962.jhb@FreeBSD.org>
References:  <200409232112.i8NLCLgQ065917@repoman.freebsd.org> <200409231923.40285.jhb@FreeBSD.org> <41535BD3.1020609@root.org> <200409232057.19962.jhb@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 23 Sep 2004, John Baldwin wrote:
> On Thursday 23 September 2004 07:27 pm, Nate Lawson wrote:
> > John Baldwin wrote:
> > > On Thursday 23 September 2004 07:19 pm, Nate Lawson wrote:
> > >>Or simpler:
> > >>
> > >>foo_kill():
> > >>         error = kthread_suspend(p, kproc_shutdown_wait * hz);
> > >>         if (error == EWOULDBLOCK)
> > >>                 printf("timed out\n");
> > >>
> > >>foo_thread():
> > >>         for (;;) {
> > >>                 mtx_unlock(&bdlock);
> > >>                 kthread_suspend_check(bufdaemonproc);
> > >>                 ...
> > >>                 mtx_lock(&bdlock);
> > >>                 if (numdirtybuffers <= lodirtybuffers)
> > >>                         msleep(&bd_request, &bdlock, PVM, "psleep", hz);
> > >
> > > That doesn't actually cause the thread to exit, it just goes to sleep.
> > > If fdc wants to support detaching and kldunload it needs the thread to
> > > actually go away, not just go to sleep.
> >
> > If a thread is suspended and the module is unloaded, what would be the
> > failure case?
>
> Leaving unclaimed KVM around that can never be recovered.
>

It would be really sad if we _designed_ FreeBSD to leak threads.  Windows
stopped doing that back with Win98.  We're better than that.

Scott



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040923190353.L39925>