mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Robin Holt <holt@sgi.com>
To: Paul Jackson <pj@sgi.com>
Cc: Robin Holt <holt@sgi.com>,
	zippel@linux-m68k.org, akpm@osdl.org, torvalds@osdl.org,
	Simon.Derr@bull.net, linux-kernel@vger.kernel.org,
	nikita@clusterfs.com
Subject: Re: [PATCH] cpuset semaphore depth check optimize
Date: Tue, 20 Sep 2005 09:54:49 -0500	[thread overview]
Message-ID: <20050920145449.GA31461@lnx-holt.americas.sgi.com> (raw)
In-Reply-To: <20050920072255.0096f1bb.pj@sgi.com>

On Tue, Sep 20, 2005 at 07:22:55AM -0700, Paul Jackson wrote:
> Robin asked:
> Let's say we have the following notify_on_release cpusets,
> each with exactly one task in them:
> 
> 	/dev/cpuset/A		task1
> 	/dev/cpuset/A/B		task2
> 	/dev/cpuset/A/B/C	task3
> 
> Lets further say that tasks 1, 2 and 3, exit, in that
> order, task1 first.
> 
> When task1 exits, no cpusets are removed.
> 
> When task2 exits, no cpusets are removed.
> 
> When task3 exits, cpuset A/B/C needs to be removed. That in
> turn triggers removing A/B.  That in turn triggers removing A.
> 
> I was confident that I could do these three removals safely
> by doing three rmdir(2) system calls, one at a time, in order,
> working from the bottom up.
> 
> I had no clue how to do these three removals safely, working
> from the bottom up, while in the kernel exit code for task3.

This makes things even easier!!!

When you create a cpuset, set the refcount to 0.  The root
cpuset is the exception and has a refcount of 1.

When tasks are added to the cpuset, increment the refcount.

When child cpusets are created, increment the refcount.  Each
cpuset has a list of children that is protected by a single
lock.

Whenever you are decrementing the cpuset's refcount, use
atomic_dec_and_lock on the parents child list lock.  If the
notify_on_release property is set, you remove the child from
the list.

When the vfs code is traversing the list, you need to ensure
that it does not iterate unless the child list lock is held.
I have not looked at how you implemented the vfs stuff, but
that should be easily accomplished.

Where are the holes?

Thanks,
Robin

  reply	other threads:[~2005-09-20 14:55 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-12 11:30 Paul Jackson
2005-09-12 11:39 ` Andrew Morton
2005-09-12 14:38   ` Linus Torvalds
2005-09-12 15:32     ` Paul Jackson
     [not found]     ` <17189.39100.862561.865802@gargle.gargle.HOWL>
2005-09-12 15:38       ` Paul Jackson
2005-09-13  7:04     ` Ingo Molnar
2005-09-13 22:21       ` Paul Jackson
2005-09-12 14:51   ` Paul Jackson
2005-09-12 17:07     ` Roman Zippel
     [not found]       ` <20050912153135.3812d8e2.pj@sgi.com>
2005-09-13 11:42         ` Roman Zippel
2005-09-13 17:37           ` Paul Jackson
2005-09-14  6:01             ` Paul Jackson
2005-09-14 15:56             ` Roman Zippel
2005-09-14 19:46               ` Paul Jackson
2005-09-15 10:51                 ` Roman Zippel
2005-09-15 17:45                   ` Paul Jackson
2005-09-15 19:18                     ` Paul Jackson
2005-09-17  2:06                     ` Roman Zippel
2005-09-17  2:27                       ` Roman Zippel
2005-09-20  7:57                     ` Paul Jackson
2005-09-20 12:05                       ` Robin Holt
2005-09-20 12:21                         ` Robin Holt
2005-09-20 13:10                         ` Simon Derr
2005-09-20 14:22                         ` Paul Jackson
2005-09-20 14:54                           ` Robin Holt [this message]
2005-09-20 15:07                             ` Linus Torvalds
2005-09-20 15:14                             ` Paul Jackson
2005-09-20 15:17                             ` Simon Derr
2005-09-12 11:48 ` Nikita Danilov
2005-09-12 13:25   ` Paul Jackson

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=20050920145449.GA31461@lnx-holt.americas.sgi.com \
    --to=holt@sgi.com \
    --cc=Simon.Derr@bull.net \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nikita@clusterfs.com \
    --cc=pj@sgi.com \
    --cc=torvalds@osdl.org \
    --cc=zippel@linux-m68k.org \
    /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

all inboxes | Powered by JetHome®