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=-4.1 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS 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 3B3CDC433DF for ; Thu, 13 Aug 2020 13:22:07 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id F0FBF2087C for ; Thu, 13 Aug 2020 13:22:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="zX+uBrde"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="4Zz+45My" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F0FBF2087C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linutronix.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 7F5076B0008; Thu, 13 Aug 2020 09:22:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7C8B26B000A; Thu, 13 Aug 2020 09:22:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6DF306B000C; Thu, 13 Aug 2020 09:22:05 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0086.hostedemail.com [216.40.44.86]) by kanga.kvack.org (Postfix) with ESMTP id 598876B0008 for ; Thu, 13 Aug 2020 09:22:05 -0400 (EDT) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 0BE7E181AEF21 for ; Thu, 13 Aug 2020 13:22:05 +0000 (UTC) X-FDA: 77145608610.30.cause90_02153a626ff4 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin30.hostedemail.com (Postfix) with ESMTP id BFB1D180B3C8E for ; Thu, 13 Aug 2020 13:22:04 +0000 (UTC) X-HE-Tag: cause90_02153a626ff4 X-Filterd-Recvd-Size: 5483 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by imf37.hostedemail.com (Postfix) with ESMTP for ; Thu, 13 Aug 2020 13:22:03 +0000 (UTC) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1597324921; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=a75FvpsngyHZBmQ4rj7wRDEgOahPu9fXmXI+cwPoWYo=; b=zX+uBrdeE0IqtapTP6+A90KGBuvFL+Xo+8GijbcJBHy+X/r41FA537fdpvrVCFJNwxXgj+ VUMnQKqYJ6pY6TAVLdotmwasumB7wikZ9ySD91JlbIRg12pahFzoTl3tydG2lr0BGvksLm F7bcsz//Ui0KSbgCpZhDycWNGeCqSTuIpVPKKNRFbVPsyysApVxB2iN0IKtGquggLog1Rk OREFGBcTKKZw7ENYoJBCdWGlavos5C16gaDjFlSH6EPJqfe0niY3GoB/Ac/n/jbtWqwoyg 0tZsuFZfImVZ0vntcuvvSfwT3kOslzIIfIO3fD3vtcg3MT1EcCd7aw68LT92Tw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1597324921; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=a75FvpsngyHZBmQ4rj7wRDEgOahPu9fXmXI+cwPoWYo=; b=4Zz+45Myel25NXIboO0ClR0DuWBpwMC6Es4vQzFsvQuRkLsYuk/VeKyz/p3E06pL8uWl6C bqDZmUlnnCiyvJBw== To: Uladzislau Rezki , Michal Hocko Cc: paulmck@kernel.org, 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 , Peter Zijlstra Subject: Re: [RFC-PATCH 1/2] mm: Add __GFP_NO_LOCKS flag In-Reply-To: <20200813095840.GA25268@pc636> References: <20200811210931.GZ4295@paulmck-ThinkPad-P72> <874kp87mca.fsf@nanos.tec.linutronix.de> <20200813075027.GD9477@dhcp22.suse.cz> <20200813095840.GA25268@pc636> Date: Thu, 13 Aug 2020 15:22:00 +0200 Message-ID: <874kp6llzb.fsf@nanos.tec.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain X-Rspamd-Queue-Id: BFB1D180B3C8E X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam02 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: Uladzislau Rezki writes: > On Thu, Aug 13, 2020 at 09:50:27AM +0200, Michal Hocko wrote: >> On Wed 12-08-20 02:13:25, Thomas Gleixner wrote: >> [...] >> > I can understand your rationale and what you are trying to solve. So, if >> > we can actually have a distinct GFP variant: >> > >> > GFP_I_ABSOLUTELY_HAVE_TO_DO_THAT_AND_I_KNOW_IT_CAN_FAIL_EARLY >> >> Even if we cannot make the zone->lock raw I would prefer to not >> introduce a new gfp flag. Well we can do an alias for easier grepping >> #define GFP_RT_SAFE 0 Just using 0 is sneaky but yes, that's fine :) Bikeshedding: GFP_RT_NOWAIT or such might be more obvious. >> that would imply nowait semantic and would exclude waking up kswapd as >> well. If we can make wake up safe under RT then the alias would reflect >> that without any code changes. It basically requires to convert the wait queue to something else. Is the waitqueue strict single waiter? >> The second, and the more important part, would be to bail out anytime >> the page allocator is to take a lock which is not allowed in the current >> RT context. Something like >> + /* >> + * Hard atomic contexts are not supported by the allocator for >> + * anything but pcp requests >> + */ >> + if (!preemtable()) If you make that preemtible() it might even compile, but that still wont work because if CONFIG_PREEMPT_COUNT=n then preemptible() is always false. So that should be: if (!preemptible() && gfp == GFP_RT_NOWAIT) which is limiting the damage to those callers which hand in GFP_RT_NOWAIT. lockdep will yell at invocations with gfp != GFP_RT_NOWAIT when it hits zone->lock in the wrong context. And we want to know about that so we can look at the caller and figure out how to solve it. >> > The page allocator allocations should also have a limit on the number of >> > pages and eventually also page order (need to stare at the code or let >> > Michal educate me that the order does not matter). >> >> In practice anything but order 0 is out of question because we need >> zone->lock for that currently. Maybe we can introduce pcp lists for >> higher orders in the future - I have a vague recollection Mel was >> playing with that some time ago. Ok. >> > To make it consistent the same GFP_ variant should allow the slab >> > allocator go to the point where the slab cache is exhausted. >> > >> > Having a distinct and clearly defined GFP_ variant is really key to >> > chase down offenders and to make reviewers double check upfront why this >> > is absolutely required. >> >> Having a high level and recognizable gfp mask is OK but I would really >> like not to introduce a dedicated flag. The page allocator should be >> able to recognize the context which cannot be handled. The GFP_xxx == 0 is perfectly fine. > Sorry for jumping in. We can rely on preemptable() for sure, if CONFIG_PREEMPT_RT > is enabled, something like below: > > if (IS_ENABLED_RT && preemptebale()) Ha, you morphed preemtable() into preemptebale() which will not compile either :) Thanks, tglx