Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp765656ybz; Wed, 22 Apr 2020 07:37:35 -0700 (PDT) X-Google-Smtp-Source: APiQypLXiHHRxuKe2kaZrR6Plsr/C8DXpR395DB6wR0VZ3XNeIg57LRoPsaLZushpYKojUp0g/2V X-Received: by 2002:a17:906:2410:: with SMTP id z16mr26576143eja.1.1587566255307; Wed, 22 Apr 2020 07:37:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587566255; cv=none; d=google.com; s=arc-20160816; b=PSx7/SbkcBjkXKCsDtBndza+TKKqhLGC4jihBX2xKjmXZvsWpYxgDyEIj72UMbUcPf E+5BMvmqqD0hgwgAiOrcHQzjn6MtKpXdIhwJ4haOFCoetFp95HqQ/EEQ/kzM/+HwXYrY L3t56iKYZPQGPUlwoU0w6qVaiszuh6rWjnPP4rPqOXKWl2ADbo4y4CKDSaQeYgbZuhGk tZqTOmyqRDsFFbjp9rve69cTE0lShmHwM7qN54e/PLEzf6JaNZTcMb/KlxSEER7IZD71 yqpVqVN+/+uMnhaorpGnqJSG3/XCDI3yeKg5u8KUKmJ7LkrvgR29spUUFO7zvpt6Ym6m eijQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:from:cc:to:subject :content-transfer-encoding:mime-version:references:in-reply-to :user-agent:date:dkim-signature; bh=uchh9xZf9elSlIgf8Xxf4XgRxCWvLtd9mt90C/GbGKg=; b=FaO/3fZZcnmBx4ZH60r8BoG+Ka+qQoEeXDcT1/7yJv8Txbh5QV/KxPatgD0+Pay03U HA5TCBI2oG445bSDP/r5yOfh8v/Au9dyIrpV1CycNR5xSkJFZaTBWhkx82LneLDCXJ07 6KmcjHLjheLlLXK41JKMpcxrek9neMNjAADK281ix6BpJndv9yCYKJRL2D0e6NMCR2SK 6GHzsxJ+6Na7JZy1chPtVn7pCQoRbdKLhuPUJ3LGBC7I5IYv6pXsZhnAnHXdFyzf6Gr1 KgptDD+a/4wiFvSwJlAFEh3iuWs3tqj6UEDhCkAJAe9PaPWhj//18II/hU1Op8QKp6x9 T2QQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@joelfernandes.org header.s=google header.b=ql2EIoNR; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u2si3966120ejr.370.2020.04.22.07.37.09; Wed, 22 Apr 2020 07:37:35 -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=fail header.i=@joelfernandes.org header.s=google header.b=ql2EIoNR; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726200AbgDVNSq (ORCPT + 99 others); Wed, 22 Apr 2020 09:18:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725968AbgDVNSq (ORCPT ); Wed, 22 Apr 2020 09:18:46 -0400 Received: from mail-qk1-x743.google.com (mail-qk1-x743.google.com [IPv6:2607:f8b0:4864:20::743]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E7E7AC03C1AA for ; Wed, 22 Apr 2020 06:18:44 -0700 (PDT) Received: by mail-qk1-x743.google.com with SMTP id l78so2252833qke.7 for ; Wed, 22 Apr 2020 06:18:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=date:user-agent:in-reply-to:references:mime-version :content-transfer-encoding:subject:to:cc:from:message-id; bh=uchh9xZf9elSlIgf8Xxf4XgRxCWvLtd9mt90C/GbGKg=; b=ql2EIoNR+wWfIzQqBbJJMFPRgg1I0z70qU2JcyGqtAgtrsN3U0iw4FYi6X2pU7se/K RAyLat+RwH++zLGUGmwvJK130fMtCjZPMzM6bnPHR09d1U6W0QLEg2TqYoRH8n5ci73a i/zlJs2qlo5eEHz9bcOsasJBkqIoRxjTYi+Nw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:user-agent:in-reply-to:references :mime-version:content-transfer-encoding:subject:to:cc:from :message-id; bh=uchh9xZf9elSlIgf8Xxf4XgRxCWvLtd9mt90C/GbGKg=; b=eyMR8hAaVSYmAA3yUtSPGseo4OQ7zgcEPtlILIaEGljElCjtf7PXaZF2ssTo50EsSo EO/17HubEEF4zQ53KqGHfLVGW5aDIaatRr0h4o8OYaQwmHLzhjw+Xh+K9KEvg9N+q7Eo 6UOzbZ0QtZ8K6kn35XPwzqvLwPD7CXymeYFsvj+dB8bXt6HhL1CzUjO5msPyaOvJDocm gq7BnRw1tRHB0AubEInpX0l7VHJcdObHC8Zt61XTSQ5KdV8hiOqvQLJUOykA0TibxsG7 b/8PYfX4CQgKCNhsanEOxUWdWExiydY4IA32rTh+45hQGi00sd/M1V5pAd2+TTgfxv/+ uQ+Q== X-Gm-Message-State: AGi0PuYrJqkTGD0GwS2QCKy5hdATw3QOr2dwKGHJU+n/uWB3L04q5OAJ oMmU9yMo+p48OmoMZx/CggrMww== X-Received: by 2002:a05:620a:2013:: with SMTP id c19mr26427324qka.162.1587561523779; Wed, 22 Apr 2020 06:18:43 -0700 (PDT) Received: from [192.168.1.17] (c-71-62-121-229.hsd1.va.comcast.net. [71.62.121.229]) by smtp.gmail.com with ESMTPSA id p202sm3773299qke.120.2020.04.22.06.18.43 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 22 Apr 2020 06:18:43 -0700 (PDT) Date: Wed, 22 Apr 2020 09:18:41 -0400 User-Agent: K-9 Mail for Android In-Reply-To: <20200422103536.GA16263@pc636> References: <20200420153837.194532-1-joel@joelfernandes.org> <20200420153837.194532-3-joel@joelfernandes.org> <20200422103536.GA16263@pc636> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PATCH rcu/dev -fixes 2/4] rcu/tree: Skip entry into the page allocator for PREEMPT_RT To: Uladzislau Rezki CC: linux-kernel@vger.kernel.org, Sebastian Andrzej Siewior , Josh Triplett , Lai Jiangshan , Mathieu Desnoyers , "Paul E. McKenney" , rcu@vger.kernel.org, Steven Rostedt From: joel@joelfernandes.org Message-ID: <51A69C78-FDD4-4A15-8969-EEA17CBA5BBD@joelfernandes.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On April 22, 2020 6:35:36 AM EDT, Uladzislau Rezki wr= ote: >On Mon, Apr 20, 2020 at 11:38:35AM -0400, Joel Fernandes (Google) >wrote: >> To keep kfree_rcu() path working on raw non-preemptible sections, >> prevent the optional entry into the allocator as it uses sleeping >locks=2E >> 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=2E 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=2E Note that page allocation here is >an >> optimization and skipping it still makes kfree_rcu() work=2E >>=20 >> Cc: Sebastian Andrzej Siewior >> Co-developed-by: Uladzislau Rezki >> Signed-off-by: Uladzislau Rezki >> Signed-off-by: Joel Fernandes (Google) >> --- >> kernel/rcu/tree=2Ec | 12 ++++++++++++ >> 1 file changed, 12 insertions(+) >>=20 >> diff --git a/kernel/rcu/tree=2Ec b/kernel/rcu/tree=2Ec >> index cf68d3d9f5b81=2E=2Ecd61649e1b001 100644 >> --- a/kernel/rcu/tree=2Ec >> +++ b/kernel/rcu/tree=2Ec >> @@ -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); >> =20 >> + /* >> + * To keep this path working on raw non-preemptible >> + * sections, prevent the optional entry into the >> + * allocator as it uses sleeping locks=2E In fact, even >> + * if the caller of kfree_rcu() is preemptible, this >> + * path still is not, as krcp->lock is a raw spinlock=2E >> + * With additional page pre-allocation in the works, >> + * hitting this return is going to be much less likely=2E >> + */ >> + if (IS_ENABLED(CONFIG_PREEMPT_RT)) >> + return false; >> + >> bnode =3D (struct kfree_rcu_bulk_data *) >> __get_free_page(GFP_NOWAIT | __GFP_NOWARN); >> } >This will not be correctly working by just reverting everything to the >"rcu_head path" for CONFIG_PREEMPT_RT kernel=2E We need to preallocate at >least once=2E I can add caching on top of this series to address it=2E > I discussed with Vlad offline, this patch is fine for mainline as we don't= have headless support yet=2E So this patch is good=2E Future patches addin= g caching will also add the headless support after additional caching, so s= kipping the allocation here is ok=2E Thanks=2E - Joel >-- >Vlad Rezki --=20 Sent from my Android device with K-9 Mail=2E Please excuse my brevity=2E