Re: [PATCH] cpuset semaphore depth check optimize

Linus Torvalds
2005-09-20T15:08:25Z

On Tue, 20 Sep 2005, Robin Holt wrote:
>
> This makes things even easier!!!
>
> When you create a cpuset, set the refcount to 0. The root
> cpuset is the exception and has a refcount of 1.
>
> When tasks are added to the cpuset, increment the refcount.
>
> When child cpusets are created, increment the refcount. Each
> cpuset has a list of children that is protected by a single
> lock.

You just described the "dentry" reference counting. Which has the same
issues: as long as a dentry has any children, it needs to remain.

Except dentries are a lot more complex, because we want to keep cached
versions of them around even when the count goes to zero (and zero only
means that we're _allowed_ to remove it under memory pressure). And
dentries can move from one parent to another.

Linus