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.0 required=3.0 tests=BAYES_00, 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 A2F87C433E1 for ; Thu, 13 Aug 2020 13:33:18 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6E2EF2078D for ; Thu, 13 Aug 2020 13:33:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6E2EF2078D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id ECBF48D0006; Thu, 13 Aug 2020 09:33:17 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E54D48D0002; Thu, 13 Aug 2020 09:33:17 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D1B4D8D0006; Thu, 13 Aug 2020 09:33:17 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0084.hostedemail.com [216.40.44.84]) by kanga.kvack.org (Postfix) with ESMTP id B98D18D0002 for ; Thu, 13 Aug 2020 09:33:17 -0400 (EDT) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 71BD78248047 for ; Thu, 13 Aug 2020 13:33:17 +0000 (UTC) X-FDA: 77145636834.15.sand53_4400fb526ff4 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin15.hostedemail.com (Postfix) with ESMTP id 3B8A11814AC9B for ; Thu, 13 Aug 2020 13:33:11 +0000 (UTC) X-HE-Tag: sand53_4400fb526ff4 X-Filterd-Recvd-Size: 3818 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf14.hostedemail.com (Postfix) with ESMTP for ; Thu, 13 Aug 2020 13:33:10 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id C000EAC48; Thu, 13 Aug 2020 13:33:31 +0000 (UTC) Date: Thu, 13 Aug 2020 15:33:08 +0200 From: Michal Hocko To: Thomas Gleixner Cc: Uladzislau Rezki , paulmck@kernel.org, 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 Message-ID: <20200813133308.GK9477@dhcp22.suse.cz> References: <20200811210931.GZ4295@paulmck-ThinkPad-P72> <874kp87mca.fsf@nanos.tec.linutronix.de> <20200813075027.GD9477@dhcp22.suse.cz> <20200813095840.GA25268@pc636> <874kp6llzb.fsf@nanos.tec.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <874kp6llzb.fsf@nanos.tec.linutronix.de> X-Rspamd-Queue-Id: 3B8A11814AC9B X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam03 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 Thu 13-08-20 15:22:00, Thomas Gleixner wrote: > 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. Sounds goood. > >> 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? I would have to double check. From what I remember only kswapd should ever sleep on it. > >> 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. It would be nice to hide all that behind a helper and guarded by PREEMPT_RT. That would imply PREEMPT_COUNT automatically, right? > > 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. Yes, that would have to somehow need to annotate the zone_lock to be ok in those paths so that lockdep doesn't complain. -- Michal Hocko SUSE Labs