From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 523BFC433E4 for ; Wed, 15 Jul 2020 22:14:52 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0994F2067D for ; Wed, 15 Jul 2020 22:14:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="dY5oTNj0" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0994F2067D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 8D4716B0002; Wed, 15 Jul 2020 18:14:51 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 85D606B0005; Wed, 15 Jul 2020 18:14:51 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 724E96B0006; Wed, 15 Jul 2020 18:14:51 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0251.hostedemail.com [216.40.44.251]) by kanga.kvack.org (Postfix) with ESMTP id 5CBF06B0002 for ; Wed, 15 Jul 2020 18:14:51 -0400 (EDT) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 1C89E181AC9BF for ; Wed, 15 Jul 2020 22:14:51 +0000 (UTC) X-FDA: 77041715982.22.shock01_4908c3726efd Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin22.hostedemail.com (Postfix) with ESMTP id E390D18038E60 for ; Wed, 15 Jul 2020 22:14:50 +0000 (UTC) X-HE-Tag: shock01_4908c3726efd X-Filterd-Recvd-Size: 3450 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf08.hostedemail.com (Postfix) with ESMTP for ; Wed, 15 Jul 2020 22:14:50 +0000 (UTC) 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) X-Rspamd-Queue-Id: E390D18038E60 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam04 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000151, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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