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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable 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 DD900C63798 for ; Tue, 24 Nov 2020 15:27:45 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 388BE20738 for ; Tue, 24 Nov 2020 15:27:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="JFbStEBI" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 388BE20738 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 697CC6B007B; Tue, 24 Nov 2020 10:27:44 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 649236B007E; Tue, 24 Nov 2020 10:27:44 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4E9576B0081; Tue, 24 Nov 2020 10:27:44 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 3541E6B007B for ; Tue, 24 Nov 2020 10:27:44 -0500 (EST) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 04AB98249980 for ; Tue, 24 Nov 2020 15:27:44 +0000 (UTC) X-FDA: 77519691648.10.taste73_42159af2736f Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin10.hostedemail.com (Postfix) with ESMTP id D52E016A4B1 for ; Tue, 24 Nov 2020 15:27:43 +0000 (UTC) X-HE-Tag: taste73_42159af2736f X-Filterd-Recvd-Size: 5732 Received: from mail-qk1-f193.google.com (mail-qk1-f193.google.com [209.85.222.193]) by imf15.hostedemail.com (Postfix) with ESMTP for ; Tue, 24 Nov 2020 15:27:43 +0000 (UTC) Received: by mail-qk1-f193.google.com with SMTP id q5so20718366qkc.12 for ; Tue, 24 Nov 2020 07:27:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=T1CJlj8IfSUUHiH+kqtPsU00jQAk/4cxU5HTLWgky3g=; b=JFbStEBIKWinwRehV0dG/qoEhAWyKvWiQAcUNmzhgCFsSOHXJxkNEFj0egRb0/3Sgg q8KlbvBm+SZWA8+kLS4QAKx1VMbVvr9WwqryXOZ+nR5L7jF7I75raMadKItlGdyFsXV4 MAXLlg4J8SGJkJn/ndQd+F10zISr9GtcWt18YmMODwZOvgxHvEGGMFMb6q7Mcm+Our5Z cA7l+b63IFHl9JGoL794bcoTHGTctqQrHW9IfKnfgdMLNCdJzkdZSjFqFgZqy0gdO73i CG3TfNm0Q2N/eDAytp9pIzHdFBlHhU6va67BpY6PFvFMeeVBU9lbourS+JouXuxSIthE vQIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=T1CJlj8IfSUUHiH+kqtPsU00jQAk/4cxU5HTLWgky3g=; b=hRWunsppO6VRkxSKRSrx3Jc9DHcldCPoO9pXbvmV6fvBwxUjdiQFk80+ILmJBfJuou uNbZ7o76XgWsOp5uqcO8KUQNofAiD/d0D66yx8f6RLZrGlLuISTSeuswq1nUuxgNBfsh Ui5WXf/P6NOExL+PUkc7w4x5KhOF1BbFro+uNwAQ14J4sx2WBRRSd9+/94KmA3WMK+/r 33xFOq5JDildVhfXtYWXmS0LtCJDB+vmA0a4DRLb22A5J3jmPsncPt/cGL2HjvT2vMoo Hq9HAJxP6ZVLzjOev/RQ7qfg7yxcYHuebRKaj7ZpshSsxQQgBudGjH3POfs/JNUJ+JCU YKXA== X-Gm-Message-State: AOAM5334kWytAss2r7RvtrK2hqwQluPosXKHty9gCUk5i9+6NcBiQ/Cz VxZBHbtN+0YiDQRaInpiL6UJFA== X-Google-Smtp-Source: ABdhPJwWUvdVx1Vqxqge3kQRlk8iWNcGxBL9lgm9oszusQZMiFgHGeM23mQSdnOTIDE/+Anp4R5TCw== X-Received: by 2002:a05:620a:404d:: with SMTP id i13mr758647qko.279.1606231662613; Tue, 24 Nov 2020 07:27:42 -0800 (PST) Received: from ziepe.ca (hlfxns017vw-156-34-48-30.dhcp-dynamic.fibreop.ns.bellaliant.net. [156.34.48.30]) by smtp.gmail.com with ESMTPSA id y23sm13290051qkb.26.2020.11.24.07.27.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Nov 2020 07:27:40 -0800 (PST) Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1khaEF-000ogj-SX; Tue, 24 Nov 2020 11:27:39 -0400 Date: Tue, 24 Nov 2020 11:27:39 -0400 From: Jason Gunthorpe To: DRI Development , Intel Graphics Development , linux-mm@kvack.org, linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, LKML , Vlastimil Babka , "Paul E . McKenney" , Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Peter Zijlstra , Ingo Molnar , Mathieu Desnoyers , Sebastian Andrzej Siewior , Michel Lespinasse , Waiman Long , Thomas Gleixner , Randy Dunlap , Dave Chinner , Qian Cai , "Matthew Wilcox (Oracle)" , Daniel Vetter Subject: Re: [PATCH 2/3] mm: Extract might_alloc() debug check Message-ID: <20201124152739.GF5487@ziepe.ca> References: <20201120095445.1195585-1-daniel.vetter@ffwll.ch> <20201120095445.1195585-3-daniel.vetter@ffwll.ch> <20201120180719.GO244516@ziepe.ca> <20201124143411.GN401619@phenom.ffwll.local> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201124143411.GN401619@phenom.ffwll.local> 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 Tue, Nov 24, 2020 at 03:34:11PM +0100, Daniel Vetter wrote: > On Fri, Nov 20, 2020 at 02:07:19PM -0400, Jason Gunthorpe wrote: > > On Fri, Nov 20, 2020 at 10:54:43AM +0100, Daniel Vetter wrote: > > > diff --git a/include/linux/sched/mm.h b/include/linux/sched/mm.h > > > index d5ece7a9a403..f94405d43fd1 100644 > > > +++ b/include/linux/sched/mm.h > > > @@ -180,6 +180,22 @@ static inline void fs_reclaim_acquire(gfp_t gfp_mask) { } > > > static inline void fs_reclaim_release(gfp_t gfp_mask) { } > > > #endif > > > > > > +/** > > > + * might_alloc - Marks possible allocation sites > > > + * @gfp_mask: gfp_t flags that would be use to allocate > > > + * > > > + * Similar to might_sleep() and other annotations this can be used in functions > > > + * that might allocate, but often dont. Compiles to nothing without > > > + * CONFIG_LOCKDEP. Includes a conditional might_sleep() if @gfp allows blocking. > > > + */ > > > +static inline void might_alloc(gfp_t gfp_mask) > > > +{ > > > + fs_reclaim_acquire(gfp_mask); > > > + fs_reclaim_release(gfp_mask); > > > + > > > + might_sleep_if(gfpflags_allow_blocking(gfp_mask)); > > > +} > > > > Reviewed-by: Jason Gunthorpe > > > > Oh, I just had a another thread with Matt about xarray, this would be > > perfect to add before xas_nomem(): > > Yeah I think there's plenty of places where this will be useful. Want to > slap a sob onto this diff so I can include it for the next round, or will > you or Matt send this out when my might_alloc has landed? When this is merged I can do this - just wanted to point out the API is good and useful Jason