Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp867464ybt; Wed, 24 Jun 2020 13:17:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxjKDybHSsDxkBYb35fWD1kh0qrSHThptfu2C3ovZWheQ+O0MavoMnG6rNTdhpVeEAbWz9U X-Received: by 2002:a05:6402:148f:: with SMTP id e15mr29504737edv.368.1593029829725; Wed, 24 Jun 2020 13:17:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593029829; cv=none; d=google.com; s=arc-20160816; b=VhKsy48u4KznzcNgGuJp+Sn1TNIWA0Lm+3K8gJFEwHPnIM9tE6BsxkHrKa8qe0C3nb qY7f0inpmH6eWIZDbtqrp1bcKhBtbHlIfDH5blglTELsOsANo4G56WqyWiaA2S/eRdU7 RGv+jOcPfj6/htHv6NVXXYfBsjro9BCvtJez7qNhML1QuhlPlmacmOPxlOVVxTzjnpIF s7nY8393KGQI5C0fMTA6gcTgS4c11v1juURK45WKmonkiY995j9sWyjjceHT7K+Vde5r TN34whkQNRWPyAR5ihdTEHae5GLuPh0pJltc2hXH5g8uD++x6/nxlDvZXz89XoA2u1Kr sdKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=E/imOu+z8udT93qg2R7MWeMsXoG4jiWed8jvbu26vfs=; b=iiseu3I8aJFquiu1HBf/NAEmpoUWR+vAof/vK7ThtirfqKO2MJQy+kyPozVIbVnSA+ Snpo0gQJOgvjYIa4xjUA1iW+8C6hCHFLhVBTIPjagnw6mnmmN/dXVXoG8sozu0LkFRlh kDxhPNwd0pf8BcupJOlrw6g9BjKrnvyrwaMyeXnwfCLvccwXePJ7UcH10kj4pDhd2dKo Ur6OxyHtBMm+hdYsN1ZHXIYMyRJUoDRtlH7KimTkUEicislP3L/8py5ocDIVHh/4CFS4 xYmdDsNfRUiCG33KtFf7Ei29/4iwqIMU4iEaF4xn+m6NoLgEuN303JMVo9y4VZ83LnVR sD8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=XRtnN15D; 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 s5si13220031edr.214.2020.06.24.13.16.46; Wed, 24 Jun 2020 13:17:09 -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=default header.b=XRtnN15D; 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 S2406539AbgFXUNa (ORCPT + 99 others); Wed, 24 Jun 2020 16:13:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:52478 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406378AbgFXUM3 (ORCPT ); Wed, 24 Jun 2020 16:12:29 -0400 Received: from paulmck-ThinkPad-P72.home (50-39-105-78.bvtn.or.frontiernet.net [50.39.105.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BE6F32137B; Wed, 24 Jun 2020 20:12:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593029548; bh=qZiGFZJ7CbgHMHQDzAwiU/MwuJbSwOc7xfMxb2POM70=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XRtnN15DHCLVpUxcpepum/t4ehq5kOCp9+gqEP0sZDHsfH4Be6YMnZ+vsiYb8iPTU KOUm2MT0YRADhRVhluZ/fhAw3Uhk8RbrtQsMD8Qh7/0Vdc+Ji6GTK+AWX9b861Cjoi mFk4qYeY8pQG3FL1RRc0IvigdyFHMv7bjY5QfOBo= From: paulmck@kernel.org To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@fb.com, mingo@kernel.org, jiangshanlai@gmail.com, dipankar@in.ibm.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, "Uladzislau Rezki (Sony)" , "Paul E . McKenney" Subject: [PATCH tip/core/rcu 04/17] rcu/tree: Repeat the monitor if any free channel is busy Date: Wed, 24 Jun 2020 13:12:13 -0700 Message-Id: <20200624201226.21197-4-paulmck@kernel.org> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20200624201200.GA28901@paulmck-ThinkPad-P72> References: <20200624201200.GA28901@paulmck-ThinkPad-P72> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "Uladzislau Rezki (Sony)" It is possible that one of the channels cannot be detached because its free channel is busy and previously queued data has not been processed yet. On the other hand, another channel can be successfully detached causing the monitor work to stop. Prevent that by rescheduling the monitor work if there are any channels in the pending state after a detach attempt. Fixes: 34c881745549e ("rcu: Support kfree_bulk() interface in kfree_rcu()") Acked-by: Joel Fernandes (Google) Signed-off-by: Uladzislau Rezki (Sony) Signed-off-by: Paul E. McKenney --- kernel/rcu/tree.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index dbdd509..31d3b2c 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c @@ -3087,7 +3087,7 @@ static void kfree_rcu_work(struct work_struct *work) static inline bool queue_kfree_rcu_work(struct kfree_rcu_cpu *krcp) { struct kfree_rcu_cpu_work *krwp; - bool queued = false; + bool repeat = false; int i; lockdep_assert_held(&krcp->lock); @@ -3125,11 +3125,14 @@ static inline bool queue_kfree_rcu_work(struct kfree_rcu_cpu *krcp) * been detached following each other, one by one. */ queue_rcu_work(system_wq, &krwp->rcu_work); - queued = true; } + + /* Repeat if any "free" corresponding channel is still busy. */ + if (krcp->bhead || krcp->head) + repeat = true; } - return queued; + return !repeat; } static inline void kfree_rcu_drain_unlock(struct kfree_rcu_cpu *krcp, -- 2.9.5