Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp496448imm; Fri, 11 May 2018 01:32:07 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrt/IEAY3+Dd7cIH1Rrsnb+XmWUcq2ItaX+GQgAnBu/XWTjL8zjZ9TqcE8Qu3jmKCJYoiBN X-Received: by 2002:a65:6489:: with SMTP id e9-v6mr876576pgv.44.1526027527805; Fri, 11 May 2018 01:32:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526027527; cv=none; d=google.com; s=arc-20160816; b=cwonfGZ6LmOVgM3qndlLE14t0a971ExD+v9wVfsTws3EuZhH14cgnI0ROQ3JCrLvIE BiuPlkO9cMTmNz8WgOym6/w0u59y7UrbnQfpccGfSuY5xQInqbYgqygisHVGh/tc3X7I ws/HjmmTjAjnb3gSJZJiWZN34oUmpxqpwYLmNLBD38UL8ZFWnCCkg2ZdXFalaZR4iT0D 5EZIamcB53DoQlopNHu14T0BkcDQ3ucXHnfJX7egLJB/0HLcy3fxyThJx0oqpzv3oDJh KhozKf5GjB5uBzSjKuJSqQDuA/2qEEj76GXfhvCo2p64NJCBC5SQyyEJvHMid9BgvbMb hBjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=r/DcjYfZdDqWPMd5AIY/qUoYoKRloywMQ3COIRgQQsw=; b=i3DfZ92f5x0fE69oc/DDmAHDraenJNZQZhQhW/2on2Cy37FofyC8PpLpNo2dg55lRp mdzGE43XeehkamS9hbCpXIWgDnV+/wgQd7tRe0MDE9Dz3ba+wiNv9vDIEW0c7JwgGOCB 8CBX6o162Xlr5/Z2Swfwfl6a92UBjPLwhJ5fy5L/FVhzPLUs4fgxi3ZEqTxI0Jn9FWGK GhWn5SaKQwAHD/ptnVx4v15QUgdXIXLAOR0OEl62NERxeetfl/Lwh3iXHE1pUrR1Navm 0ZPuVrluabjpz74XxZHAhhnzHCYqPOgr56xMNPfFgRqcRvB/QxpFE0yXKvKPiDyHtf27 RH5g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p10-v6si2602938plk.295.2018.05.11.01.31.53; Fri, 11 May 2018 01:32:07 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752685AbeEKIbg (ORCPT + 99 others); Fri, 11 May 2018 04:31:36 -0400 Received: from lgeamrelo12.lge.com ([156.147.23.52]:55008 "EHLO lgeamrelo11.lge.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750852AbeEKIbf (ORCPT ); Fri, 11 May 2018 04:31:35 -0400 Received: from unknown (HELO lgemrelse6q.lge.com) (156.147.1.121) by 156.147.23.52 with ESMTP; 11 May 2018 17:31:32 +0900 X-Original-SENDERIP: 156.147.1.121 X-Original-MAILFROM: byungchul.park@lge.com Received: from unknown (HELO localhost.localdomain) (10.177.222.33) by 156.147.1.121 with ESMTP; 11 May 2018 17:31:32 +0900 X-Original-SENDERIP: 10.177.222.33 X-Original-MAILFROM: byungchul.park@lge.com From: Byungchul Park To: jiangshanlai@gmail.com, paulmck@linux.vnet.ibm.com, josh@joshtriplett.org, rostedt@goodmis.org, mathieu.desnoyers@efficios.com Cc: linux-kernel@vger.kernel.org, kernel-team@lge.com Subject: [PATCH] rcu: Report a quiescent state when it's exactly in the state Date: Fri, 11 May 2018 17:30:34 +0900 Message-Id: <1526027434-21237-1-git-send-email-byungchul.park@lge.com> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We expect a quiescent state of TASKS_RCU when cond_resched_tasks_rcu_qs() is called, no matter whether it actually be scheduled or not. However, it currently doesn't report the quiescent state when the task enters into __schedule() as it's called with preempt = true. So make it report the quiescent state unconditionally when cond_resched_tasks_rcu_qs() is called. And in TINY_RCU, even though the quiescent state of rcu_bh also should be reported when the tick interrupt comes from user, it doesn't. So make it reported. Lastly in TREE_RCU, rcu_note_voluntary_context_switch() should be reported when the tick interrupt comes from not only user but also idle, as an extended quiescent state. Signed-off-by: Byungchul Park --- include/linux/rcupdate.h | 4 ++-- kernel/rcu/tiny.c | 6 +++--- kernel/rcu/tree.c | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h index ee8cf5fc..7432261 100644 --- a/include/linux/rcupdate.h +++ b/include/linux/rcupdate.h @@ -195,8 +195,8 @@ static inline void exit_tasks_rcu_finish(void) { } */ #define cond_resched_tasks_rcu_qs() \ do { \ - if (!cond_resched()) \ - rcu_note_voluntary_context_switch_lite(current); \ + rcu_note_voluntary_context_switch_lite(current); \ + cond_resched(); \ } while (0) /* diff --git a/kernel/rcu/tiny.c b/kernel/rcu/tiny.c index a64eee0..68d2332 100644 --- a/kernel/rcu/tiny.c +++ b/kernel/rcu/tiny.c @@ -120,12 +120,12 @@ void rcu_bh_qs(void) */ void rcu_check_callbacks(int user) { - if (user) + if (user) { rcu_sched_qs(); - else if (!in_softirq()) rcu_bh_qs(); - if (user) rcu_note_voluntary_context_switch(current); + } else if (!in_softirq()) + rcu_bh_qs(); } /* diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index 36075dd..1abe29a 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c @@ -2595,6 +2595,7 @@ void rcu_check_callbacks(int user) rcu_sched_qs(); rcu_bh_qs(); + rcu_note_voluntary_context_switch(current); } else if (!in_softirq()) { @@ -2610,8 +2611,7 @@ void rcu_check_callbacks(int user) rcu_preempt_check_callbacks(); if (rcu_pending()) invoke_rcu_core(); - if (user) - rcu_note_voluntary_context_switch(current); + trace_rcu_utilization(TPS("End scheduler-tick")); } -- 1.9.1