Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp779943ybh; Wed, 15 Jul 2020 15:18:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxDDb/bGz0DfcAW3C6Zzc4OsbjO1e6e5Gl70o/01n7lI/S2OmfHrAKkKNaLobEubApHIKeR X-Received: by 2002:a17:906:2c18:: with SMTP id e24mr1045156ejh.335.1594851507158; Wed, 15 Jul 2020 15:18:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594851507; cv=none; d=google.com; s=arc-20160816; b=TBD+XiMIbgnrwUv6+mVLkUUd/aTYz14kRzscyvBRdDGdoJZ8TgBl3f77tNWyGO7Hd+ zBa1mp5Guehz96Rr8GiYpH0m2I5Hi2m/tO9p5OBYCHD7IbwEM/dlh7BfbUHo9BmWUsIE Rm8Bz089C/fSfvbO/Zjs16KR3cNLStNTtYbAzSK7A0Te1yCOfwOC2eXLxDycoBwxLdkz K6NKXifPVfuj7OKTAJv60RcYQq2tjSbalWI13ZAdry3DDPgaISXqnPV7MblGGD8K0hyX ikW2JdhcLumYy9v5uz17pCcTY0mklTVvD+n4IDVwrpcEK0lAUxaj5OZsgYhELh0V/aaO i34Q== 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:reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=Hgmb9JDFaPTii4DGBLTuBRwhCJkY48t9DjoHfAUWXqE=; b=YbXVLV4PYrxbfC3DDKKko3GwMnt9H1DqUXvuxc3BTCHwCBrv7yU/9/N0PM5CTmrUzd Y8Qll0tt2nRkv1V5A0YiLgkxWbqY5qhkyyMn0z40n1Q4Ue8y9Hj+efn1tbQysSi9zEKS ldS2N88+VCjtZsrwtgnDIICHlzNGyQlbFtYP6YenDmKMhWXE/Ycupcsbul+w7jE3QJ+n P3OYHeYOqxSXRRSmn9vaMJICPIi0t4q27B0VgxCZodHjJcY62AfJAlyRQAchBudxYqvI vMMHT9R47YVAqaLVRo9mAPwJhN4Teoj+DJaNli81VS3oE49DKtbklvduCS1vo8o/CKH+ wwJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=dY5oTNj0; 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 df15si1893842edb.366.2020.07.15.15.18.04; Wed, 15 Jul 2020 15:18:27 -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=dY5oTNj0; 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 S1727990AbgGOWOw (ORCPT + 99 others); Wed, 15 Jul 2020 18:14:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:35668 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727971AbgGOWOu (ORCPT ); Wed, 15 Jul 2020 18:14:50 -0400 Received: from paulmck-ThinkPad-P72.home (50-39-111-31.bvtn.or.frontiernet.net [50.39.111.31]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 83FE72065F; Wed, 15 Jul 2020 22:14:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1594851289; bh=CUZJ25Szi3C99xPXb1iXVJJARRC12tD/b1ygd9NAdUQ=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=dY5oTNj0X17RH9aW4Nv23OmusgZCXcHgxD5lbUTTasH6D9BhuT9n1DJHeiAYIRmBM d9gOnEiKmvaiv2isIrQaDOsJuu8TQfOp6SH/VjECxcfwo1q5M/BOkYeAAKYjqyAc4N iVwx8IHOXCPCMqCeZWrr6V/ytkn+pk8b5GCQ+584= Received: by paulmck-ThinkPad-P72.home (Postfix, from userid 1000) id 65E8935229F4; Wed, 15 Jul 2020 15:14:49 -0700 (PDT) Date: Wed, 15 Jul 2020 15:14:49 -0700 From: "Paul E. McKenney" To: Sebastian Andrzej Siewior Cc: Uladzislau Rezki , LKML , RCU , linux-mm@kvack.org, Andrew Morton , "Theodore Y . Ts'o" , Matthew Wilcox , Joel Fernandes , Oleksiy Avramchenko Subject: Re: [PATCH 1/1] rcu/tree: Drop the lock before entering to page allocator Message-ID: <20200715221449.GJ9247@paulmck-ThinkPad-P72> Reply-To: paulmck@kernel.org References: <20200715183537.4010-1-urezki@gmail.com> <20200715185628.7b4k3o5efp4gnbla@linutronix.de> <20200715190243.GA26735@pc636> <20200715193250.axntj7jdt6bw52dr@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200715193250.axntj7jdt6bw52dr@linutronix.de> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 15, 2020 at 09:32:50PM +0200, Sebastian Andrzej Siewior wrote: > On 2020-07-15 21:02:43 [+0200], Uladzislau Rezki wrote: > > > > > > spin_lock(); > > __get_free_page(GFP_NOWAIT | __GFP_NOWARN); > > spin_unlock(); > > > > > > Also, please note we do it for regular kernel. > > ach right okay then. > > > > > > > What happened to the part where I asked for a spinlock_t? > > > > > What do you mean? > > Please drop that raw_spinlock_t for the kfree_rcu() based locking and > use just a plain spinlock_t for the locking. Then you can keep the same > code flow for RT and !RT without any special cases and everything. My concern is that some critical bug will show up at some point that requires double-argument kfree_rcu() be invoked while holding a raw spinlock. (Single-argument kfree_rcu() must sometimes invoke synchronize_rcu(), so it can never be invoked in any state forbidding invoking schedule().) Yes, dropping to a plain spinlock would be simple in the here and now, but experience indicates that it is only a matter of time, and that when that time comes it will come as an emergency. One approach would be to replace the "IS_ENABLED(CONFIG_PREEMPT_RT)" with some sort of check for being in a context where spinlock acquisition is not legal. What could be done along those lines? Thanx, Paul