mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paul Jackson <pj@sgi.com>
To: Andrew Morton <akpm@osdl.org>
Cc: ntl@pobox.com, anton@samba.org, simon.derr@bull.net,
	nathanl@austin.ibm.com, linux-kernel@vger.kernel.org
Subject: Re: cpusets not cpu hotplug aware
Date: Wed, 23 Aug 2006 19:54:15 -0700	[thread overview]
Message-ID: <20060823195415.1762371a.pj@sgi.com> (raw)
In-Reply-To: <20060823171239.b1e85cec.akpm@osdl.org>

Simon,

  Take note below of my proposal to make the 'cpus' and 'mems'
  of the top cpuset read-only.  Holler if that hurts.

Nathan wrote:
> +static int cpuset_handle_cpuhp(struct notifier_block *nb,
> +				unsigned long phase, void *_cpu)
> +{
> +	unsigned long cpu = (unsigned long)_cpu;
> +
> +	mutex_lock(&manage_mutex);
> +	mutex_lock(&callback_mutex);
> +
> +	switch (phase) {
> +	case CPU_ONLINE:
> +		cpu_set(cpu, top_cpuset.cpus_allowed);
> +		break;
> +	case CPU_DEAD:
> +		cpu_clear(cpu, top_cpuset.cpus_allowed);
> +		break;
> +	}
> +
> +	mutex_unlock(&callback_mutex);
> +	mutex_unlock(&manage_mutex);
> +
> +	return 0;
> +}
> +

Andrew commented:
> I must say, that's a pretty simple patch. 

Not simple enough ;).

How about (uncompiled, untested, unanything):

=================================================================
/*
 * The top_cpuset tracks what CPUs and Memory Nodes are online,
 * period.  This is necessary in order to make cpusets transparent
 * (of no affect) on systems that are actively using CPU hotplug
 * but making no active use of cpusets.
 *
 * This handles CPU hotplug (cpuhp) events.  If someday Memory
 * Nodes can be hotplugged (dynamically changing node_online_map)
 * then we should handle that too, perhaps in a similar way.
 */

#ifdef CONFIG_HOTPLUG_CPU
static int cpuset_handle_cpuhp(struct notifier_block *nb,
				unsigned long phase, void *cpu)
{
	mutex_lock(&manage_mutex);
	mutex_lock(&callback_mutex);

	top_cpuset.cpus_allowed = cpu_online_map;

	mutex_unlock(&callback_mutex);
	mutex_unlock(&manage_mutex);

	return 0;
}
#endif

... plus the hotcpu_notifier() initializer.
=================================================================

However I get to spend the few lines of code I saved here elsewhere,
adding special case code so that the top_cpuset's 'cpus' and 'mems'
files are read-only.

The new rule is simple:

  The top cpuset's cpus and mems track what is online.

The user is no longer in direct control of these two cpuset settings.

And I should add a few lines to Documentation/cpusets.txt, describing
this.

When I return from my son's 18-th birthday party this evening, I will
see what I can whip up.

Thanks, Nathan.

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

  parent reply	other threads:[~2006-08-24  2:54 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-21 13:27 Anton Blanchard
2006-08-21 13:54 ` Simon Derr
2006-08-21 17:43 ` Paul Jackson
2006-08-21 19:21   ` Anton Blanchard
2006-08-21 20:42     ` [PATCH] cpuset code prevents binding tasks to new cpus Nathan Lynch
2006-08-21 23:04       ` Paul Jackson
2006-08-21 23:27         ` Nathan Lynch
2006-08-22  4:42           ` Paul Jackson
2006-08-22  5:07             ` Andrew Morton
2006-08-21 21:01     ` cpusets not cpu hotplug aware Paul Jackson
2006-08-22  4:51       ` Andrew Morton
2006-08-22  5:04         ` Nathan Lynch
2006-08-22  5:11           ` Andrew Morton
2006-08-22  5:14           ` Paul Jackson
2006-08-23 22:11             ` Nathan Lynch
2006-08-23 22:39               ` Paul Jackson
2006-08-23 23:39                 ` Nathan Lynch
2006-08-24  2:19                   ` Paul Jackson
2006-08-23 23:49               ` Nathan Lynch
2006-08-24  0:12                 ` Andrew Morton
2006-08-24  0:48                   ` [PATCH] cpuset code prevents binding tasks to new cpus Nathan Lynch
2006-08-24  2:54                   ` Paul Jackson [this message]
2006-08-22  5:06         ` cpusets not cpu hotplug aware Paul Jackson
2006-08-22  5:14           ` Andrew Morton
2006-08-22  5:21             ` Paul Jackson
2006-08-23 14:58             ` Anton Blanchard
2006-08-23 18:59               ` Paul Jackson
2006-08-23 19:08               ` 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=20060823195415.1762371a.pj@sgi.com \
    --to=pj@sgi.com \
    --cc=akpm@osdl.org \
    --cc=anton@samba.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nathanl@austin.ibm.com \
    --cc=ntl@pobox.com \
    --cc=simon.derr@bull.net \
    /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

Powered by JetHome