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: <alpine.DEB.2.00.1210082308230.360@chino.kir.corp.google.com>
Date:	Mon, 8 Oct 2012 23:21:37 -0700 (PDT)
From:	David Rientjes <rientjes@...gle.com>
To:	Tang Chen <tangchen@...fujitsu.com>
cc:	mingo@...hat.com, peterz@...radead.org, miaox@...fujitsu.com,
	wency@...fujitsu.com, linux-kernel@...r.kernel.org,
	linux-numa@...r.kernel.org
Subject: Re: [PATCH] Do not use cpu_to_node() to find an offlined cpu's
 node.

On Mon, 8 Oct 2012, Tang Chen wrote:

> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index 66b36ab..e76dce9 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -1263,18 +1263,24 @@ EXPORT_SYMBOL_GPL(kick_process);
>   */
>  static int select_fallback_rq(int cpu, struct task_struct *p)
>  {
> -	const struct cpumask *nodemask = cpumask_of_node(cpu_to_node(cpu));
> +	int nid = cpu_to_node(cpu);
> +	const struct cpumask *nodemask = NULL;
>  	enum { cpuset, possible, fail } state = cpuset;
>  	int dest_cpu;
>  
> -	/* Look for allowed, online CPU in same node. */
> -	for_each_cpu(dest_cpu, nodemask) {
> -		if (!cpu_online(dest_cpu))
> -			continue;
> -		if (!cpu_active(dest_cpu))
> -			continue;
> -		if (cpumask_test_cpu(dest_cpu, tsk_cpus_allowed(p)))
> -			return dest_cpu;
> +	/* If the cpu has been offlined, its nid was set to -1. */
> +	if (nid != -1) {

NUMA_NO_NODE.

Eek, the nid shouldn't be -1 yet, though, for cpu hotplug since this 
should be called at CPU_DYING level and migrate_tasks() still sees a valid 
cpu.

On x86, cpumask_of_node() is always guaranteed to return a valid cpumask 
after boot so presumably this is a problem in some non-x86 arch code and 
isn't actually a sched problem.

> +		nodemask = cpumask_of_node(nid);
> +
> +		/* Look for allowed, online CPU in same node. */
> +		for_each_cpu(dest_cpu, nodemask) {
> +			if (!cpu_online(dest_cpu))
> +				continue;
> +			if (!cpu_active(dest_cpu))
> +				continue;
> +			if (cpumask_test_cpu(dest_cpu, tsk_cpus_allowed(p)))
> +				return dest_cpu;
> +		}
>  	}
>  
>  	for (;;) {
--
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