[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Cluster-devel] gfs2: skip dlm_unlock calls in unmount



Hi,

On Thu, 2012-11-08 at 10:41 -0500, David Teigland wrote:
> On Thu, Nov 08, 2012 at 10:26:53AM +0000, Steven Whitehouse wrote:
> > Hi,
> > 
> > On Wed, 2012-11-07 at 14:14 -0500, David Teigland wrote:
> > > When unmounting, gfs2 does a full dlm_unlock operation on every
> > > cached lock.  This can create a very large amount of work and can
> > > take a long time to complete.  However, the vast majority of these
> > > dlm unlock operations are unnecessary because after all the unlocks
> > > are done, gfs2 leaves the dlm lockspace, which automatically clears
> > > the locks of the leaving node, without unlocking each one individually.
> > > So, gfs2 can skip explicit dlm unlocks, and use dlm_release_lockspace to
> > > remove the locks implicitly.  The one exception is when the lock's lvb is
> > > being used.  In this case, dlm_unlock is called because it may update the
> > > lvb of the resource.
> > > 
> > 
> > I'm wondering just how much we are likely to gain from this.... we
> > currently use LVBs for both quota (and more recently) rgrp too. If we
> > were to start using the LVBs for inodes and/or iopen locks eventually
> > then that would seem to rather reduce the benefits of this.
> 
> Considering what you say below, after you've converted to NL, there's no
> more lvb to consider, so the lvb is not an issue in that case. The lvb is
> only written if you're unlocking from PW or EX, so there's bound to always
> be many unlocks that could be skipped.  I'll adjust the patch to skip
> unlock unless there's an lvb and the mode is PW or EX.
> 
Ok

> > The other question is what the cost of conversion to NL vs unlock of an
> > NL lock is. Even with the patch we are still iterating over each lock to
> > do a conversion to NL in any case where the lock is not already in NL.
> > So all we are saving is the final NL -> unlocked change.
> 
> yeah, I'd forgotten about that.
> 
> > One thought is whether it would not be better to do a direct "whatever"
> > -> unlocked change in the first place, rather than splitting the
> > operation into two parts.
> 
> Converting to NL would actually be less expensive than unlock because the
> NL convert does not involve a reply message, but unlock does.
> 
I'm not entirely sure I follow... at least from the filesystem point of
view (and without your proposed change) both conversions and unlocks
result in a reply. Is this a dlm internal reply perhaps?

> So skipping the unlocks is a first step that gives us a big benefit very
> simply.  To benefit even further, we could later look into skipping the
> "convert to NL" step also, and just abandoning the dlm locks in whatever
> mode they're in; but that's probably not as simple a change.
> 

Yes, thats true... the issue is that the glock state machine treats all
glocks on an individual basis, and the demotion to NL also deals with
any writing back and invalidating of the cache thats required at the
same time. So that makes it tricky to separate from the requests to the
dlm.

That said, I'd like to be able to move towards dealing with batches of
glocks in the future, since that means we can provide a more favourable
ordering of i/o requests. That is not an easy thing to do though.

In addition to the benefit for umount, I'm also wondering whether, if
these unlocks are relatively slow, we should look at what happens during
normal operation, where we do from time to time, send unlock requests.
Those are mostly (though indirectly) in response to memory pressure. Is
there anything we can do there to speed things up I wonder?

Steve.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]