Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp1436428pxb; Fri, 20 Nov 2020 09:23:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJw/HV4WylLShdtA0ZOmimmwkD6fQFo87v1T8I2q1PhIjyda5ITGBm/yXNAqhz4DVpQAW3/a X-Received: by 2002:a17:906:c0c1:: with SMTP id bn1mr32953927ejb.454.1605893027095; Fri, 20 Nov 2020 09:23:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605893027; cv=none; d=google.com; s=arc-20160816; b=aBACwbddu3YEfQ6oVl3T2fbwgmoJqzM6z6A5039z3uRZqRD8TlPkXzayG9PsbI+RpG 5iYkJvxBHM9oMdP//p4+c6fhSK9BEuQp5yTf7RNt/q/hD1v8GPJsD7ciyCjAfj3sT7yp B+ZdKgKSF8MgYAMBcfQ2sDtUJiOuf95dtSJjhnxEnLG3kntFjRESf1XgXATwJewDYDJh tD0Ksb3BP1zHIAzApeueuscsDuD4QuJnDYSMkxqwE2QAM4CFtPmmoLX/U9PWlHkDJ1wL 5kvoUiQt4xe4/VqCUsiVlFPLXx6eHoCFA5VjCPCx4mZBSsO/zM5UEex1e6qinVjT9VN2 qkMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=S891HRVAXLMue2eb3ZaWv9TMDAthb1khr5PCwoXDFR4=; b=rEYnh6hXoPa6pw2WNvHHfP3mq0K96uCKgBtCl/YfeSmPEXx8SsanwGi1clahGfuZ4h PmZeKp0XxprZDyhK3eE279cBByBFVDj9pGrT3sqjxI5fIB9/0f9+JJdRA8EvpL0CLc9p McFr6xonrYGjUJ8FzpE+5ufs5YGAMVrfUO7cIMdtPEK956Qot5kws4jCB8NeTu7NPkkh R5OFgR+0LYhuAo5xA8XblbMEsTeD7kexRu+hMJeHZfGwe9NiTPqbExKu1yorPfb9lKIw fiWdwfnq61Mr8B3fOcSMaBgU2T8k5+UuprZRTA87pUxwnp5lFCsZTgjmsazoSxLS9Meg aeVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=j66PMMpv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c19si2007544ejz.274.2020.11.20.09.23.24; Fri, 20 Nov 2020 09:23:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=j66PMMpv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727961AbgKTRUe (ORCPT + 99 others); Fri, 20 Nov 2020 12:20:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727345AbgKTRUe (ORCPT ); Fri, 20 Nov 2020 12:20:34 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0BB4DC0613CF; Fri, 20 Nov 2020 09:20:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:MIME-Version:Date:Message-ID:From:References:Cc:To:Subject:Sender :Reply-To:Content-ID:Content-Description; bh=S891HRVAXLMue2eb3ZaWv9TMDAthb1khr5PCwoXDFR4=; b=j66PMMpvppK+9LOqAod/s1ja5m NVR3CJQ5wNAq2SNU16LOU8GllPMP3dWrlW0vWIkua0Q20gtch6gF283d57uK3CBa5mTngXGmftXl9 EoWhyx1dajSPLcrCy+az1qOxvLY8u/ryxMHXbLQY4wRWf6tfAyS5dJi34STTYLFpGVEVFckV6idcX 8A2ryyyeBQPvBlZuB3VZ25y1x3p3+fuI2rkDBjo2pRYLKAAe2ynNubYwTSeWn1a4EEhMMWl8UeGO+ kKNrUMokjBiTf6Q9XupujrSzp+9OEjo+AQ1SZhNy8Gpw+6odKCdO8aO/7liRmMFfqiVNjewZRd/+x igbQutPg==; Received: from [2601:1c0:6280:3f0::bcc4] by casper.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1kgA4p-0001xJ-Sm; Fri, 20 Nov 2020 17:20:04 +0000 Subject: Re: [PATCH 2/3] mm: Extract might_alloc() debug check To: Daniel Vetter , DRI Development Cc: 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 , Dave Chinner , Qian Cai , "Matthew Wilcox (Oracle)" , Daniel Vetter References: <20201120095445.1195585-1-daniel.vetter@ffwll.ch> <20201120095445.1195585-3-daniel.vetter@ffwll.ch> From: Randy Dunlap Message-ID: Date: Fri, 20 Nov 2020 09:19:56 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: <20201120095445.1195585-3-daniel.vetter@ffwll.ch> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 11/20/20 1:54 AM, Daniel Vetter wrote: > diff --git a/include/linux/sched/mm.h b/include/linux/sched/mm.h > index d5ece7a9a403..f94405d43fd1 100644 > --- a/include/linux/sched/mm.h > +++ 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 Mark > + * @gfp_mask: gfp_t flags that would be use to allocate used > + * > + * Similar to might_sleep() and other annotations this can be used in functions annotations, > + * that might allocate, but often dont. Compiles to nothing without don't. > + * CONFIG_LOCKDEP. Includes a conditional might_sleep() if @gfp allows blocking. ? might_sleep_if() if > + */ > +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)); > +} -- ~Randy