Received: by 2002:a05:6a10:6d25:0:0:0:0 with SMTP id gq37csp6183358pxb; Wed, 21 Jul 2021 13:49:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwt8Y9ryztJe5E5zTuX20e2xnHjcFeyk85c+XXqmeKBECbSW2AesK3VM5HZpoOJjmtUj4DL X-Received: by 2002:a17:906:b190:: with SMTP id w16mr41313674ejy.332.1626900543920; Wed, 21 Jul 2021 13:49:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626900543; cv=none; d=google.com; s=arc-20160816; b=IssL9WDi+vUT1DTDUZfMIge/Z9tXvb1MhUpLyflMWvZ5GRELp9r3iuyNwUwbwNJ7WF BRQnF9t+r7nOK1U/YeRFxAG+h+3hIgw5fVF1iPzzwPc2997DF/NUlQgO4PAAXG7jC/Vs dtist0TOnhyxWWVhgFEOurGxpou7234A5wvvlzTXlp9RCsycTCxkSmkZFe+Zx9rA4wQi /F+8Kz6Z4ZnUB2nVv21EEz9MolT6EFfqmdTMVtHfFuIHOVia+008btq8MGITrbilHNjQ dDMjYpFd0f7T0ZixFOlaieHxfh1EIBsIvGF66YZy/b/7JXtv3KBFMT3sGgjUm7nfPlnQ nuPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=zpFbCCMYdJTx7E8YI03XN55s4154FgrtHu2RQUplncU=; b=Mq0+HDAm46EhO3Cp1P1jxGBQo+bPLv5nslmi6z6vnvxxshW51amlMFa2jefKT2+g9u i21A9ulN4huKyu8u4rM24Fo88YN+UYxuy8Bzhj2yZSnaA8ogs/AwTGgm4Y2PWYxXMt1n 2Kk8nqGHkFqrzgDXKnVzxc+LIvwxf4qiJ2apkDmJFXn8qNlcfqWKHBPOdskZOZZCCwb2 J99QtyT/DIe0i3UpYYhVkaRraJ/0Oi+P+wovXWxwh1KSKPuq+lhYXZ9AQrS6OVBiXRZS 03fFoYqmc1ejgDCOhpUT7SZ1Ppa9AmQrB0qIPQQDttyCnETVn+M/SFFJRV3MtyIsbQw/ VYGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=K13FYWMX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y15si21800050eda.189.2021.07.21.13.48.39; Wed, 21 Jul 2021 13:49:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=K13FYWMX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240504AbhGUTl2 (ORCPT + 99 others); Wed, 21 Jul 2021 15:41:28 -0400 Received: from mail.kernel.org ([198.145.29.99]:50102 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240399AbhGUTky (ORCPT ); Wed, 21 Jul 2021 15:40:54 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id F02016139A; Wed, 21 Jul 2021 20:21:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1626898890; bh=MwdcEzyqxvGGf9rRbzj9W8+01WNtdWk5AM4dfPjKIEU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K13FYWMXVDFnYgHMWDqShTRRCby/S3XEDN1NsAWSgfRe4Lln9ZUG+EX8GJe/yrWFI 0iljXuShFyFQvWaDPRRyOfLnH0j4ySizE0uC9EFjH/zJr/5V9Pmb8KZOGh7lxamGj8 NLmRU/BpiJfVD3ST19GG9RqsOQpsbX1cckPppr75+BN6bsV39xCSVwEeFdlfXlybJm xEg9ZADcb2Gs+iUH+m0wwZsRadf/fy5InpNrXnzUmCGH+ciRhqCPdq1pXV3PQCUEvi 3sP16LZc5C2NI+jlyRQzJ5WQEYo3tkEgcY8FSoB4MczliifLAovLvJanXFi6E6F4qB C0CaNQc/qgg8A== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 4CA415C0F00; Wed, 21 Jul 2021 13:21:29 -0700 (PDT) From: "Paul E. McKenney" To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@fb.com, mingo@kernel.org, jiangshanlai@gmail.com, akpm@linux-foundation.org, mathieu.desnoyers@efficios.com, josh@joshtriplett.org, tglx@linutronix.de, peterz@infradead.org, rostedt@goodmis.org, dhowells@redhat.com, edumazet@google.com, fweisbec@gmail.com, oleg@redhat.com, joel@joelfernandes.org, Frederic Weisbecker , Neeraj Upadhyay , Uladzislau Rezki , Boqun Feng , "Paul E . McKenney" Subject: [PATCH rcu 17/18] rcu: Explain why rcu_all_qs() is a stub in preemptible TREE RCU Date: Wed, 21 Jul 2021 13:21:25 -0700 Message-Id: <20210721202127.2129660-17-paulmck@kernel.org> X-Mailer: git-send-email 2.31.1.189.g2e36527f23 In-Reply-To: <20210721202042.GA1472052@paulmck-ThinkPad-P17-Gen-1> References: <20210721202042.GA1472052@paulmck-ThinkPad-P17-Gen-1> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Frederic Weisbecker The cond_resched() function reports an RCU quiescent state only in non-preemptible TREE RCU implementation. This commit therefore adds a comment explaining why cond_resched() does nothing in preemptible kernels. Signed-off-by: Frederic Weisbecker Cc: Neeraj Upadhyay Cc: Joel Fernandes Cc: Uladzislau Rezki Cc: Boqun Feng Cc: Peter Zijlstra (Intel) Cc: Ingo Molnar Signed-off-by: Paul E. McKenney --- kernel/sched/core.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 2d9ff40f46619..6a03c3fac55cc 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -7781,6 +7781,17 @@ int __sched __cond_resched(void) preempt_schedule_common(); return 1; } + /* + * In preemptible kernels, ->rcu_read_lock_nesting tells the tick + * whether the current CPU is in an RCU read-side critical section, + * so the tick can report quiescent states even for CPUs looping + * in kernel context. In contrast, in non-preemptible kernels, + * RCU readers leave no in-memory hints, which means that CPU-bound + * processes executing in kernel context might never report an + * RCU quiescent state. Therefore, the following code causes + * cond_resched() to report a quiescent state, but only when RCU + * is in urgent need of one. + */ #ifndef CONFIG_PREEMPT_RCU rcu_all_qs(); #endif -- 2.31.1.189.g2e36527f23