public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Mark Tinguely <tinguely@sgi.com>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH 0/3] xfs: allocation worker causes freelist buffer lock
Date: Tue, 2 Oct 2012 09:10:27 +1000	[thread overview]
Message-ID: <20121001231027.GI23520@dastard> (raw)
In-Reply-To: <20121001221028.766035076@sgi.com>

On Mon, Oct 01, 2012 at 05:10:23PM -0500, Mark Tinguely wrote:
>  v2 remove the architecture conditional.

Version stuff goes after the first --- line where the diffstat lies.
It doesn't belong inteh commit messages.

> The AGF hang is caused when the process that holds the AGF buffer
> lock cannot get a worker. The allocation worker pool are blocked
> waiting to take the AGF buffer lock.
> 
> Move the allocation worker call so that multiple calls to
> xfs_alloc_vextent() for a particular transaction are contained
> within a single worker.
> 			---
> With the xfs_alloc_arg structure zeroed, the AGF hang occurs in 
> xfs_bmap_btalloc() due to a secondary call to xfs_alloc_vextent().

How, exactly? You need to describe the exact hang so that everyone
understands what the problem is that is being fixed. This doesn't
tell me what the hang is that is being fixed. Document it in a call
timeline that shows when the locks are taken, and where they
subsequently hang....

> These calls to xfs_alloc_vextent() try different strategies to
> allocate the extent if the previous allocation attempt failed.

I suspect you are talking about this code chain:

        if ((error = xfs_alloc_vextent(&args)))
                return error;
        if (tryagain && args.fsbno == NULLFSBLOCK) {
.....
                if ((error = xfs_alloc_vextent(&args)))
                        return error;
        }
        if (isaligned && args.fsbno == NULLFSBLOCK) {
.....
                if ((error = xfs_alloc_vextent(&args)))
                        return error;
        }
.....

but I can't be certain from the description...

> I still prefer this patch's approach. It also limits the number
> worker context switches when xfs_alloc_ventent() is called multiple
> times within a transaction. The intent of the patch is to move the
> allocation worker as reasonably close to the xfs_trans_alloc() -
> xfs_trans_commit / xfs_trans_cancel() calls as possible.

Except, as I've said before, it also adds context switches to
unwritten extent conversion that already occurs in a worker thread
that has no stack pressure (i.e. adds unnecessary latency via
context switches to IO completion), and it also pushes all realtime
device allocation into a worker thread. Once again, that will add
unpredictable latency to the allocation path (bad for realtime) when
no stack pressure actually exists.

These were particular concerns for placing the stack switch in
xfs_alloc_vextent() in the first place - to only switch stacks when
allocation was going to occur for allocations that are likely to
smash the stack.  xfs_bmapi_write() is too high level to avoid
this problem in xfs_bmap_btalloc() with minimum impact because it
also captures operations that don't pass through the typical worst
case stack path or don't have stack pressure.

If we need to avoid the above problem in xfs_bmap_btalloc() for user
data allocation, then move the worker hand-off up one function from
xfs_alloc_vextent() to xfs_bmap_btalloc() - it's a precise fit for
the problem that (I think) has been described above. It's also a
simpler patch because it doesn't need to create a new worker args
structure - just add the completion to the struct xfs_bmalloca ....

> I have ported this patch to Linux 3.0.x. Linux 2.6.x will be the same
> as the Linux 3.0 port.

Not really relevant to a TOT commit, especially as the underlying
patch isn't in 3.0.x or 2.6.x. Indeed, if you want to back port it
and this fix to anything prior to 2.6.38, then you are going to need
the EAGAIN version I posted because the workqueue infrastructure is
vastly different and blocking workers on locks is guaranteed to have
serious performance impact, even if it doesn't deadlock.

> This patch allows an easy addition of an architecture limit on the
> allocation worker for those that choose to do so.

Not relevant. It's no different to the xfs_alloc_vextent
worker code that it replaces.

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

  reply	other threads:[~2012-10-01 23:09 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-19 16:31 [PATCH 0/3] xfs: allocation worker causes freelist buffer lock hang tinguely
2012-09-19 16:31 ` [PATCH 1/3] xfs: restrict allocate worker to x86_64 tinguely
2012-09-19 21:54   ` Dave Chinner
2012-09-20 17:37     ` Mark Tinguely
2012-09-24 17:37       ` Ben Myers
2012-09-25  0:14         ` Dave Chinner
2012-09-19 16:31 ` [PATCH 2/3] xfs: move allocate worker tinguely
2012-09-19 16:31 ` [PATCH 3/3] xfs: zero allocation_args on the kernel stack tinguely
2012-09-19 23:41   ` Dave Chinner
2012-09-20 18:16   ` [PATCH 3/3 v2] " Mark Tinguely
2012-09-25 20:20     ` Ben Myers
2012-10-18 22:52     ` Ben Myers
2012-09-19 23:34 ` [PATCH 0/3] xfs: allocation worker causes freelist buffer lock hang Dave Chinner
2012-09-20 13:49   ` Mark Tinguely
2012-09-24 13:25   ` Dave Chinner
2012-09-24 17:11 ` Ben Myers
2012-09-24 18:09   ` Mark Tinguely
2012-09-25  0:56     ` Dave Chinner
2012-09-25 15:14       ` Mark Tinguely
2012-09-25 22:01         ` Dave Chinner
2012-09-26 14:14           ` Mark Tinguely
2012-09-26 23:41             ` Dave Chinner
2012-09-27 20:10               ` Mark Tinguely
2012-09-28  3:08         ` Dave Chinner
2012-10-01 22:10           ` [PATCH 0/3] xfs: allocation worker causes freelist buffer lock Mark Tinguely
2012-10-01 23:10             ` Dave Chinner [this message]
2012-09-27 22:48     ` [PATCH 0/3] xfs: allocation worker causes freelist buffer lock hang Ben Myers
2012-09-27 23:17       ` Mark Tinguely
2012-09-27 23:27         ` Mark Tinguely

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=20121001231027.GI23520@dastard \
    --to=david@fromorbit.com \
    --cc=tinguely@sgi.com \
    --cc=xfs@oss.sgi.com \
    /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