Re: [PATCH] TOMOYO: Add garbage collector support. (v2)

Serge E. Hallyn
2009-06-02T00:57:58Z

Quoting Tetsuo Handa (penguin-kernel@i-love.sakura.ne.jp):
> Serge E. Hallyn wrote:
> > Can't you just move the deleted item from the live list to some dead
> > list, using the same ->list list_head?
>
> I think I can't. If we do list_add(&p->entry.list, &dead_list) after
> list_del_rcu(&p->entry.list) when p->entry.users != 0, p->entry.list.next will
> point to an element on dead list. And reader will no longer be able to resume
> travarsal on the live list.

Use rcu? Take your spinlock, take entry off the list, wait an rcu cycle,
then move to the dead_list.

All readers should walk the list under rcu_read_lock, so if the manage
to reach ->entry, then entry.list->next will be a valid entry on the live
list until the next rcu cycle.

BTW I'm not telling you have to do this, so if you just don't want to, then
just say so. But so long as you come back to me with technical reasons
why you can't, then I take it you're interested in a technical solution :)
and can't help but respond...

-serge