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

From: Tetsuo Handa
Date: Mon Jun 01 2009 - 20:30:49 EST


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.
--
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/