percpu_ref: Don't opencode percpu_ref_is_dying
Subsystems (2)
PATCH 1/1 percpu_ref: Don't opencode percpu_ref_is_dying
Signed-off-by Nikolay Borisov <[email protected]>
--- lib/percpu-refcount.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
lib/percpu-refcount.c +3 -3
@@ -275,7 +275,7 @@ static void __percpu_ref_switch_mode(struct percpu_ref *ref,wait_event_lock_irq (percpu_ref_switch_waitq, !data->confirm_switch, percpu_ref_switch_lock); -if (data->force_atomic || (ref->percpu_count_ptr & __PERCPU_REF_DEAD)) +if (data->force_atomic ||percpu_ref_is_dying (ref))__percpu_ref_switch_to_atomic (ref, confirm_switch);else __percpu_ref_switch_to_percpu (ref);
@@ -385,7 +385,7 @@ void percpu_ref_kill_and_confirm(struct percpu_ref *ref,spin_lock_irqsave (&percpu_ref_switch_lock, flags); -WARN_ONCE (ref->percpu_count_ptr & __PERCPU_REF_DEAD, +WARN_ONCE (percpu_ref_is_dying (ref),"%s called more than once on %ps!" , __func__, ref->data->release);
@@ -465,7 +465,7 @@ void percpu_ref_resurrect(struct percpu_ref *ref)spin_lock_irqsave (&percpu_ref_switch_lock, flags); -WARN_ON_ONCE (!(ref->percpu_count_ptr & __PERCPU_REF_DEAD)); +WARN_ON_ONCE (!percpu_ref_is_dying (ref));WARN_ON_ONCE (__ref_is_percpu (ref, &percpu_count)); ref->percpu_count_ptr &= ~__PERCPU_REF_DEAD;
Signature · 1 line
2.25.1
Dennis Zhou
maintainerHello,
Quoted 39 lines · Nikolay Borisov
Signed-off-by Nikolay Borisov <[email protected]>--- lib/percpu-refcount.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)lib/percpu-refcount.c +3
-3@@ -275,7 +275,7 @@ static void __percpu_ref_switch_mode(struct percpu_ref *ref,wait_event_lock_irq (percpu_ref_switch_waitq, !data->confirm_switch, percpu_ref_switch_lock); -if (data->force_atomic || (ref->percpu_count_ptr & __PERCPU_REF_DEAD)) +if (data->force_atomic ||percpu_ref_is_dying (ref))__percpu_ref_switch_to_atomic (ref, confirm_switch);else __percpu_ref_switch_to_percpu (ref);@@ -385,7 +385,7 @@ void percpu_ref_kill_and_confirm(struct percpu_ref *ref,spin_lock_irqsave (&percpu_ref_switch_lock, flags); -WARN_ONCE (ref->percpu_count_ptr & __PERCPU_REF_DEAD, +WARN_ONCE (percpu_ref_is_dying (ref),"%s called more than once on %ps!" , __func__, ref->data->release);@@ -465,7 +465,7 @@ void percpu_ref_resurrect(struct percpu_ref *ref)spin_lock_irqsave (&percpu_ref_switch_lock, flags); -WARN_ON_ONCE (!(ref->percpu_count_ptr & __PERCPU_REF_DEAD)); +WARN_ON_ONCE (!percpu_ref_is_dying (ref));WARN_ON_ONCE (__ref_is_percpu (ref, &percpu_count)); ref->percpu_count_ptr &= ~__PERCPU_REF_DEAD;Signature · 1 line
2.25.1
If no one has any objections to me officially taking percpu_ref, I'll pick this up.
Thanks,
Dennis
Quoted 46 lines · Dennis Zhou
Hello,
Quoted 39 lines · Nikolay Borisov
Signed-off-by Nikolay Borisov <[email protected]>--- lib/percpu-refcount.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)lib/percpu-refcount.c +3
-3@@ -275,7 +275,7 @@ static void __percpu_ref_switch_mode(struct percpu_ref *ref,wait_event_lock_irq (percpu_ref_switch_waitq, !data->confirm_switch, percpu_ref_switch_lock); -if (data->force_atomic || (ref->percpu_count_ptr & __PERCPU_REF_DEAD)) +if (data->force_atomic ||percpu_ref_is_dying (ref))__percpu_ref_switch_to_atomic (ref, confirm_switch);else __percpu_ref_switch_to_percpu (ref);@@ -385,7 +385,7 @@ void percpu_ref_kill_and_confirm(struct percpu_ref *ref,spin_lock_irqsave (&percpu_ref_switch_lock, flags); -WARN_ONCE (ref->percpu_count_ptr & __PERCPU_REF_DEAD, +WARN_ONCE (percpu_ref_is_dying (ref),"%s called more than once on %ps!" , __func__, ref->data->release);@@ -465,7 +465,7 @@ void percpu_ref_resurrect(struct percpu_ref *ref)spin_lock_irqsave (&percpu_ref_switch_lock, flags); -WARN_ON_ONCE (!(ref->percpu_count_ptr & __PERCPU_REF_DEAD)); +WARN_ON_ONCE (!percpu_ref_is_dying (ref));WARN_ON_ONCE (__ref_is_percpu (ref, &percpu_count)); ref->percpu_count_ptr &= ~__PERCPU_REF_DEAD;Signature · 1 line
2.25.1If no one has any objections to me officially taking
percpu_ref, I'll pick this up.
Quoted 2 lines
Thanks,
Dennis
I've applied this to for-5.13-fixes.
Thanks,
Dennis