Re: [PATCH 2/2] sched: fix a logical error in select_task_rq_fair
>> In that case aren't we covering up a bug in find_idlest_group(), it >> appears to have returned a group that isn't eligible to be idlest. > > > If it is possible happening in sched_domain rebuilding? > I didn't meet this bug. Just guess. Even so, it is not related with this patch. So, Thanks for clarify! and forget this patch. > >> >> > > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 2/2] sched: fix a logical error in select_task_rq_fair
On 07/26/2012 04:17 PM, Peter Zijlstra wrote: > On Thu, 2012-07-26 at 13:27 +0800, Alex Shi wrote: >> If find_idlest_cpu() return '-1', and sd->child is NULL. The function >> select_task_rq_fair will return -1. That is not the function's purpose. > > But find_idlest_cpu() will only return -1 if the group mask is fully > excluded by the cpus_allowed mask, right? Yes. > > In that case aren't we covering up a bug in find_idlest_group(), it > appears to have returned a group that isn't eligible to be idlest. If it is possible happening in sched_domain rebuilding? I didn't meet this bug. Just guess. > > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 2/2] sched: fix a logical error in select_task_rq_fair
On Thu, 2012-07-26 at 13:27 +0800, Alex Shi wrote: > If find_idlest_cpu() return '-1', and sd->child is NULL. The function > select_task_rq_fair will return -1. That is not the function's purpose. But find_idlest_cpu() will only return -1 if the group mask is fully excluded by the cpus_allowed mask, right? In that case aren't we covering up a bug in find_idlest_group(), it appears to have returned a group that isn't eligible to be idlest. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 2/2] sched: fix a logical error in select_task_rq_fair
On Thu, 2012-07-26 at 13:27 +0800, Alex Shi wrote: If find_idlest_cpu() return '-1', and sd-child is NULL. The function select_task_rq_fair will return -1. That is not the function's purpose. But find_idlest_cpu() will only return -1 if the group mask is fully excluded by the cpus_allowed mask, right? In that case aren't we covering up a bug in find_idlest_group(), it appears to have returned a group that isn't eligible to be idlest. -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 2/2] sched: fix a logical error in select_task_rq_fair
On 07/26/2012 04:17 PM, Peter Zijlstra wrote: On Thu, 2012-07-26 at 13:27 +0800, Alex Shi wrote: If find_idlest_cpu() return '-1', and sd-child is NULL. The function select_task_rq_fair will return -1. That is not the function's purpose. But find_idlest_cpu() will only return -1 if the group mask is fully excluded by the cpus_allowed mask, right? Yes. In that case aren't we covering up a bug in find_idlest_group(), it appears to have returned a group that isn't eligible to be idlest. If it is possible happening in sched_domain rebuilding? I didn't meet this bug. Just guess. -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 2/2] sched: fix a logical error in select_task_rq_fair
In that case aren't we covering up a bug in find_idlest_group(), it appears to have returned a group that isn't eligible to be idlest. If it is possible happening in sched_domain rebuilding? I didn't meet this bug. Just guess. Even so, it is not related with this patch. So, Thanks for clarify! and forget this patch. -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/2] sched: fix a logical error in select_task_rq_fair
If find_idlest_cpu() return '-1', and sd->child is NULL. The function select_task_rq_fair will return -1. That is not the function's purpose. The patch introduced a latest_cpu as temporay varible to store find_idlest_cpu() return value, and let new_cpu to store the latest workable cpu. If find_idlest_cpu() doesn't find idlest cpu, we still have a latest workable cpu. Signed-off-by: Alex Shi --- kernel/sched/fair.c |9 +++-- 1 files changed, 7 insertions(+), 2 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 8a1db69..7e4bab48 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -2730,6 +2730,7 @@ select_task_rq_fair(struct task_struct *p, int sd_flag, int wake_flags) int load_idx = sd->forkexec_idx; struct sched_group *group; int weight; + int latest_cpu; if (!(sd->flags & sd_flag)) { sd = sd->child; @@ -2745,8 +2746,12 @@ select_task_rq_fair(struct task_struct *p, int sd_flag, int wake_flags) continue; } - new_cpu = find_idlest_cpu(group, p, cpu); - if (new_cpu == -1 || new_cpu == cpu) { + latest_cpu = find_idlest_cpu(group, p, cpu); + + if (latest_cpu != -1) + new_cpu = latest_cpu; + + if (latest_cpu == -1 || latest_cpu == cpu) { /* Now try balancing at a lower domain level of cpu */ sd = sd->child; continue; -- 1.7.5.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/2] sched: fix a logical error in select_task_rq_fair
If find_idlest_cpu() return '-1', and sd-child is NULL. The function select_task_rq_fair will return -1. That is not the function's purpose. The patch introduced a latest_cpu as temporay varible to store find_idlest_cpu() return value, and let new_cpu to store the latest workable cpu. If find_idlest_cpu() doesn't find idlest cpu, we still have a latest workable cpu. Signed-off-by: Alex Shi alex@intel.com --- kernel/sched/fair.c |9 +++-- 1 files changed, 7 insertions(+), 2 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 8a1db69..7e4bab48 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -2730,6 +2730,7 @@ select_task_rq_fair(struct task_struct *p, int sd_flag, int wake_flags) int load_idx = sd-forkexec_idx; struct sched_group *group; int weight; + int latest_cpu; if (!(sd-flags sd_flag)) { sd = sd-child; @@ -2745,8 +2746,12 @@ select_task_rq_fair(struct task_struct *p, int sd_flag, int wake_flags) continue; } - new_cpu = find_idlest_cpu(group, p, cpu); - if (new_cpu == -1 || new_cpu == cpu) { + latest_cpu = find_idlest_cpu(group, p, cpu); + + if (latest_cpu != -1) + new_cpu = latest_cpu; + + if (latest_cpu == -1 || latest_cpu == cpu) { /* Now try balancing at a lower domain level of cpu */ sd = sd-child; continue; -- 1.7.5.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/