From: Brian Foster <bfoster@redhat.com>
To: Dave Chinner <david@fromorbit.com>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH] xfs: refine the allocation stack switch
Date: Wed, 18 Jun 2014 09:29:06 -0400 [thread overview]
Message-ID: <20140618132906.GB57367@bfoster.bfoster> (raw)
In-Reply-To: <1403081741-4596-1-git-send-email-david@fromorbit.com>
On Wed, Jun 18, 2014 at 06:55:41PM +1000, Dave Chinner wrote:
> From: Dave Chinner <dchinner@redhat.com>
>
> The allocation stack switch at xfs_bmapi_allocate() has served it's
> purpose, but is no longer a sufficient solution to the stack usage
> problem we have in the XFS allocation path.
>
...
> Signed-off-by: Dave Chinner <dchinner@redhat.com>
> ---
> fs/xfs/libxfs/xfs_bmap.c | 4 +--
> fs/xfs/libxfs/xfs_btree.c | 84 +++++++++++++++++++++++++++++++++++++++++++++--
> fs/xfs/xfs_bmap_util.c | 53 ------------------------------
> fs/xfs/xfs_bmap_util.h | 2 --
> 4 files changed, 84 insertions(+), 59 deletions(-)
>
...
> diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c
> index 56f050e..43a9744 100644
> --- a/fs/xfs/xfs_bmap_util.c
> +++ b/fs/xfs/xfs_bmap_util.c
> @@ -249,59 +249,6 @@ xfs_bmap_rtalloc(
> }
>
> /*
> - * Stack switching interfaces for allocation
> - */
> -static void
> -xfs_bmapi_allocate_worker(
> - struct work_struct *work)
> -{
> - struct xfs_bmalloca *args = container_of(work,
> - struct xfs_bmalloca, work);
> - unsigned long pflags;
> - unsigned long new_pflags = PF_FSTRANS;
> -
> - /*
> - * we are in a transaction context here, but may also be doing work
> - * in kswapd context, and hence we may need to inherit that state
> - * temporarily to ensure that we don't block waiting for memory reclaim
> - * in any way.
> - */
> - if (args->kswapd)
> - new_pflags |= PF_MEMALLOC | PF_SWAPWRITE | PF_KSWAPD;
> -
> - current_set_flags_nested(&pflags, new_pflags);
> -
> - args->result = __xfs_bmapi_allocate(args);
> - complete(args->done);
> -
> - current_restore_flags_nested(&pflags, new_pflags);
> -}
> -
> -/*
> - * Some allocation requests often come in with little stack to work on. Push
> - * them off to a worker thread so there is lots of stack to use. Otherwise just
> - * call directly to avoid the context switch overhead here.
> - */
> -int
> -xfs_bmapi_allocate(
> - struct xfs_bmalloca *args)
> -{
> - DECLARE_COMPLETION_ONSTACK(done);
> -
> - if (!args->stack_switch)
> - return __xfs_bmapi_allocate(args);
Looks like we can kill args->stack_switch up through the controlling
XFS_BMAPI_STACK_SWITCH flag. The rest of the code looks fine to me,
though I need to do some testing...
Brian
> -
> -
> - args->done = &done;
> - args->kswapd = current_is_kswapd();
> - INIT_WORK_ONSTACK(&args->work, xfs_bmapi_allocate_worker);
> - queue_work(xfs_alloc_wq, &args->work);
> - wait_for_completion(&done);
> - destroy_work_on_stack(&args->work);
> - return args->result;
> -}
> -
> -/*
> * Check if the endoff is outside the last extent. If so the caller will grow
> * the allocation to a stripe unit boundary. All offsets are considered outside
> * the end of file for an empty fork, so 1 is returned in *eof in that case.
> diff --git a/fs/xfs/xfs_bmap_util.h b/fs/xfs/xfs_bmap_util.h
> index 075f722..5f8abb9 100644
> --- a/fs/xfs/xfs_bmap_util.h
> +++ b/fs/xfs/xfs_bmap_util.h
> @@ -66,8 +66,6 @@ struct xfs_bmalloca {
> int xfs_bmap_finish(struct xfs_trans **tp, struct xfs_bmap_free *flist,
> int *committed);
> int xfs_bmap_rtalloc(struct xfs_bmalloca *ap);
> -int xfs_bmapi_allocate(struct xfs_bmalloca *args);
> -int __xfs_bmapi_allocate(struct xfs_bmalloca *args);
> int xfs_bmap_eof(struct xfs_inode *ip, xfs_fileoff_t endoff,
> int whichfork, int *eof);
> int xfs_bmap_count_blocks(struct xfs_trans *tp, struct xfs_inode *ip,
> --
> 2.0.0
>
> _______________________________________________
> xfs mailing list
> xfs@oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
prev parent reply other threads:[~2014-06-18 13:29 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-18 8:55 [PATCH] xfs: refine the allocation stack switch Dave Chinner
2014-06-18 13:29 ` Brian Foster [this message]
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=20140618132906.GB57367@bfoster.bfoster \
--to=bfoster@redhat.com \
--cc=david@fromorbit.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