cpu_relax(): ptrace.c coding style fix
PATCH 6/6 cpu_relax(): ptrace.c coding style fix
Fix existing cpu_relax() loop to have proper kernel style.
Tested on 2.6.17-mm1.
kernel/ptrace.c +1 -2
@@ -182,9 +182,8 @@if (!write_trylock (&tasklist_lock)) {local_irq_enable ();task_unlock (task); -do { +while (!write_can_lock (&tasklist_lock))cpu_relax (); - }while (!write_can_lock (&tasklist_lock)); goto repeat; }
Quoted 3 lines · Andreas Mohr
Fix existing
cpu_relax()loop to have proper kernel style.
...
kernel/ptrace.c line 187
Quoted 8 lines
kernel/ptrace.c +1
-2@@ -182,9 +182,8 @@if (!write_trylock (&tasklist_lock)) {local_irq_enable ();task_unlock (task); -do { +while (!write_can_lock (&tasklist_lock))cpu_relax (); - }while (!write_can_lock (&tasklist_lock));
This is a change in behavior, not just style. (And there is nothing wrong with the current style.)
Quoted 7 lines · Nathan Lynch
Quoted 3 lines · Andreas Mohr
Fix existing
cpu_relax()loop to have proper kernel style....
Quoted 11 lines
kernel/ptrace.c line 187
Quoted 8 lines
kernel/ptrace.c +1
-2@@ -182,9 +182,8 @@if (!write_trylock (&tasklist_lock)) {local_irq_enable ();task_unlock (task); -do { +while (!write_can_lock (&tasklist_lock))cpu_relax (); - }while (!write_can_lock (&tasklist_lock));This is a change in behavior, not just style. (And there is nothing wrong with the current style.)
Ick, right, this could cause the new state to be visible in the 2nd iteration only.
Thanks! Discard this change please.
Andreas Mohr
Hi!
Quoted 1 line
Fix existing
cpu_relax()loop to have proper kernel style.
..but you change the code, not its style.
kernel/ptrace.c line 188
Quoted 10 lines
kernel/ptrace.c +1
-2@@ -182,9 +182,8 @@if (!write_trylock (&tasklist_lock)) {local_irq_enable ();task_unlock (task); -do { +while (!write_can_lock (&tasklist_lock))cpu_relax (); - }while (!write_can_lock (&tasklist_lock)); goto repeat; }
I guess that barrier was needed before write_can_lock can succeed. => your version does one unneccessary test.
Signature · 1 line
64 bytes from 195.113.31.123: icmp_seq=28 ttl=51 time=448769.1 ms