If cpu A calls jump_label_inc() just after atomic_add_return() is called by cpu B, atomic_inc_not_zero() will return value greater then zero and jump_label_inc() will return to a caller before jump_label_update() finishes its job on cpu B. Link: http://lkml.kernel.org/r/20111018175551.GH17571@redhat.com
Showing the changes to kernel (1 of 1 file). Show all
Unified · Split
| @@ -66,8 +66,9 @@ void jump_label_inc(struct jump_label_key *key) · 65 unmodified lines | |||
| 66 | return; | 66 | return; |
| 67 | 67 | ||
| 68 | jump_label_lock(); | 68 | jump_label_lock(); |
| 69 | if (atomic_add_return(1, &key->enabled) == 1) | 69 | if (atomic_read(&key->enabled) == 0) |
| 70 | jump_label_update(key, JUMP_LABEL_ENABLE); | 70 | jump_label_update(key, JUMP_LABEL_ENABLE); |
| 71 | atomic_inc(&key->enabled); | ||
| 71 | jump_label_unlock(); | 72 | jump_label_unlock(); |
| 72 | } | 73 | } |
| 73 | 74 | ||