Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp4577789ybz; Tue, 28 Apr 2020 14:03:52 -0700 (PDT) X-Google-Smtp-Source: APiQypKjkXNHb6+SwnNoHlVnSQFYDxUkuADqLifXZGIm9eD+/ysNCRWHW38CcuNF/Ac1XxOMCxaW X-Received: by 2002:a17:907:4365:: with SMTP id nd5mr24900702ejb.231.1588107832365; Tue, 28 Apr 2020 14:03:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588107832; cv=none; d=google.com; s=arc-20160816; b=c2XE27eAZoYcDfc87KGuMWse/7Ft0o8Jc1/ngs/y5dmyL2cB0OTjMql56iJwmVmGDm ht1glg+fibbBFc6BeWET3LL9WTaAi0jmevRPg1O79a1+2XDziDdo866b2MLxEvTWLnMy 3AGlXVoK04BjXyDi6QlEmfPzcxD8f77Mrq9zbY1kE6KOuvxhTFYW3Snbv2hEqtHxDnWp plxXJuQ+AQe106gTv9knYPyQiN9VyVvk3HOYw5EoPAV2wdKDpbaYJmuuVZR8gFzkRT4k cet6HEv6Bx8nJKFHLVwVg4VU7csnP6ogkcmlSAOAsV55HwopRtyze/ccmOfHGYkD7QD6 HshQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=VbhSWD62l8JNzTfQeyAoSUlyMJCSOqg1BrQPjTRkMk4=; b=xVPJ1FtXPbmbxXAHLMfi/gm9YvMPP08sz4HLUsCV6OZ3/H9/zpqTyiCLvPmpUmpXRd hEt+Lr/EMUAI6nfzXt0Cey8t4/RL0uAogJjkcX/arGacCLNkPF99kVhqhK9lhV39Z2ZP jmuJ0N3vSrjZ/hH5mjiP+znwT4ncAurT2aM3X8otQE8PUh63df40dkoeYX/v5auO6ffe ebeNwVk1jtwCpdTbr/rywFC+g67RWYb3rfidOKZJA5z9QcDZrxlcDbxWX1Y/kAcj7ToF iIqt+Hd2LCrfPhnksSGfpo7YSuf+XeqpN4j00o00+Ml1WTAOUzNPqaU5VBoGHDl1tO6K 8pvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=lUSGgt+C; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e1si2818165ejl.173.2020.04.28.14.03.29; Tue, 28 Apr 2020 14:03:52 -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=@gmail.com header.s=20161025 header.b=lUSGgt+C; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726775AbgD1U7e (ORCPT + 99 others); Tue, 28 Apr 2020 16:59:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726764AbgD1U7c (ORCPT ); Tue, 28 Apr 2020 16:59:32 -0400 Received: from mail-lj1-x241.google.com (mail-lj1-x241.google.com [IPv6:2a00:1450:4864:20::241]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 576C5C03C1AC; Tue, 28 Apr 2020 13:59:32 -0700 (PDT) Received: by mail-lj1-x241.google.com with SMTP id e25so238403ljg.5; Tue, 28 Apr 2020 13:59:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=VbhSWD62l8JNzTfQeyAoSUlyMJCSOqg1BrQPjTRkMk4=; b=lUSGgt+CcioWbfGLfJs6ugC+Qsrh1jSAzKgYq+RqTEJ21PFv8tQASSylCGa3PsVbnY Qbu76q5eTVYVtQnCst4OOtW3BlwytMXJWb+FeiUODQpsMPCiLZgDtu394oLx3qGFh7ro CUV0dDmlU2XxAMYHQI4Iaz5+oMKXtr10rhPCmkBZRvY5UTTkNFQPY9dtPCQASLAKSgpw k79dHaNBrymsYKNqoM41Bh4gmnO22eY5dnHBGtSZ2n8G2cPbYpP+IP3MuBpoa2Vbj82P SRpq3tfsb9HM1/p3VUJqqfJs4WInmGwQPVyQhTibtyUcbpA1vCW1XkZURvjniAH8QJSV JoEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=VbhSWD62l8JNzTfQeyAoSUlyMJCSOqg1BrQPjTRkMk4=; b=FF7luBItHwJ9WCFio7q/pdd963cYwotKbOh56CGAlavzvSnUmQ6ZAxfJt/MTrzeE3s rMUZ/gG3pbyMMCeR25rbP0P8RxYuQTameJubdrQ3IU2Gfh0NMW5J+ga6oGtTANkUzif4 EMJ9YzusEUVSpMh0lkaA4HLi5SiQmqojgmxV7GfbjRrGZFo+BFyf2fcK4Q8L7PY2KrJK KI4mH5xAGTVqt/AzyJB83DnWz8Efp9iVoyKvAbAb9fh5y1HOFRvQ34EmcfTlL2OEm2dC emUHGZNthnxnqr+SWXR10NRwn7V/7EjRIyDJc4c4wsykewWkLMwTjUSsNsT2N8O9ope+ 15iA== X-Gm-Message-State: AGi0Publ9NWQv6HsEJ1f2rg1yK8KFkU8ZHa8YSN6RDfzHHSVE89a3fAz NUOcexUzdBEeyjmXn1q2P/HBTSoXyRkuNg== X-Received: by 2002:a05:651c:28c:: with SMTP id b12mr18386730ljo.167.1588107570458; Tue, 28 Apr 2020 13:59:30 -0700 (PDT) Received: from pc638.lan (h5ef52e31.seluork.dyn.perspektivbredband.net. [94.245.46.49]) by smtp.gmail.com with ESMTPSA id z21sm295483ljh.42.2020.04.28.13.59.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Apr 2020 13:59:26 -0700 (PDT) From: "Uladzislau Rezki (Sony)" To: LKML , linux-mm@kvack.org Cc: Andrew Morton , "Paul E . McKenney" , "Theodore Y . Ts'o" , Matthew Wilcox , Joel Fernandes , RCU , Uladzislau Rezki , Oleksiy Avramchenko , Sebastian Andrzej Siewior Subject: [PATCH 02/24] rcu/tree: Skip entry into the page allocator for PREEMPT_RT Date: Tue, 28 Apr 2020 22:58:41 +0200 Message-Id: <20200428205903.61704-3-urezki@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200428205903.61704-1-urezki@gmail.com> References: <20200428205903.61704-1-urezki@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 kfree_rcu() 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 as done in previous patches. With additional page pre-allocation in the works, hitting this return is going to be much less likely soon so just prevent it for now so that PREEMPT_RT does not break. Note that page allocation here is an optimization and skipping it still makes kfree_rcu() work. 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) --- kernel/rcu/tree.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index cf68d3d9f5b8..cd61649e1b00 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c @@ -3092,6 +3092,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.20.1