Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp865681ybt; Wed, 24 Jun 2020 13:14:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyOa8FtTczUCEWy2ly6u7tLcUnyujM2yfYll19Cr/C9HqeGM14vIOtz7nSnmukv9RtvQaXJ X-Received: by 2002:a17:906:68ca:: with SMTP id y10mr25987493ejr.322.1593029641538; Wed, 24 Jun 2020 13:14:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593029641; cv=none; d=google.com; s=arc-20160816; b=jR4TUaGJEEz/zC5j/PMUYZvZFD8NebH/eeo8hvGxEfSMIZj7FdLvDurI1HqCFBVS8f Rz3Rluuk8T84PYuj4RIDs1s87g2p0Q4hF7HwbmJ3BG3S1IlxCcOmXdt4eUlkbzBDim2f qzaB8XLODx4qpApv+gWaxxuNE5Q/AcSHK3TVhKsZeinx+/eGeR9SQ1qR5wk4wpH8iEjd DT/zASURU2BMRkqxSZT9dg9QYXc9kO1Zylth0c9zqy3W0hB2MHHRe4rdRelqiz7nFZgn tD5nPdyo9W1HBlxBJLhIsNYdva+sV9M8Sscs++ZlO9Bw3c1UV4ZIKQnHBUoEWP5W5ZCs A0EA== 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=jlIgzLUEMlB5d1UjpAt9RMxIybuljBEfXjEiw9UUV5A=; b=JulJBSUHLXOonDWVy1ReCWdB16QDPlnqFF27PTx0f7GUJ7vp9I4Og9nnqEtmcjnTm2 xk/oYpVPMk08cZ9BYVNkvbQpB8kGHliw3aGdFRy/rHFNJ7dDplHfMuX9M+zg+jw8x9k9 6ERS1SVyVrzyL3FM2FXn18xhmHk8zKjcZlvVyxoFDLGrZQ4gMXYOVAInZQh5H9ym/9Hl IEgl3x+vAmeKF0HE1eussf8hU+yWz01zMx+XCQOkhseyPsNyRl1cA7LEbXVGvQn6NxYY 6xD1a34Zl+E3EnquDFTcig+M+dJ1HG+aUDxUedVgwyUPqUsI2BTEw77su2HQhbWJ6mq9 nQmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="J9HkoC7/"; 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 s9si6580923edw.82.2020.06.24.13.13.38; Wed, 24 Jun 2020 13:14:01 -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="J9HkoC7/"; 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 S2406397AbgFXUMb (ORCPT + 99 others); Wed, 24 Jun 2020 16:12:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:52436 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406370AbgFXUM3 (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 8474120CC7; 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=+Ml9K6OhgREHxq/Lrb5RMnmhVEQ5vipDFbL6KJkj7LI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J9HkoC7/4m/5Ft1DtFJyQAd73lsyyBDWOnfij9dL2kAcc9hJnZ/z8MI7H5K/yMlkN YXGVAUPtfLFTXDeynOwalw9ybOhiPp1MgL9LT3uHXKot7mPoELzxAFW3LrQGq9d4FU BUxiRsR4MzT+PBZ/ZpGp7JEMYzpiIFNJEU7VYgDA= 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, Sebastian Andrzej Siewior , Uladzislau Rezki , "Paul E . McKenney" Subject: [PATCH tip/core/rcu 03/17] rcu/tree: Skip entry into the page allocator for PREEMPT_RT Date: Wed, 24 Jun 2020 13:12:12 -0700 Message-Id: <20200624201226.21197-3-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: "Joel Fernandes (Google)" To keep the kfree_rcu() code working in purely atomic sections on RT, such as non-threaded IRQ handlers and raw spinlock sections, avoid calling into the page allocator which uses sleeping locks on RT. In fact, even if the caller is preemptible, the kfree_rcu() code is not, as the krcp->lock is a raw spinlock. Calling into the page allocator is optional and avoiding it should be Ok, especially with the page pre-allocation support in future patches. Such pre-allocation would further avoid the a need for a dynamically allocated page in the first place. Cc: Sebastian Andrzej Siewior Reviewed-by: Uladzislau Rezki Co-developed-by: Uladzislau Rezki Signed-off-by: Uladzislau Rezki Signed-off-by: Joel Fernandes (Google) Signed-off-by: Uladzislau Rezki (Sony) Signed-off-by: Paul E. McKenney --- kernel/rcu/tree.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index 64592b4..dbdd509 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c @@ -3184,6 +3184,18 @@ kfree_call_rcu_add_ptr_to_bulk(struct kfree_rcu_cpu *krcp, if (!bnode) { WARN_ON_ONCE(sizeof(struct kfree_rcu_bulk_data) > PAGE_SIZE); + /* + * To keep this path working on raw non-preemptible + * sections, prevent the optional entry into the + * allocator as it uses sleeping locks. In fact, even + * if the caller of kfree_rcu() is preemptible, this + * path still is not, as krcp->lock is a raw spinlock. + * With additional page pre-allocation in the works, + * hitting this return is going to be much less likely. + */ + if (IS_ENABLED(CONFIG_PREEMPT_RT)) + return false; + bnode = (struct kfree_rcu_bulk_data *) __get_free_page(GFP_NOWAIT | __GFP_NOWARN); } -- 2.9.5