[Cbe-oss-dev] Lifetime of SPE contexts & gangs

Arnd Bergmann arnd at arndb.de
Thu May 10 03:06:18 EST 2007


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.

	Arnd <><



More information about the cbe-oss-dev mailing list