From patchwork Mon Nov 30 10:54:51 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Avi Kivity X-Patchwork-Id: 63670 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id nAUAtLZV018311 for ; Mon, 30 Nov 2009 10:55:21 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752374AbZK3Kyv (ORCPT ); Mon, 30 Nov 2009 05:54:51 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751860AbZK3Kyv (ORCPT ); Mon, 30 Nov 2009 05:54:51 -0500 Received: from mx1.redhat.com ([209.132.183.28]:1934 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751208AbZK3Kyu (ORCPT ); Mon, 30 Nov 2009 05:54:50 -0500 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id nAUAsqtb005991 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 30 Nov 2009 05:54:52 -0500 Received: from cleopatra.tlv.redhat.com (cleopatra.tlv.redhat.com [10.35.255.11]) by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id nAUAspLI028561; Mon, 30 Nov 2009 05:54:52 -0500 Received: from localhost.localdomain (file.tlv.redhat.com [10.35.255.8]) by cleopatra.tlv.redhat.com (Postfix) with ESMTP id 8F0FF25004A; Mon, 30 Nov 2009 12:54:51 +0200 (IST) From: Avi Kivity To: Ingo Molnar , "H. Peter Anvin" Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Subject: [PATCH] core: clean up user return notifers use of per_cpu Date: Mon, 30 Nov 2009 12:54:51 +0200 Message-Id: <1259578491-4589-1-git-send-email-avi@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.18 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org diff --git a/kernel/user-return-notifier.c b/kernel/user-return-notifier.c index 03e2d6f..eb27fd3 100644 --- a/kernel/user-return-notifier.c +++ b/kernel/user-return-notifier.c @@ -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);