public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Serge E. Hallyn" <serge@hallyn.com>
To: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: serue@us.ibm.com, linux-security-module@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] TOMOYO: Add garbage collector support. (v2)
Date: Mon, 1 Jun 2009 19:11:37 -0500	[thread overview]
Message-ID: <20090602001137.GA20880@hallyn.com> (raw)
In-Reply-To: <200906012227.FDE64040.MVQLOStOHFOFFJ@I-love.SAKURA.ne.jp>

Quoting Tetsuo Handa (penguin-kernel@I-love.SAKURA.ne.jp):
> Hello.
> 
> Serge E. Hallyn wrote:
> > So yes, you might be able to get more review of your patch
> > if you split it up into:
> > 
> > 	1. move allocations outside of semaphore
> > 	2. add proper refcounting
> > 	3. get rid of ->is_deleted
> 
> I'm ready to post part (1) and part (2).
> But I'm not sure whether part (3) is worth to implement or not.
>
> If we don't use is_deleted flag, we will need two "struct list_head"s,
> one is for readers and writers, the other is for GC.
> 
> struct something {
> 	struct {
> 		struct list_head list;
> 		atomic_t users;
> 	} entry;
> 	int data;
> 	bool is_deleted;
> } *p;
> 
> If we remove p from the list using list_del() (or list_del_rcu()) instead of
> setting p->is_deleted to true, we have to somehow remember the element pointed
> by p so that that element is reachable from the GC's list.
> We can't wait for p->entry.users to become 0 inside writer function (which is
> called only when modifying lists). Only GC function (which is called
> repeatedly) can check whether p->entry.users == 0 or not because the element
> pointed by p is long-lived. We need to remember the location of the element
> pointed by p .

?

Can't you just move the deleted item from the live list to some dead
list, using the same ->list list_head?

> We can allocate memory when adding p to GC's list, but allocating memory at
> list_del() (or list_del_rcu()) time could fail. It is not a good thing that
> removing an element from the reader's list fails because of -ENOMEM. We already
> have a way (i.e. is_deleted flag) to avoid -ENOMEM.
> 
> We can add another "struct list_head" to each element which is used by GC.
> But that approach consumes more memory than is_deleted flag.

?

See above.

-serge

  reply	other threads:[~2009-06-02  0:05 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-08 13:31 [TOMOYO 0/2] Final patches for kenrel 2.6.30 Tetsuo Handa
2009-04-08 13:31 ` [TOMOYO 1/2] tomoyo: add Documentation/tomoyo.txt Tetsuo Handa
2009-04-10 12:26   ` Peter Dolding
2009-04-10 17:10   ` Pavel Machek
2009-04-13  2:04     ` Tetsuo Handa
2009-04-29 13:13       ` Pavel Machek
2009-05-01 10:24       ` Pavel Machek
2009-05-01 13:07         ` Tetsuo Handa
2009-05-03 21:56           ` Pavel Machek
2009-05-04  6:24             ` Tetsuo Handa
2009-05-06 12:16               ` Tetsuo Handa
2009-05-07 11:42                 ` [TOMOYO] Add garbage collector support Tetsuo Handa
2009-05-08  1:43                   ` James Morris
2009-05-08  2:10                     ` Tetsuo Handa
2009-05-08  8:26                       ` James Morris
2009-05-08  9:22                         ` Tetsuo Handa
2009-05-08  9:32                   ` Pavel Machek
2009-05-14 12:08                 ` [PATCH] TOMOYO: Add garbage collector support. (v2) Tetsuo Handa
2009-05-15  1:49                   ` James Morris
2009-05-16 12:07                     ` Tetsuo Handa
2009-05-25  0:37                       ` Tetsuo Handa
2009-05-25  0:39                         ` Tetsuo Handa
2009-05-25  0:41                           ` Tetsuo Handa
2009-05-27  0:16                             ` Paul E. McKenney
2009-05-27  1:25                               ` Tetsuo Handa
2009-05-27  4:12                                 ` Paul E. McKenney
2009-06-01 13:27                             ` Tetsuo Handa
2009-06-02  0:11                               ` Serge E. Hallyn [this message]
2009-06-02  0:30                                 ` Tetsuo Handa
2009-06-02  1:03                                   ` Serge E. Hallyn
2009-06-02  1:16                                     ` Tetsuo Handa
2009-06-02  3:35                                       ` Paul E. McKenney
2009-04-08 13:31 ` [TOMOYO 2/2] Hello Tetsuo Handa
2009-04-10 11:55   ` Tetsuo Handa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090602001137.GA20880@hallyn.com \
    --to=serge@hallyn.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=penguin-kernel@I-love.SAKURA.ne.jp \
    --cc=serue@us.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox