[Cbe-oss-dev] Lifetime of SPE contexts & gangs
Benjamin Herrenschmidt
benh at kernel.crashing.org
Thu May 10 08:45:05 EST 2007
On Wed, 2007-05-09 at 19:06 +0200, Arnd Bergmann wrote:
> On Wednesday 09 May 2007, Arnd Bergmann wrote:
> > > * Each context within a gang holds a reference to the gang via the
> > > gang's refcount, and closing the gang fd decreases it. So, if you close
> > > the gang fd, the gang dir only gets removed when the last context is
> > > destroyed.
> >
> > Yes, doing it the first way was my intention when I implemented the
> > gang code initially. I think it's simply a bug that it doesn't work
> > this way right now.
> >
> > This is consistent with how the reference counting works if you have
> > for instance you current working directory in sysfs while a device
> > goes away -- the directory stays alive until the user gives up
> > the last reference to it.
>
> Actually, we could have something simpler even -- don't treat the gang
> file descriptor special at all. Since we don't do any special operations
> like spu_run on it, it is simply a regular directory fd anyway.
>
> Consequently, we can use the normal reference counting in libfs to
> kill the directory when the last reference goes away, be that an open
> file handle or a context directory in it.
Yes, I think that's how it should work too.
Ben.
More information about the cbe-oss-dev
mailing list