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 6AEEBC433E1 for ; Sat, 15 Aug 2020 13:03:08 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 20CDE23121 for ; Sat, 15 Aug 2020 13:03:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="eNWPl1w+" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 20CDE23121 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 805CD6B0002; Sat, 15 Aug 2020 09:03:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7B43D6B0005; Sat, 15 Aug 2020 09:03:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6A3676B0006; Sat, 15 Aug 2020 09:03:07 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0032.hostedemail.com [216.40.44.32]) by kanga.kvack.org (Postfix) with ESMTP id 5228A6B0002 for ; Sat, 15 Aug 2020 09:03:07 -0400 (EDT) Received: from smtpin05.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 17C888245571 for ; Sat, 15 Aug 2020 13:03:07 +0000 (UTC) X-FDA: 77152818414.05.self83_070dc4127005 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin05.hostedemail.com (Postfix) with ESMTP id D26891801709C for ; Sat, 15 Aug 2020 13:03:06 +0000 (UTC) X-HE-Tag: self83_070dc4127005 X-Filterd-Recvd-Size: 3608 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf29.hostedemail.com (Postfix) with ESMTP for ; Sat, 15 Aug 2020 13:03:06 +0000 (UTC) Received: from paulmck-ThinkPad-P72.home (unknown [50.45.173.55]) (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 6409D23120; Sat, 15 Aug 2020 13:03:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597496585; bh=TCd3RnIh+m/AFQpcO3QO6DTwGhG5pB3KRXQioDsmqOI=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=eNWPl1w+a9I0vCW47TFX0zI7f8aUPQdkPp8EYt2FoKGvxt8ILV1tkOX9mIethOQvz CdKhN50oWLVwJisuvGGPuZuRb1o9BDW27haWLVSYVCwMYcAMmf8Fs4Zuvw47fB+etZ SVRB2QprPHpSNIdOxDDHtQobDH0H+fiMzl1NxB2k= Received: by paulmck-ThinkPad-P72.home (Postfix, from userid 1000) id 42C7635226F6; Sat, 15 Aug 2020 06:03:05 -0700 (PDT) Date: Sat, 15 Aug 2020 06:03:05 -0700 From: "Paul E. McKenney" To: Peter Zijlstra Cc: Thomas Gleixner , Michal Hocko , Uladzislau Rezki , LKML , RCU , linux-mm@kvack.org, Andrew Morton , Vlastimil Babka , Matthew Wilcox , "Theodore Y . Ts'o" , Joel Fernandes , Sebastian Andrzej Siewior , Oleksiy Avramchenko Subject: Re: [RFC-PATCH 1/2] mm: Add __GFP_NO_LOCKS flag Message-ID: <20200815130305.GY4295@paulmck-ThinkPad-P72> Reply-To: paulmck@kernel.org References: <20200814180141.GP4295@paulmck-ThinkPad-P72> <87tux4kefm.fsf@nanos.tec.linutronix.de> <20200815082754.GM3982@worktop.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200815082754.GM3982@worktop.programming.kicks-ass.net> User-Agent: Mutt/1.9.4 (2018-02-28) X-Rspamd-Queue-Id: D26891801709C X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam05 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Sat, Aug 15, 2020 at 10:27:54AM +0200, Peter Zijlstra wrote: > On Sat, Aug 15, 2020 at 01:14:53AM +0200, Thomas Gleixner wrote: > > > > As a matter of fact I assume^Wdeclare that removing struct rcu_head which > > provides a fallback is not an option at all. I know that you want to, > > but it wont work ever. Dream on, but as we agreed on recently there is > > this thing called reality which ruins everything. > > It never was going to work, freeing memory can never hard rely on the > success of allocating memory. In neither case does the freeing of memory rely hard-rely on the success of allocating memory. This is because there is a fallback in both cases should allocation fail. Given an rcu_head structure, we use that, and accept the extra cache misses at callback-invocation time. Otherwise, without an rcu_head structure, the allocation parameters are carefully chosen to avoid indefinite sleeping, meaning that the allocation attempt either succeeds or fails within a reasonable amount of time. And upon failure we invoke synchronize_rcu(), then immediately free. Which is slow, but then again life is like that under OOM conditions. And yes, this means that the price of leaving the rcu_head structure out of the structure to be freed is that you must call kvfree_free() from a sleepable context. If you don't like being restricted to sleepable context, you can always supply the rcu_head structure. Thanx, Paul