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

From: Serge E. Hallyn
Date: Mon Jun 01 2009 - 20:58:02 EST


Quoting Tetsuo Handa (penguin-kernel@xxxxxxxxxxxxxxxxxxx):
> 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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/