From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750905AbdAPRLs (ORCPT ); Mon, 16 Jan 2017 12:11:48 -0500 Received: from bombadil.infradead.org ([198.137.202.9]:50346 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750734AbdAPRLp (ORCPT ); Mon, 16 Jan 2017 12:11:45 -0500 Date: Mon, 16 Jan 2017 18:11:30 +0100 From: Peter Zijlstra To: "Paul E. McKenney" Cc: linux-kernel@vger.kernel.org, mingo@kernel.org, jiangshanlai@gmail.com, dipankar@in.ibm.com, akpm@linux-foundation.org, mathieu.desnoyers@efficios.com, josh@joshtriplett.org, tglx@linutronix.de, rostedt@goodmis.org, dhowells@redhat.com, edumazet@google.com, dvhart@linux.intel.com, fweisbec@gmail.com, oleg@redhat.com, bobby.prani@gmail.com Subject: Re: [PATCH tip/core/rcu 11/20] sched,rcu: Make cond_resched() provide RCU quiescent state Message-ID: <20170116171130.GC6500@twins.programming.kicks-ass.net> References: <20170114091255.GA20854@linux.vnet.ibm.com> <1484385201-22227-11-git-send-email-paulmck@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1484385201-22227-11-git-send-email-paulmck@linux.vnet.ibm.com> User-Agent: Mutt/1.5.23.1 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jan 14, 2017 at 01:13:12AM -0800, Paul E. McKenney wrote: > There is some confusion as to which of cond_resched() or > cond_resched_rcu_qs() should be added to long in-kernel loops. > This commit therefore eliminates the decision by adding RCU > quiescent states to cond_resched(). Which would make: rcu_read_lock(); cond_resched(); rcu_read_unlock(); invalid under preemptible RCU. Is it already? > Warning: This is a prototype. For example, it does not correctly > handle Tasks RCU. Which is OK for the moment, given that no one > actually uses Tasks RCU yet. > --- a/kernel/sched/core.c > +++ b/kernel/sched/core.c > @@ -4907,6 +4907,7 @@ int __sched _cond_resched(void) > preempt_schedule_common(); > return 1; > } > + rcu_all_qs(); > return 0; > } Still not a real fan of this, it does make cond_resched() touch a bunch more cachelines, also, I suppose that if we're going to do this, we should make __cond_resched_lock() and __cond_resched_softirq() act similarly.