All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Alex Elder <aelder@sgi.com>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH] xfs: force background CIL push under sustained load
Date: Fri, 24 Sep 2010 11:18:55 +1000	[thread overview]
Message-ID: <20100924011855.GR2614@dastard> (raw)
In-Reply-To: <1285268035.1973.109.camel@doink>

On Thu, Sep 23, 2010 at 01:53:55PM -0500, Alex Elder wrote:
> On Thu, 2010-09-23 at 12:27 +1000, Dave Chinner wrote:
> > + * than half the log" rule that recovery requires us to keep.
> > + *
> > + * Further, we need to make sure the background CIL push is efficient, which
> > + * means we need to give the background push a chance to commit without
> > + * blocking all the current transaction commits. Hence we need some space
> > + * between the threshold and the 25% limit to allow background pushes to be
> > + * tried, but not enforced. To make this simple and fast to calculate, set
> > + * the background push threshold to 1/8th (12.5%) the size of the log, and then start
> > + * enforcing the background push at 50% above this. i.e. at 3/16th or 18.75% of
> > + * the log size. This should keep us well under the limits of the AIL pushing
> > + * threshold, yet give us plenty of space for aggregation on large logs.
> >   */
> 
> I think the above explanation is pretty good but I don't know that it's
> as clear or concise as it could be.  I don't claim this is better but
> I'll take a shot (I don't like offering criticism without suggesting
> an alternative).
> 
>  * With dynamic reservations, we can basically make up arbitrary
>  * limits for the checkpoint size so long as they don't violate any
>  * other size rules.  Recovery imposes a rule that no transaction
>  * exceed half the log, so we are limited by that.  Furthermore, the
>  * log transaction reservation subsystem tries to keep 25% of the
>  * log free, so we should keep below that limit or we risk not being
>  * able to get the space we need.
>  *
>  * In order to keep background CIL push efficient, we will set a
>  * lower threshold at which background pushing is attempted without
>  * blocking current transaction commits.  A separate, higher bound
>  * defines when CIL pushes are forced in order to ensure we stay
>  * within our transaction size limits.

Yes, makes sense. I'll rework it along these lines.

> > -
> > -#define XLOG_CIL_SPACE_LIMIT(log)	\
> > -	(min((log->l_logsize >> 2), (8 * 1024 * 1024)))
> > +#define XLOG_CIL_SPACE_LIMIT(log)	(log->l_logsize >> 3)
> > +#define XLOG_CIL_HARD_SPACE_LIMIT(log)	(3 * (log->l_logsize >> 4))
> 
> Maybe "LIMIT" isn't quite the right name for these two.
> (But I have no better suggestion.)

Threshold is really the only other word that matches, but I think
limit is better here as it conveys a sense that it is something we
don't really want to cross...

> I don't really care much about this, but I'll take this
> opportunity for a small rant.
> 
> The difference in calculation cost/speed between "x >> 3" and
> "x / 8" is vanishingly small.

That is architecture dependent, but in most cases these days the
compiler will optimise a divide-by-power-of−2-constant into a shift
operation anyway. I'm pretty sure that optimisation is done on even
on x86 as a shift is a single cycle operation while an integer
divide still takes several cycles and consumes more power.

> I think it is meaningful to use
> a shift in places where a power-of-two is mandated, but in places
> like this it suggests there is a constraint that simply doesn't
> exist.  So for example, you could have chosen (log->logsize / 10)
> as the "try pushing" value, and (log->logsize / 4 - 1) as the
> "must push" value.

It's more the fact that XFS uses power-of-2 logic (i.e shifts)
everywhere. I just tend to be consistent with what is already there.
In this case, the AIL push thresholds are calculated using shifts:

	free_threshold = MAX(free_threshold, (log->l_logBBsize >> 2));

and so when you compare that to the XLOG_CIL_SPACE_LIMIT()
definitions, it is immediately clear that the CIL limits are smaller
than the AIL push threshold...

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

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

  reply	other threads:[~2010-09-24  1:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-23  2:27 [PATCH] xfs: force background CIL push under sustained load Dave Chinner
2010-09-23 10:43 ` Christoph Hellwig
2010-09-23 18:53 ` Alex Elder
2010-09-24  1:18   ` Dave Chinner [this message]
2010-09-24 14:02     ` Alex Elder
2010-09-23 18:58 ` Alex Elder
2010-09-24  2:15   ` Dave Chinner

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=20100924011855.GR2614@dastard \
    --to=david@fromorbit.com \
    --cc=aelder@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.