From: Paul Jackson <pj@sgi.com>
To: ego@in.ibm.com
Cc: mingo@elte.hu, nickpiggin@yahoo.com.au, arjan@infradead.org,
rusty@rustcorp.com.au, torvalds@osdl.org, akpm@osdl.org,
linux-kernel@vger.kernel.org, arjan@intel.linux.com,
davej@redhat.com, dipankar@in.ibm.com, vatsa@in.ibm.com,
ashok.raj@intel.com
Subject: Re: [RFC][PATCH 4/4] Rename lock_cpu_hotplug/unlock_cpu_hotplug
Date: Sun, 27 Aug 2006 00:59:44 -0700 [thread overview]
Message-ID: <20060827005944.67f51e92.pj@sgi.com> (raw)
In-Reply-To: <20060825035328.GA6322@in.ibm.com>
Gautham wrote:
> Which is why I did not expose the locking(at least the write side of it)
> outside. We don't want too many lazy programmers anyway!
Good thing you did that ;). This lazy programmer was already
having fantasies of changing the cpuset locks (in kernel/cpuset.c)
manage_mutex and callback_mutex to these writer and reader "unfair
rwsem" locks, respectively.
Essentially these cpuset locks need to guard the cpuset hierarchy, just
as your locks need to guard cpu_online_map.
The change agents (such as a system admin changing something in
the /dev/cpuset hierarchy) are big slow mammoths that appear rarely,
and need to single thread their entire operation, preventing anyone
else from changing the cpuset hierarchy for an extended period of time,
while they validate the request and setup to make the requested change
or changes.
The inhibitors are a swarm of locusts, that change nothing, and need
quick, safe access, free of change during a brief critical section.
Finally the mammoths must not trample the locusts (change what the
locusts see during their critical sections.)
The cpuset change agents (mammoths) take manage_mutex for their entire
operation, locking each other out. They also take callback_mutex when
making the actual changes that might momentarilly make the cpuset
structures inconsistent.
The cpuset readers (locusts) take callback_mutex for the brief critical
section during which they read out a value or two from the cpuset
structures.
If I understand your unfair rwsem proposal, the cpuset locks differ
from your proposal in these ways:
1) The cpuset locks are crafted from existing mutex mechanisms.
2) The 'reader' (change inhibitor) side, aka the callback_mutex,
is single threaded. No nesting or sharing of that lock allowed.
This is ok for inhibiting changes to the cpuset structures, as
that is not done on any kernel hot code paths (the cpuset
'locusts' are actually few in number, with tricks such as
the cpuset generation number used to suppress the locust
population.) It would obviously not be ok to single thread
reading cpu_online_map.
3) The 'writer' side (the mammoths), after taking the big
manage_mutex for its entire operation, *also* has to take the
small callback_mutex briefly around any actual changes, to lock
out readers.
4) Frequently accessed cpuset data, such as the cpus and memory
nodes allowed to a task, are cached in the task struct, to
keep from accessing the tasks cpuset frequently (more locust
population suppression.)
Differences (2) and (4) are compromises, imposed by difference (1).
The day might come when there are too many cpuset locusts -- too many
tasks taking the cpuset callback_mutex, and then something like your
unfair rwsem's could become enticing.
--
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <pj@sgi.com> 1.925.600.0401
next prev parent reply other threads:[~2006-08-27 8:00 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-24 10:34 [RFC][PATCH 4/4] Rename lock_cpu_hotplug/unlock_cpu_hotplug Gautham R Shenoy
2006-08-24 11:00 ` Arjan van de Ven
2006-08-24 14:03 ` Gautham R Shenoy
2006-08-24 14:16 ` Arjan van de Ven
2006-08-24 14:55 ` Nick Piggin
2006-08-24 15:00 ` Ingo Molnar
2006-08-24 15:53 ` Nick Piggin
2006-08-25 3:53 ` Gautham R Shenoy
2006-08-27 7:59 ` Paul Jackson [this message]
2006-08-27 8:42 ` Keith Owens
2006-08-27 9:10 ` Paul Jackson
2006-08-29 18:05 ` Paul E. McKenney
2006-08-29 19:31 ` Paul Jackson
2006-08-29 20:03 ` Paul E. McKenney
2006-08-30 2:38 ` Paul Jackson
2006-08-30 15:14 ` Paul E. McKenney
2006-08-30 17:54 ` Paul Jackson
2006-08-30 18:13 ` Paul E. McKenney
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=20060827005944.67f51e92.pj@sgi.com \
--to=pj@sgi.com \
--cc=akpm@osdl.org \
--cc=arjan@infradead.org \
--cc=arjan@intel.linux.com \
--cc=ashok.raj@intel.com \
--cc=davej@redhat.com \
--cc=dipankar@in.ibm.com \
--cc=ego@in.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=nickpiggin@yahoo.com.au \
--cc=rusty@rustcorp.com.au \
--cc=torvalds@osdl.org \
--cc=vatsa@in.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