public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Paul Jackson <pj@sgi.com>
To: vatsa@in.ibm.com
Cc: dino@in.ibm.com, ntl@pobox.com, Simon.Derr@bull.net,
	lse-tech@lists.sourceforge.net, akpm@osdl.org,
	nickpiggin@yahoo.com.au, linux-kernel@vger.kernel.org,
	rusty@rustcorp.com.au
Subject: Re: [Lse-tech] Re: [PATCH] cpusets+hotplug+preepmt broken
Date: Fri, 13 May 2005 12:59:53 -0700	[thread overview]
Message-ID: <20050513125953.66a59436.pj@sgi.com> (raw)
In-Reply-To: <20050513172540.GA28018@in.ibm.com>

Srivatsa, replying to Dinakar:
> This in fact was the reason that we added lock_cpu_hotplug
> in sched_setaffinity.

Why just in sched_setaffinity()?  What about the other 60+ calls to
set_cpus_allowed().  Shouldn't most of those calls be checking that the
passed in cpus are online (holding lock_cpu_hotplug while doing all
this)?  Either that, or at least handling the error from
set_cpus_allowed() if the requested cpus end up not being online?  I see
only 2 set_cpus_allowed() calls that make any pretense of examining the
return value.


> I agree that taking the hotplug lock seems reasonable here.

I take it that you are recommending changing cpuset_cpus_allowed() in
the way sched_setaffinity() was changed, to grab lock_cpu_hotplug around
the small piece of code that examines cpu_online_map and calls
set_cpus_allowed().

This sounds good to me.  I wonder why it doesn't need to be considered
in the other 60+ calls to set_cpus_allowed.


> Given the fact that CPU/Memory hotplug and cpuset operation may
> be infrequent events, this will probably be not a concern. 

I agree that performance is not the key issue here.  Little if any
of this is on any hot code path.

We do need to be clear about how these locks work, their semantics, what
they require and what they insure, and their various interactions.

This is not easy stuff to get right.

I notice that the documentation for lock_cpu_hotplug() is a tad on
the skimpy side:

	/* Stop CPUs going up and down. */

That's it, so far as I can see.  Interaction of hotplug locking with
the rest of the kernel has been, is now, and will continue to be, a
difficult area.  More care than this needs to be put into explaining
the use, semantics and interactions of any locking involved.

In particular, in my view, locks should guard data.  What data does
lock_cpu_hotplug() guard?  I propose that it guards cpu_online_map.

I recommend considering a different name for this lock.  Perhaps
'cpu_online_sem', instead of 'cpucontrol'?   And perhaps the
lock_cpu_hotplug() should be renamed, to say 'lock_cpu_online'?

Then a survey of all uses of cpu_online_map, and by extension, of all
calls to set_cpus_allowed(), should be made, to see in which cases this
semaphore should be held.  For extra credit, make sure that every caller
to set_cpus_allowed() makes an effort to only pass in cpus that are
currently online.  The caller should do this, since only the caller can
know what alternative cpus to use, if their first choice is offline.

-- 
                  I won't rest till it's the best ...
                  Programmer, Linux Scalability
                  Paul Jackson <pj@engr.sgi.com> 1.650.933.1373, 1.925.600.0401

  reply	other threads:[~2005-05-13 20:26 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-11 19:16 [PATCH] cpusets+hotplug+preepmt broken Dinakar Guniguntala
2005-05-11 19:25 ` [Lse-tech] " Paul Jackson
2005-05-11 19:55   ` Paul Jackson
2005-05-11 20:26     ` Nathan Lynch
2005-05-11 20:45       ` Paul Jackson
2005-05-11 19:51 ` Nathan Lynch
2005-05-11 20:42   ` Paul Jackson
2005-05-11 20:58     ` Paul Jackson
2005-05-14  2:23       ` Paul Jackson
2005-05-14 12:14         ` Nathan Lynch
2005-05-14 17:04           ` Paul Jackson
2005-05-14 17:44             ` Paul Jackson
2005-05-18  4:14               ` Paul Jackson
2005-05-18  9:29               ` [Lse-tech] " Dinakar Guniguntala
2005-05-18 14:48               ` Nathan Lynch
2005-05-18 21:16               ` Paul Jackson
2005-05-14 16:28         ` Srivatsa Vaddagiri
2005-05-12 15:10     ` Dinakar Guniguntala
2005-05-13 12:15       ` [Lse-tech] " Dinakar Guniguntala
2005-05-13  0:34     ` Nathan Lynch
2005-05-13 12:32   ` [Lse-tech] " Dinakar Guniguntala
2005-05-13 17:25     ` Srivatsa Vaddagiri
2005-05-13 19:59       ` Paul Jackson [this message]
2005-05-13 20:20         ` Dipankar Sarma
2005-05-13 20:46           ` Nathan Lynch
2005-05-13 21:05             ` Paul Jackson
2005-05-13 21:06             ` Dipankar Sarma
2005-05-13 20:52           ` Paul Jackson
2005-05-13 21:02             ` Dipankar Sarma
2005-05-14  2:58               ` Paul Jackson
2005-05-14 16:09                 ` Srivatsa Vaddagiri
2005-05-14 17:50                   ` Paul Jackson
2005-05-14 17:57                   ` Paul Jackson
2005-05-14 16:30                 ` Nathan Lynch
2005-05-14 17:23                   ` Srivatsa Vaddagiri
2005-05-14 23:17                     ` Nathan Lynch
2005-05-13 19:59     ` Paul Jackson
2005-05-13 21:27     ` Nathan Lynch

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=20050513125953.66a59436.pj@sgi.com \
    --to=pj@sgi.com \
    --cc=Simon.Derr@bull.net \
    --cc=akpm@osdl.org \
    --cc=dino@in.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lse-tech@lists.sourceforge.net \
    --cc=nickpiggin@yahoo.com.au \
    --cc=ntl@pobox.com \
    --cc=rusty@rustcorp.com.au \
    --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