xfs
[Top] [All Lists]

Re: Xfs lockdep warning with for-dave-for-4.6 branch

To: Michal Hocko <mhocko@xxxxxxxxxx>
Subject: Re: Xfs lockdep warning with for-dave-for-4.6 branch
From: Dave Chinner <david@xxxxxxxxxxxxx>
Date: Fri, 3 Jun 2016 09:22:54 +1000
Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>, "Darrick J. Wong" <darrick.wong@xxxxxxxxxx>, Qu Wenruo <quwenruo@xxxxxxxxxxxxxx>, xfs@xxxxxxxxxxx, linux-mm@xxxxxxxxx, Ingo Molnar <mingo@xxxxxxxxxx>
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <20160602154619.GU1995@xxxxxxxxxxxxxx>
References: <20160516231056.GE18496@dastard> <20160517144912.GZ3193@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> <20160517223549.GV26977@dastard> <20160519081146.GS3193@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> <20160520001714.GC26977@dastard> <20160601131758.GO26601@xxxxxxxxxxxxxx> <20160601181617.GV3190@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> <20160602145048.GS1995@xxxxxxxxxxxxxx> <20160602151116.GD3190@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> <20160602154619.GU1995@xxxxxxxxxxxxxx>
User-agent: Mutt/1.5.21 (2010-09-15)
On Thu, Jun 02, 2016 at 05:46:19PM +0200, Michal Hocko wrote:
> On Thu 02-06-16 17:11:16, Peter Zijlstra wrote:
> > With scope I mostly meant the fact that you have two calls that you need
> > to pair up. That's not really nice as you can 'annotate' a _lot_ of code
> > in between. I prefer the narrower annotations where you annotate a
> > single specific site.
> 
> Yes, I can see you point. What I meant to say is that we would most
> probably end up with the following pattern
>       lockdep_trace_alloc_enable()
>       some_foo_with_alloc(gfp_mask);
>       lockdep_trace_alloc_disable()
>
> and some_foo_with_alloc might be a lot of code.

That's the problem I see with this - the only way to make it
maintainable is to precede each enable/disable() pair with a comment
explaining *exactly* what those calls are protecting.  And that, in
itself, becomes a maintenance problem, because then code several
layers deep has no idea what context it is being called from and we
are likely to disable warnings in contexts where we probably
shouldn't be.

I think such an annotation approach really requires per-alloc site
annotation, the reason for it should be more obvious from the
context. e.g. any function that does memory alloc and takes an
optional transaction context needs annotation. Hence, from an XFS
perspective, I think it makes more sense to add a new KM_ flag to
indicate this call site requirement, then jump through whatever
lockdep hoop is required within the kmem_* allocation wrappers.
e.g, we can ignore the new KM_* flag if we are in a transaction
context and so the flag is only activated in the situations were
we currently enforce an external GFP_NOFS context from the call
site.....

Cheers,

Dave.
-- 
Dave Chinner
david@xxxxxxxxxxxxx

<Prev in Thread] Current Thread [Next in Thread>