From: Peter Zijlstra <peterz@infradead.org>
To: Tim Chen <tim.c.chen@linux.intel.com>
Cc: Dominik Dingel <dingel@linux.vnet.ibm.com>,
Paolo Bonzini <pbonzini@redhat.com>,
linux-crypto@vger.kernel.org, kvm@vger.kernel.org,
linux-kernel@vger.kernel.org,
"David S. Miller" <davem@davemloft.net>,
herbert@gondor.apana.org.au, Ingo Molnar <mingo@redhat.com>
Subject: Re: single_task_running() vs. preemption warnings (was Re: [PATCH] kvm: fix preemption warnings in kvm_vcpu_block)
Date: Fri, 18 Sep 2015 09:52:15 +0200 [thread overview]
Message-ID: <20150918075215.GR3816@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <1442521975.6240.13.camel@schen9-desk2.jf.intel.com>
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(-)
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);
prev parent reply other threads:[~2015-09-18 7:52 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-17 16:27 [PATCH] kvm: fix preemption warnings in kvm_vcpu_block Dominik Dingel
2015-09-17 16:45 ` single_task_running() vs. preemption warnings (was Re: [PATCH] kvm: fix preemption warnings in kvm_vcpu_block) Paolo Bonzini
2015-09-17 17:07 ` Dominik Dingel
2015-09-17 20:32 ` Tim Chen
2015-09-18 7:52 ` Peter Zijlstra [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150918075215.GR3816@twins.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=davem@davemloft.net \
--cc=dingel@linux.vnet.ibm.com \
--cc=herbert@gondor.apana.org.au \
--cc=kvm@vger.kernel.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=pbonzini@redhat.com \
--cc=tim.c.chen@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.