From patchwork Fri Sep 18 07:52:15 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Zijlstra X-Patchwork-Id: 7213641 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id B29A49F6DA for ; Fri, 18 Sep 2015 07:57:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EBA61207C1 for ; Fri, 18 Sep 2015 07:57:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 08E0A207AD for ; Fri, 18 Sep 2015 07:57:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751460AbbIRH5l (ORCPT ); Fri, 18 Sep 2015 03:57:41 -0400 Received: from casper.infradead.org ([85.118.1.10]:40870 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750957AbbIRH5k (ORCPT ); Fri, 18 Sep 2015 03:57:40 -0400 Received: from 178-85-85-44.dynamic.upc.nl ([178.85.85.44] helo=twins) by casper.infradead.org with esmtpsa (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZcqY3-0002dU-IO; Fri, 18 Sep 2015 07:57:35 +0000 Received: by twins (Postfix, from userid 1000) id 8F21E122C8235; Fri, 18 Sep 2015 09:52:15 +0200 (CEST) Date: Fri, 18 Sep 2015 09:52:15 +0200 From: Peter Zijlstra To: Tim Chen Cc: Dominik Dingel , Paolo Bonzini , linux-crypto@vger.kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, "David S. Miller" , herbert@gondor.apana.org.au, Ingo Molnar Subject: Re: single_task_running() vs. preemption warnings (was Re: [PATCH] kvm: fix preemption warnings in kvm_vcpu_block) Message-ID: <20150918075215.GR3816@twins.programming.kicks-ass.net> References: <1442507270-67227-1-git-send-email-dingel@linux.vnet.ibm.com> <55FAEE0C.60904@redhat.com> <20150917190752.27396fdb@BR9TG4T3.de.ibm.com> <1442521975.6240.13.camel@schen9-desk2.jf.intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1442521975.6240.13.camel@schen9-desk2.jf.intel.com> User-Agent: Mutt/1.5.21 (2012-12-30) 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 On Thu, Sep 17, 2015 at 01:32:55PM -0700, Tim Chen wrote: > I have no objection to change single_task_running to use > raw_smp_processor_id. The worker in mcryptd is bound to > the cpu so it has no migration/preemption issue. So it shouldn't care > which smp_processor_id version is being used. Yes, please add a comment > to alert the user of this caveat should you change single_task_running. We actually have raw_rq() for that, and the whole if thing looks rather superfluous. So something like the below, except with a suitable comment on and tested etc.. ;-) --- kernel/sched/core.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 6ab415aa15c4..f39c0498e284 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -2666,10 +2666,7 @@ unsigned long nr_running(void) */ bool single_task_running(void) { - if (cpu_rq(smp_processor_id())->nr_running == 1) - return true; - else - return false; + return raw_rq()->nr_running == 1; } EXPORT_SYMBOL(single_task_running);