Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp644086ybz; Wed, 22 Apr 2020 05:22:43 -0700 (PDT) X-Google-Smtp-Source: APiQypKl5FLjVA/8b7phcSP34gZx4VHX6QdTlDrCBv3IWvN6cPhqN1UEj7tcnr9PqJoL0l6N0z6K X-Received: by 2002:aa7:c5cf:: with SMTP id h15mr23479022eds.213.1587558163097; Wed, 22 Apr 2020 05:22:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587558163; cv=none; d=google.com; s=arc-20160816; b=KDn6/dS0bq+mHU4WHlaMoUFUwYqZR9ESjr4Nt7TsiCbdpo/fJKRK1Zq5o5WZdMHRNk FWduiQSmNF87r6fA3c4HX2FN5jzFNvrlTRMymHe1kA2d4iUf+r0I88xAY3yz34tquGLX mbn/yFQNF27MQUya+CWD/o/T9aa3Xk9oLu0mwnQc6oFZmmyCHKd/PGeb+HSrU4U2ia1I qZA8LneLb251OYjamJ/9JSNvkClJczx8Rr2rFAzSQypQN7hJuvXlu9mhUWrXk4NJhyLk i1Gd05E/sWfay8v8z8vOJ2mF0l+Sv1+ZTfaDCE5HcDcojWqrt6ZzbW5VtSFVH2phxSdf 9PiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:date:from:dkim-signature; bh=EcjcBCMisxSrvOIyXUn8t/Z2HQERoHgRrxwf6c0lYoA=; b=qDyhV08V5luzLI49P+BMWyVR3BGo5UseZHdiikGPRFIxkvPkeFo91cDk0UEsBh0oCh Z5pJ6P3dQ3W/gS9a8h14JB4Oi9xIz1mwHKqQdcotS+ZIGm4wemO0Qh+IooljKdpftDY1 YoxglhQ4l6r3XRmliaij4cwXJ9Y2nOnXMcMRml7Gab6gkDpQQX/q1Zkcq/8zcO3RuDxe 9VGTQ7SKNlIz7c+Py0vwkAM2cEZlW6+mKiXhv3wIodIz/J7kgdmSswIoR32WPmXr1C9r asqnEMDr1iD9TYvsn3VR0Tp1LBlmGq4XQ30QsZuoHkp5xqJ8xQ/S/uQAu8CVd3hw1juQ bQhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Pl9SzVv1; 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 cm6si3325821edb.71.2020.04.22.05.22.19; Wed, 22 Apr 2020 05:22:43 -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=Pl9SzVv1; 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 S1730340AbgDVKfw (ORCPT + 99 others); Wed, 22 Apr 2020 06:35:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37472 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731107AbgDVKfs (ORCPT ); Wed, 22 Apr 2020 06:35:48 -0400 Received: from mail-lj1-x243.google.com (mail-lj1-x243.google.com [IPv6:2a00:1450:4864:20::243]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DCE9AC03C1A8; Wed, 22 Apr 2020 03:35:47 -0700 (PDT) Received: by mail-lj1-x243.google.com with SMTP id e25so1711997ljg.5; Wed, 22 Apr 2020 03:35:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=EcjcBCMisxSrvOIyXUn8t/Z2HQERoHgRrxwf6c0lYoA=; b=Pl9SzVv1JQtR3HbMFszvij+VHWA9WVSyFHTToSyD+LB//HCJRy260B2Wp2RQzrxuTw 9NPqH/cRptXKxFTZrKvJgy9cUbISAuo9jW3F6V8Pz8ajARd9xizsEvReCxiWYR4N2fec H/orW+bSltcvbneXsFJw28PjL72pvwS6FzVtED8bAdnQ8x2Uu7lQeW/5Ds9FGU4970YS zU/CWpkpKjjWg1jgvqUduNmS6CAxCUkU5i41f40SgnlXW440KxIW28nuqs8zCHxODru+ uGBhVRT9FKsLDSj5TIkQI+D4PTqk6BBEDv9sBcrY03uNLW+NwqfJQmbOB1guC+Z8vGPX kjSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=EcjcBCMisxSrvOIyXUn8t/Z2HQERoHgRrxwf6c0lYoA=; b=CxXpS/6q463N03nACgt2yl2z/9DlHDy3dNNnZmomDS0EnA7vlLdp3/rSbQyNs2l8WM c3iVQlD3fjelzWLaG/zovkV0YuyBwcm+vzgtVxbR58kvPEFrf/oE6hFXb0M2ws8RnFxL PezyrCM/znK1vGw04/oM8+VParRmKHjYBm+OB6CZXF2Stxq2MQl806bvrDk3bAFcmZAp 83h8JneKDc8YHUdhWe6ugYdThqAkzsyxC7msnsqc7FJrtAnuOY4y0ldIQoL3xSvrSjok N8jtdGjbYjQZmO9gSpMMFI1Se79faccxLInrsFVEzN4eZq5SxjOaPiKyphVBRI/54aJ/ aqmg== X-Gm-Message-State: AGi0Pua5K8ZTbYWFbywZb49kxe8v+EyNg8YUkmXDUre2MJ9sqzZOPOXd DZp+yaQibTJzd/BEtGx8CYo= X-Received: by 2002:a2e:a586:: with SMTP id m6mr14589992ljp.32.1587551746322; Wed, 22 Apr 2020 03:35:46 -0700 (PDT) Received: from pc636 (h5ef52e31.seluork.dyn.perspektivbredband.net. [94.245.46.49]) by smtp.gmail.com with ESMTPSA id v8sm4248533lfp.85.2020.04.22.03.35.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Apr 2020 03:35:45 -0700 (PDT) From: Uladzislau Rezki X-Google-Original-From: Uladzislau Rezki Date: Wed, 22 Apr 2020 12:35:36 +0200 To: "Joel Fernandes (Google)" Cc: linux-kernel@vger.kernel.org, Sebastian Andrzej Siewior , Uladzislau Rezki , Josh Triplett , Lai Jiangshan , Mathieu Desnoyers , "Paul E. McKenney" , rcu@vger.kernel.org, Steven Rostedt Subject: Re: [PATCH rcu/dev -fixes 2/4] rcu/tree: Skip entry into the page allocator for PREEMPT_RT Message-ID: <20200422103536.GA16263@pc636> References: <20200420153837.194532-1-joel@joelfernandes.org> <20200420153837.194532-3-joel@joelfernandes.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200420153837.194532-3-joel@joelfernandes.org> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. > 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 > Co-developed-by: Uladzislau Rezki > Signed-off-by: Uladzislau Rezki > Signed-off-by: Joel Fernandes (Google) > --- > kernel/rcu/tree.c | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c > index cf68d3d9f5b81..cd61649e1b001 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); > } This will not be correctly working by just reverting everything to the "rcu_head path" for CONFIG_PREEMPT_RT kernel. We need to preallocate at least once. I can add caching on top of this series to address it. -- Vlad Rezki