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

Tetsuo Handa
2009-06-02T00:30:44Z

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.

I don't want the item be deleted from the live list as long as there are
readers (i.e. p->entry.users != 0).

If we use different ->list list_head, reader will be able to resume travarsal
on the live list. (But will use more memory than ->is_deleted.)

struct something {
struct {
struct list_head list_for_live_list;
atomic_t users;
} entry;
struct list_head list_for_dead_list;
int data;
} *p;

Regards.