lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20060824004856.GK11309@localdomain>
Date:	Wed, 23 Aug 2006 19:48:56 -0500
From:	Nathan Lynch <ntl@...ox.com>
To:	Andrew Morton <akpm@...l.org>
Cc:	Paul Jackson <pj@....com>, anton@...ba.org, simon.derr@...l.net,
	nathanl@...tin.ibm.com, linux-kernel@...r.kernel.org
Subject: [PATCH] cpuset code prevents binding tasks to new cpus

Andrew Morton wrote:
> On Wed, 23 Aug 2006 18:49:53 -0500
> Nathan Lynch <ntl@...ox.com> 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;
> > +}
> > +
> 
> The above needs #ifdef CONFIG_HOTPLUG_CPU wrappers.

Fixed, thanks.


Update cpus_allowed in top_cpuset when cpus are hotplugged; otherwise
binding a task to a newly hotplugged cpu fails since the toplevel
cpuset has a static copy of whatever cpu_online_map was at boot time.

Signed-off-by: Nathan Lynch <ntl@...ox.com>


--- cpuhp-sched_setaffinity.orig/kernel/cpuset.c
+++ cpuhp-sched_setaffinity/kernel/cpuset.c
@@ -2033,6 +2033,31 @@ out:
 	return err;
 }
 
+#ifdef CONFIG_HOTPLUG_CPU
+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;
+}
+#endif
+
 /**
  * cpuset_init_smp - initialize cpus_allowed
  *
@@ -2043,6 +2068,8 @@ void __init cpuset_init_smp(void)
 {
 	top_cpuset.cpus_allowed = cpu_online_map;
 	top_cpuset.mems_allowed = node_online_map;
+
+	hotcpu_notifier(cpuset_handle_cpuhp, 0);
 }
 
 /**
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ