Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp1443529pxb; Fri, 20 Nov 2020 09:33:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJzs2yAfXgVjUOaebouij8S4STWPJkxme0l3tl0MQXV8HS/SF11i7yfbRt7fpPdeZg4ywdh8 X-Received: by 2002:a17:906:3413:: with SMTP id c19mr32797008ejb.421.1605893637580; Fri, 20 Nov 2020 09:33:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605893637; cv=none; d=google.com; s=arc-20160816; b=H55dtcqgSM0GJPyAGGbF21LbtOvV27jomyoiDmp5QWhGORGmK/2tI/7fVMVVepgGfF luCocIcEbSN2rUgVJDW8SEf381S5QzAwoZHYPrdW7g3RWiowa2V4K1UjQBiAyb6bqnm6 jB1RVl4QEf7s7H51lItKMiD1hE9Y0rjxGeUnCmSxzLKldAQv1lSH8UHBnOUFLUwiveQ4 Ly0Hc36TILwDlpdbLU58VM1n5JqVMXdjQXXtiIzp45UbmAP5CI0jxjDP8YQEDDWNqW5H jCfG+ncBVYDOCTQWzIL66capCfTHCoVU/evmiwifJr8uWHY1RK0BzKE1nQ9JcW6AdRn6 R0GA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=8e4wI0bZkx7vL4ZNjNtbjWVMpWuuSKoV5XC8ZjlhW7s=; b=M/AAn2Qq8w81GubpOZ1ok0sxkwgb5lTjeiywSXFWd+6Aq5Xp+42EWOLvwNs1idLtY2 wI0HDCqYtkEZLK9QH6efwNFjWaxsNQNTioyVqeU1FiYQcLkiOBeKbj+HPbHOrWjh83DT b/NqGUlRz7xfR4HNGpt6lsxPHNavrW/nZqJta20oRkKCAXQt0DCmyBlSdAofLMtj5ms6 uleQ46mAF9jptpFjpBd6NGL6L2rKCNveYLy863Iq1JvHO+Vm9nQLfHha/XnKkqZ7f55s 6+YLnmhI/K7P2/8HyncECBkpfKjXIxADmCSdeU4hlloTl5WakOMJ/qi9aTqOG6Jir7e+ cilg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=HccBEp+o; 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 bu8si2380313edb.542.2020.11.20.09.33.34; Fri, 20 Nov 2020 09:33:57 -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=@ffwll.ch header.s=google header.b=HccBEp+o; 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 S1728727AbgKTRbx (ORCPT + 99 others); Fri, 20 Nov 2020 12:31:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60430 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728597AbgKTRbx (ORCPT ); Fri, 20 Nov 2020 12:31:53 -0500 Received: from mail-oi1-x243.google.com (mail-oi1-x243.google.com [IPv6:2607:f8b0:4864:20::243]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D5BAC0613CF for ; Fri, 20 Nov 2020 09:31:53 -0800 (PST) Received: by mail-oi1-x243.google.com with SMTP id t143so11262552oif.10 for ; Fri, 20 Nov 2020 09:31:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=8e4wI0bZkx7vL4ZNjNtbjWVMpWuuSKoV5XC8ZjlhW7s=; b=HccBEp+o8ETH4Up44ZRai+3YCDp9ZccG/73PRJf6l8P+2CSniNIKgzDRc27ybuIOvR IIsOfywoVBFSGx1Qv7sDxfm4sSmrQlSiigm0wYSweoIK2JSHh+CJnJrDkOciZn38yhj0 aSga/Z7C/8a9/MwtRVQ0bNGZZBwYGOLWIM6AA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=8e4wI0bZkx7vL4ZNjNtbjWVMpWuuSKoV5XC8ZjlhW7s=; b=rjY9lLviPKM/bLSFCyPtSbwQiQ1O/8UWt/Fg27XEgx+6LNe43ujae2kh2uB+7KtpoU cF7B/dBYuDrWIDBURb3M09a0GunGn5zSrwUiigazuLmQY4mvUsdgrVJwQ+0wLPB3tV83 pRXdv90BQ9KVoS8MD/TfygcEO4DhwYxiFmPWRy4sJ60OeCKzgd5plgfDry748s2Td+lc ZxlfTDWKrC53RwWw6cJh5C4GOF/etOEEjM7Hi0kGqCvKe+cbsmxrt533PqcCx6M59azg ff+YeCw+ID6vEdsT1OtCCBqzefuwWRWvwmAHO3ut4Xh8h4crdhj3d9NC+VTa1MeynPAD 4m0w== X-Gm-Message-State: AOAM533tkzr1K1EfqEe0TqEI6ir7RhFhC90Kjqd5uQ2QPkuBQ3ipAYkV +PmxlyxnTM5SJpQrX48dK9SqkiA0qMWr8HlFk3aA0A== X-Received: by 2002:aca:1713:: with SMTP id j19mr6618133oii.101.1605893512499; Fri, 20 Nov 2020 09:31:52 -0800 (PST) MIME-Version: 1.0 References: <20201120095445.1195585-1-daniel.vetter@ffwll.ch> <20201120095445.1195585-3-daniel.vetter@ffwll.ch> In-Reply-To: From: Daniel Vetter Date: Fri, 20 Nov 2020 18:31:41 +0100 Message-ID: Subject: Re: [PATCH 2/3] mm: Extract might_alloc() debug check To: Randy Dunlap Cc: DRI Development , Intel Graphics Development , Linux MM , 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 Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Nov 20, 2020 at 6:20 PM Randy Dunlap wrote: > > 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 That's one if too many, I'll do the others for next round. Thanks for taking a look. -Daniel > > > + */ > > +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 > -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch