From patchwork Mon Feb 9 16:04:41 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rik van Riel X-Patchwork-Id: 5801941 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 7AAA9BF440 for ; Mon, 9 Feb 2015 16:06:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D37892010B for ; Mon, 9 Feb 2015 16:06:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A6B6120121 for ; Mon, 9 Feb 2015 16:06:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933537AbbBIQFA (ORCPT ); Mon, 9 Feb 2015 11:05:00 -0500 Received: from shelob.surriel.com ([74.92.59.67]:48002 "EHLO shelob.surriel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933518AbbBIQE6 (ORCPT ); Mon, 9 Feb 2015 11:04:58 -0500 Received: from [2002:4a5c:3b41:1:224:e8ff:fe38:995c] (helo=annuminas.surriel.com) by shelob.surriel.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1YKqpT-0002KV-0n; Mon, 09 Feb 2015 11:04:55 -0500 Received: from annuminas.surriel.com (localhost.localdomain [127.0.0.1]) by annuminas.surriel.com (8.14.8/8.14.5) with ESMTP id t19G4s9q022412; Mon, 9 Feb 2015 11:04:54 -0500 Received: (from riel@localhost) by annuminas.surriel.com (8.14.8/8.14.8/Submit) id t19G4sjQ022411; Mon, 9 Feb 2015 11:04:54 -0500 X-Authentication-Warning: annuminas.surriel.com: riel set sender to riel@redhat.com using -f From: riel@redhat.com To: paulmck@linux.vnet.ibm.com Cc: linux-kernel@vger.kernel.org, catalin.marinas@arm.com, will.deacon@arm.com, fweisbec@gmail.com, kvm@vger.kernel.org, mtosatti@redhat.com, borntraeger@de.ibm.com, mingo@kernel.org, oleg@redhat.com, lcapitulino@redhat.com, pbonzini@redhat.com, Rik van Riel Subject: [PATCH 3/6] rcu, nohz: run vtime_user_enter/exit only when state == IN_USER Date: Mon, 9 Feb 2015 11:04:41 -0500 Message-Id: <1423497884-21615-4-git-send-email-riel@redhat.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1423497884-21615-1-git-send-email-riel@redhat.com> References: <1423497884-21615-1-git-send-email-riel@redhat.com> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Rik van Riel Only run vtime_user_enter, vtime_user_exit, and the user enter & exit trace points when we are entering or exiting user state, respectively. The RCU code only distinguishes between "idle" and "not idle or kernel". There should be no need to add an additional (unused) state there. Signed-off-by: Rik van Riel --- kernel/context_tracking.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/kernel/context_tracking.c b/kernel/context_tracking.c index e031e8c0fb91..2d94147c07b2 100644 --- a/kernel/context_tracking.c +++ b/kernel/context_tracking.c @@ -77,7 +77,6 @@ void context_tracking_enter(enum ctx_state state) local_irq_save(flags); if ( __this_cpu_read(context_tracking.state) != state) { if (__this_cpu_read(context_tracking.active)) { - trace_user_enter(0); /* * At this stage, only low level arch entry code remains and * then we'll run in userspace. We can assume there won't be @@ -85,7 +84,10 @@ void context_tracking_enter(enum ctx_state state) * user_exit() or rcu_irq_enter(). Let's remove RCU's dependency * on the tick. */ - vtime_user_enter(current); + if (state == IN_USER) { + trace_user_enter(0); + vtime_user_enter(current); + } rcu_user_enter(); } /* @@ -137,8 +139,10 @@ void context_tracking_exit(enum ctx_state state) * RCU core about that (ie: we may need the tick again). */ rcu_user_exit(); - vtime_user_exit(current); - trace_user_exit(0); + if (state == IN_USER) { + vtime_user_exit(current); + trace_user_exit(0); + } } __this_cpu_write(context_tracking.state, IN_KERNEL); }