Skip to contentSkip to conversation

core: clean up user return notifers use of per_cpu

PATCH In review Avi Kivity 1 participant 2 messages Nov 30, 2009 – Dec 2, 2009 KVM

lore
Share & tools
lore

Avi Kivity

author
#0 lore raw

PATCH 1/1 core: clean up user return notifers use of per_cpu

Instead of using per_cpu(..., raw_smp_processor_id()), use __get_cpu_var(...).

---
 kernel/user-return-notifier.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)
kernel/user-return-notifier.c +2 -4
index 03e2d6f..eb27fd3 100644
@@ -6,8 +6,6 @@
 
 static DEFINE_PER_CPU(struct hlist_head, return_notifier_list);
 
-#define URN_LIST_HEAD per_cpu(return_notifier_list, raw_smp_processor_id())
-
 /*
  * Request a notification when the current cpu returns to userspace.  Must be
  * called in atomic context.  The notifier will also be called in atomic
@@ -16,7 +14,7 @@ static DEFINE_PER_CPU(struct hlist_head, return_notifier_list);
 void user_return_notifier_register(struct user_return_notifier *urn)
 {
 	set_tsk_thread_flag(current, TIF_USER_RETURN_NOTIFY);
-	hlist_add_head(&urn->link, &URN_LIST_HEAD);
+	hlist_add_head(&urn->link, &__get_cpu_var(return_notifier_list));
 }
 EXPORT_SYMBOL_GPL(user_return_notifier_register);
 
@@ -27,7 +25,7 @@ EXPORT_SYMBOL_GPL(user_return_notifier_register);
 void user_return_notifier_unregister(struct user_return_notifier *urn)
 {
 	hlist_del(&urn->link);
-	if (hlist_empty(&URN_LIST_HEAD))
+	if (hlist_empty(&__get_cpu_var(return_notifier_list)))
 		clear_tsk_thread_flag(current, TIF_USER_RETURN_NOTIFY);
 }
 EXPORT_SYMBOL_GPL(user_return_notifier_unregister);
Signature · 1 line
1.6.5.2
#1 lore raw

[tip:x86/entry] core: Clean up user return notifers use of per_cpu

Commit-ID:  1786bf009f18f722afbb62143c8541e7e60a4e92
Gitweb:     http://git.kernel.org/tip/1786bf009f18f722afbb62143c8541e7e60a4e92
Author:     Avi Kivity <[email protected]>
AuthorDate: Mon, 30 Nov 2009 12:54:51 +0200
Committer:  Ingo Molnar <[email protected]>
CommitDate: Wed, 2 Dec 2009 10:22:59 +0100

core: Clean up user return notifers use of per_cpu

Instead of using per_cpu(..., raw_smp_processor_id()), use __get_cpu_var(...).

LKML-Reference: <[email protected]>

---
 kernel/user-return-notifier.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)
kernel/user-return-notifier.c +2 -4
index 03e2d6f..eb27fd3 100644
@@ -6,8 +6,6 @@
 
 static DEFINE_PER_CPU(struct hlist_head, return_notifier_list);
 
-#define URN_LIST_HEAD per_cpu(return_notifier_list, raw_smp_processor_id())
-
 /*
  * Request a notification when the current cpu returns to userspace.  Must be
  * called in atomic context.  The notifier will also be called in atomic
@@ -16,7 +14,7 @@ static DEFINE_PER_CPU(struct hlist_head, return_notifier_list);
 void user_return_notifier_register(struct user_return_notifier *urn)
 {
 	set_tsk_thread_flag(current, TIF_USER_RETURN_NOTIFY);
-	hlist_add_head(&urn->link, &URN_LIST_HEAD);
+	hlist_add_head(&urn->link, &__get_cpu_var(return_notifier_list));
 }
 EXPORT_SYMBOL_GPL(user_return_notifier_register);
 
@@ -27,7 +25,7 @@ EXPORT_SYMBOL_GPL(user_return_notifier_register);
 void user_return_notifier_unregister(struct user_return_notifier *urn)
 {
 	hlist_del(&urn->link);
-	if (hlist_empty(&URN_LIST_HEAD))
+	if (hlist_empty(&__get_cpu_var(return_notifier_list)))
 		clear_tsk_thread_flag(current, TIF_USER_RETURN_NOTIFY);
 }
 EXPORT_SYMBOL_GPL(user_return_notifier_unregister);