Message ID | 20180418153646.20623-1-svaidy@linux.vnet.ibm.com |
---|---|
State | Accepted |
Headers | show |
Series | [1/2] core: Fix iteration condition to skip garded cpu | expand |
On Wed, 18 Apr 2018 21:06:45 +0530 Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com> wrote: > Fix the logic error in the loop that iterated incorrectly > over garded cpu. > > Signed-off-by: Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com> > --- > core/cpu.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/core/cpu.c b/core/cpu.c > index 6826fee0..369eb5b9 100644 > --- a/core/cpu.c > +++ b/core/cpu.c > @@ -734,7 +734,7 @@ struct cpu_thread *next_ungarded_primary(struct cpu_thread *cpu) > { > do { > cpu = next_cpu(cpu); > - } while(cpu && cpu->state == cpu_state_unavailable && cpu->primary != cpu); > + } while(cpu && (cpu->state == cpu_state_unavailable || cpu->primary != cpu)); > > return cpu; > } Wow, good catch, thanks. Reviewed-by: Nicholas Piggin <npiggin@gmail.com>
Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com> writes: > Fix the logic error in the loop that iterated incorrectly > over garded cpu. > > Signed-off-by: Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com> > --- > core/cpu.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Nice. Series merged to master as of 2aa2616358e38a38032efeadcd17ef4cd91e088c
diff --git a/core/cpu.c b/core/cpu.c index 6826fee0..369eb5b9 100644 --- a/core/cpu.c +++ b/core/cpu.c @@ -734,7 +734,7 @@ struct cpu_thread *next_ungarded_primary(struct cpu_thread *cpu) { do { cpu = next_cpu(cpu); - } while(cpu && cpu->state == cpu_state_unavailable && cpu->primary != cpu); + } while(cpu && (cpu->state == cpu_state_unavailable || cpu->primary != cpu)); return cpu; }
Fix the logic error in the loop that iterated incorrectly over garded cpu. Signed-off-by: Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com> --- core/cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)