Received: by 10.223.185.116 with SMTP id b49csp3765821wrg; Tue, 6 Mar 2018 04:44:49 -0800 (PST) X-Google-Smtp-Source: AG47ELsVNaMfzCa/oOwg6ppTR5CELrexc2aVMoGilxLsecPgbnbYvfA2jsQpb5p5s1hrnxrIKdAm X-Received: by 2002:a17:902:7717:: with SMTP id n23-v6mr16389696pll.388.1520340288945; Tue, 06 Mar 2018 04:44:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520340288; cv=none; d=google.com; s=arc-20160816; b=JPKYtNzPlCbsFiTIKB1qSu8zhDviRU/W2xnOC1fRJpz5YiI8BPmXYWYiocgETOQtLE YyUFQnwUvGD/UxwiOiQxWMSlhQjh1tRw9nNlrBwJhyAEWOqGT/EXliYdVNDx7EdaB9NW eBM0WFoHveT9GHxiOBVV7OFsgoWA34HYTTvYQKzHN1HfgP1E6ZoQpeFIeoM0dGVeYxYI Yc9SkwE67copNCjY1aMcAlV8sB7IN4bN5EdmUT9wu1zGlst4qu9/KlKuTMHC8Fqw2YPk 3fXZrsTgNe9PNm1Loh59oeqDBi3b4ynXs73dGBqWsDARcWG3wIzMgE05vr+QacLcqgnB P+Yg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=mPCUImotoKXdyaghOt3kecRvrNBL+JWuvsAc2CY24gY=; b=FUZMe++tutMwCu6SfolNOwLUAsAQwbrmNkiDfl1Vkysyar6COgla4wprNVk+GUIGpk Sl7yQyspgIW78X0pd5CLc35H9uhZmzXDe6iP+H/kYJUPAjpyCxOwSID6B8VeWzalIcU6 cfDAeamMLxvDw4yWFrteYcklUcijWwXcyQ3yncONT53bUhLZSI+W7vKksSwWN/wpE2Vp 7yJnUtd5lh3Evz/RcCUeWzGPA/l0nAWuZ1WSfipgqg07bTA2B9ADf5pgH/PMKb80TEcw VH3QoYaJANZaC8IXxQQy8NwFu4Jk31s8wFRKan98VRFlCnuDWKoFwPq6F8r3uS/vS8PD Dhig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=uTiauLc2; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y4si9845054pgc.601.2018.03.06.04.44.34; Tue, 06 Mar 2018 04:44:48 -0800 (PST) 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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=uTiauLc2; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753487AbeCFMnW (ORCPT + 99 others); Tue, 6 Mar 2018 07:43:22 -0500 Received: from mail-lf0-f66.google.com ([209.85.215.66]:41738 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750859AbeCFMnU (ORCPT ); Tue, 6 Mar 2018 07:43:20 -0500 Received: by mail-lf0-f66.google.com with SMTP id m69so28263160lfe.8 for ; Tue, 06 Mar 2018 04:43:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=mPCUImotoKXdyaghOt3kecRvrNBL+JWuvsAc2CY24gY=; b=uTiauLc2Ahij+hKfIdq06exycQ1jDfAzzRGh762nRFVc0m3BoAXH+99hHte/Y7slVx hUD0Vsk3l7qcIiY8Xs6QKu/wJDsfxFHxT2I6ClnkPxdc1Kh6FCZqTPHJitNIV0MZD3XO 3faaznahq33DTrDg+MHpIwPSF8Yp4xL4QI50/VylRvFZISyPpZ5mc+xoBnzuC7j1L6QT BNJVI0kjLvM7BAhQ73L2nU+kK/cpaVA5uAirFjRq4CNuves0EyPa+29SvYz0NduEChHL 7dw5CKfxdvKA50oh3nxEFOio9v6QMECCXYxdERukf4xr0TXEsGyncWz2qwqlwNIoobTH l0gg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=mPCUImotoKXdyaghOt3kecRvrNBL+JWuvsAc2CY24gY=; b=Ud/QKxWZlh/IJw57wETtigm2uq1+5/qf7KtZ3b4EkoLL59vXVQHj27AE6+yiMH89SZ X7bTcTX2qY3ZBbDnZ5fMzPlejsaCizPJUsbBuzMrxRO0Tlq0P87vhKCypuTfScfRpndM qjQhwSrBedUkEnwIOTrC2dgICfb6WnC/5FhBO87zB8FDkMz1hDoQcLNr/UICP/uaLZoE oIR2LsROAjV4wO6oZ/w1xgtlY/lEic5ED0GlVhFw0uEwQWnfFHoFatr34XSdbzPwtPgV m+dG1CxNp200ZNZfp230k1MTucaLRNGObQsuUVKSG7kVdt5vQLV2vTWKhAwMQJylYpQ4 158g== X-Gm-Message-State: AElRT7H2Unqmyi6FwIrgAFKcI8mgxWmUDYObGPMsGc5jCfVXUobohdBG XboIzPj9EhVgRlIBfEZy1r6zFuRcFVKaGw94Uoau6Q== X-Received: by 10.25.29.81 with SMTP id d78mr13290736lfd.18.1520340199541; Tue, 06 Mar 2018 04:43:19 -0800 (PST) MIME-Version: 1.0 Received: by 10.179.65.176 with HTTP; Tue, 6 Mar 2018 04:43:19 -0800 (PST) In-Reply-To: References: <1520314318-30916-1-git-send-email-byungchul.park@lge.com> From: Byungchul Park Date: Tue, 6 Mar 2018 21:43:19 +0900 Message-ID: Subject: Re: [RFC] rcu: Prevent expedite reporting within RCU read-side section To: Byungchul Park , Paul McKenney Cc: rostedt@goodmis.org, josh@joshtriplett.org, jiangshanlai@gmail.com, kernel-team@lge.com, Mathieu Desnoyers , linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mar 6, 2018 2:34 PM, "Byungchul Park" wrote: > > Hello Paul and RCU folks, > > I am afraid I correctly understand and fix it. But I really wonder why > sync_rcu_exp_handler() reports the quiescent state even in the case that > current task is within a RCU read-side section. Do I miss something? Hello, I missed the fact that the original code is anyway safe because the case is gonna be handled properly in rcu_read_unlock(). This patch just makes unnecessary spin lock/unlock within *report*() avoided. Please ignore this if you don't think it's that worthy. I am also not sure if it is. Sorry bothering you. And thanks. > If I correctly understand it and you agree with it, I can add more logic > which make it more expedited by boosting current or making it urgent > when we fail to report the quiescent state on the IPI. > > ----->8----- > From 0b0191f506c19ce331a1fdb7c2c5a00fb23fbcf2 Mon Sep 17 00:00:00 2001 > From: Byungchul Park > Date: Tue, 6 Mar 2018 13:54:41 +0900 > Subject: [RFC] rcu: Prevent expedite reporting within RCU read-side section > > We report the quiescent state for this cpu if it's out of RCU read-side > section at the moment IPI was just fired during the expedite process. > > However, current code reports the quiescent state even in the case: > > 1) the current task is still within a RCU read-side section > 2) the current task has been blocked within the RCU read-side section > > Since we don't get to the quiescent state yet in the case, we shouldn't > report it but check it another time. > > Signed-off-by: Byungchul Park > --- > kernel/rcu/tree_exp.h | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/kernel/rcu/tree_exp.h b/kernel/rcu/tree_exp.h > index 73e1d3d..cc69d14 100644 > --- a/kernel/rcu/tree_exp.h > +++ b/kernel/rcu/tree_exp.h > @@ -731,13 +731,13 @@ static void sync_rcu_exp_handler(void *info) > /* > * We are either exiting an RCU read-side critical section (negative > * values of t->rcu_read_lock_nesting) or are not in one at all > - * (zero value of t->rcu_read_lock_nesting). Or we are in an RCU > - * read-side critical section that blocked before this expedited > - * grace period started. Either way, we can immediately report > - * the quiescent state. > + * (zero value of t->rcu_read_lock_nesting). We can immediately > + * report the quiescent state. > */ > - rdp = this_cpu_ptr(rsp->rda); > - rcu_report_exp_rdp(rsp, rdp, true); > + if (t->rcu_read_lock_nesting <= 0) { > + rdp = this_cpu_ptr(rsp->rda); > + rcu_report_exp_rdp(rsp, rdp, true); > + } > } > > /** > -- > 1.9.1 >