Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp503648imm; Wed, 20 Jun 2018 01:49:24 -0700 (PDT) X-Google-Smtp-Source: ADUXVKL8N55o4GVuP/v/buqqn66kq6UI3Fo9dOqQQKYZeKqA9Z9ZBikIufXi4RLoopVXXlEDDJWZ X-Received: by 2002:a63:bc0a:: with SMTP id q10-v6mr17869468pge.70.1529484564575; Wed, 20 Jun 2018 01:49:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529484564; cv=none; d=google.com; s=arc-20160816; b=JuhPyBiGZZRIQKFEK7k7Da6co03VDKKRYCL5pA1bPzVFo/g1xjS4B4/BTP8dbLdHxs 10FwmBXtJi0baEcVLKLR+t30IHfutxBdbchDuHB5NiTXgYrI9ZxH4wzyf6Xfe7XL6mNn gKAkX9kLo559Cg7EcumPuv8j9nnacq5uEf1bdEbxNIkbLeBHYiX5BGf3qbMDqOpUnOGs yVT1lSKzKdl8ar7Ky/uDWgtzjuy0lJQwosgKF9bANYONGZLAVOMxgg2iB3YeG3WeQIHq P99PWPaskpsD5nPyuoXP2GI3gXSxBdpMnDbZCDPoy4YFzveprWPv7YZXhAdQodIo6uap h+yw== 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=XEs+b3E8JQYsqSsHZsF14n5D93WLrYScwqXlqZsSOk4=; b=zqs1MwJ8C0012XhpxPIz0uiPgyf2mgs9XJOGsgDItOeaK1UXRd7mr6MVbuBpX0AeXT rpqLbi39hMS5Fk4Cs8Ph6mN07v35YOj3+lcpQYU2/ZgF0N3l4GXq6T5INSqErWXQ92V8 Oa7avUntH53JnxF1R5yRtnC/SV6GRxE1itO7bdrtV/Bm/O7TnyuyjH5jaitvbYyZsart E2yYa+cl49SLsPciCH+8caifNf9Cr3ijgejLU11uYUQblmQq3sJlet5+i5CaBOtaDM4v z1Tv7WuX13lJMjyu22y75axUUiDVu3fTtIxOoCnS8aVFIB9EYQuYL+1LsWO53GDdZUjV 4Juw== 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 z62-v6si1895856pfk.197.2018.06.20.01.49.10; Wed, 20 Jun 2018 01:49:24 -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 S933149AbeFTIr1 (ORCPT + 99 others); Wed, 20 Jun 2018 04:47:27 -0400 Received: from lgeamrelo13.lge.com ([156.147.23.53]:45304 "EHLO lgeamrelo11.lge.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933111AbeFTIrY (ORCPT ); Wed, 20 Jun 2018 04:47:24 -0400 Received: from unknown (HELO lgeamrelo02.lge.com) (156.147.1.126) by 156.147.23.53 with ESMTP; 20 Jun 2018 17:47:22 +0900 X-Original-SENDERIP: 156.147.1.126 X-Original-MAILFROM: byungchul.park@lge.com Received: from unknown (HELO localhost.localdomain) (10.177.222.33) by 156.147.1.126 with ESMTP; 20 Jun 2018 17:47:22 +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, joel@joelfernandes.org Subject: [RFC 1/2] rcu: Do prepare and cleanup idle depending on in_nmi() Date: Wed, 20 Jun 2018 17:47:19 +0900 Message-Id: <1529484440-20634-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 Get rid of dependency on ->dynticks_nmi_nesting. Signed-off-by: Byungchul Park --- kernel/rcu/tree.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index deb2508..59ae94e 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c @@ -797,6 +797,11 @@ void rcu_nmi_exit(void) return; } + if (!in_nmi()) { + rcu_prepare_for_idle(); + rcu_dynticks_task_enter(); + } + /* This NMI interrupted an RCU-idle CPU, restore RCU-idleness. */ trace_rcu_dyntick(TPS("Startirq"), rdtp->dynticks_nmi_nesting, 0, rdtp->dynticks); WRITE_ONCE(rdtp->dynticks_nmi_nesting, 0); /* Avoid store tearing. */ @@ -824,14 +829,8 @@ void rcu_nmi_exit(void) */ void rcu_irq_exit(void) { - struct rcu_dynticks *rdtp = this_cpu_ptr(&rcu_dynticks); - lockdep_assert_irqs_disabled(); - if (rdtp->dynticks_nmi_nesting == 1) - rcu_prepare_for_idle(); rcu_nmi_exit(); - if (rdtp->dynticks_nmi_nesting == 0) - rcu_dynticks_task_enter(); } /* @@ -944,6 +943,11 @@ void rcu_nmi_enter(void) if (rcu_dynticks_curr_cpu_in_eqs()) { rcu_dynticks_eqs_exit(); incby = 1; + + if (!in_nmi()) { + rcu_dynticks_task_exit(); + rcu_cleanup_after_idle(); + } } trace_rcu_dyntick(incby == 1 ? TPS("Endirq") : TPS("++="), rdtp->dynticks_nmi_nesting, @@ -977,14 +981,8 @@ void rcu_nmi_enter(void) */ void rcu_irq_enter(void) { - struct rcu_dynticks *rdtp = this_cpu_ptr(&rcu_dynticks); - lockdep_assert_irqs_disabled(); - if (rdtp->dynticks_nmi_nesting == 0) - rcu_dynticks_task_exit(); rcu_nmi_enter(); - if (rdtp->dynticks_nmi_nesting == 1) - rcu_cleanup_after_idle(); } /* -- 1.9.1