From: Jason Gunthorpe <jgg@ziepe.ca>
To: DRI Development <dri-devel@lists.freedesktop.org>,
Intel Graphics Development <intel-gfx@lists.freedesktop.org>,
linux-mm@kvack.org, linux-xfs@vger.kernel.org,
linux-fsdevel@vger.kernel.org,
LKML <linux-kernel@vger.kernel.org>,
Vlastimil Babka <vbabka@suse.cz>,
"Paul E . McKenney" <paulmck@kernel.org>,
Christoph Lameter <cl@linux.com>,
Pekka Enberg <penberg@kernel.org>,
David Rientjes <rientjes@google.com>,
Joonsoo Kim <iamjoonsoo.kim@lge.com>,
Andrew Morton <akpm@linux-foundation.org>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@kernel.org>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
Michel Lespinasse <walken@google.com>,
Waiman Long <longman@redhat.com>,
Thomas Gleixner <tglx@linutronix.de>,
Randy Dunlap <rdunlap@infradead.org>,
Dave Chinner <david@fromorbit.com>, Qian Cai <cai@lca.pw>,
"Matthew Wilcox (Oracle)" <willy@infradead.org>,
Daniel Vetter <daniel.vetter@intel.com>
Subject: Re: [PATCH 2/3] mm: Extract might_alloc() debug check
Date: Tue, 24 Nov 2020 11:27:39 -0400 [thread overview]
Message-ID: <20201124152739.GF5487@ziepe.ca> (raw)
In-Reply-To: <20201124143411.GN401619@phenom.ffwll.local>
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 <jgg@nvidia.com>
> >
> > 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
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2020-11-25 8:12 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-20 9:54 [PATCH 0/3] mmu_notifier fs fs_reclaim lockdep annotations Daniel Vetter
2020-11-20 9:54 ` [PATCH 1/3] mm: Track mmu notifiers in fs_reclaim_acquire/release Daniel Vetter
2020-11-20 18:23 ` Jason Gunthorpe
2020-11-20 9:54 ` [PATCH 2/3] mm: Extract might_alloc() debug check Daniel Vetter
2020-11-20 17:19 ` Randy Dunlap
2020-11-20 17:31 ` Daniel Vetter
2020-11-20 18:07 ` Jason Gunthorpe
2020-11-24 14:34 ` Daniel Vetter
2020-11-24 15:27 ` Jason Gunthorpe [this message]
2020-11-20 9:54 ` [PATCH 3/3] locking/selftests: Add testcases for fs_reclaim Daniel Vetter
2020-11-20 12:31 ` Peter Zijlstra
2020-11-20 9:54 ` [PATCH] drm/ttm: don't set page->mapping Daniel Vetter
2020-11-20 10:04 ` Christian König
2020-11-20 10:05 ` Daniel Vetter
2020-11-20 10:08 ` Christian König
2020-11-20 15:01 ` Daniel Vetter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201124152739.GF5487@ziepe.ca \
--to=jgg@ziepe.ca \
--cc=akpm@linux-foundation.org \
--cc=bigeasy@linutronix.de \
--cc=cai@lca.pw \
--cc=cl@linux.com \
--cc=daniel.vetter@intel.com \
--cc=david@fromorbit.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=iamjoonsoo.kim@lge.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-xfs@vger.kernel.org \
--cc=longman@redhat.com \
--cc=mathieu.desnoyers@efficios.com \
--cc=mingo@kernel.org \
--cc=paulmck@kernel.org \
--cc=penberg@kernel.org \
--cc=peterz@infradead.org \
--cc=rdunlap@infradead.org \
--cc=rientjes@google.com \
--cc=tglx@linutronix.de \
--cc=vbabka@suse.cz \
--cc=walken@google.com \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).