cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Steven Whitehouse <swhiteho@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [GFS2 PATCH 1/2] GFS2: Simplify gfs2_rgrp_used_recently
Date: Thu, 18 Jan 2018 09:04:43 +0000	[thread overview]
Message-ID: <236e32c9-6fd5-a76f-9f15-1bd56bc4f384@redhat.com> (raw)
In-Reply-To: <20180117142335.26491-2-rpeterso@redhat.com>

Hi,


On 17/01/18 14:23, Bob Peterson wrote:
> This patch simplifies function gfs2_rgrp_used_recently. Now it uses
> ktime functions to do its calculations. Also, it's called with the
> rgrp rather than the reservation, and the constant HZ rather than
> the hard-coded value 1000.
>
> Signed-off-by: Bob Peterson <rpeterso@redhat.com>
> ---
>   fs/gfs2/rgrp.c | 19 ++++++++-----------
>   1 file changed, 8 insertions(+), 11 deletions(-)
I'm not sure that this does simplify it. In any case the argument is a 
time specified in msec, and HZ is a constant whose value is the number 
of clock ticks in a second. It makes no sense to assign one to the other.

It would be good to get away from the constant of 1 sec that is used 
here, but that required some analysis in order to figure out how to 
create a suitable algorithm. If as a result of testing we can work out a 
more suitable constant to use here, then that is fine as a stop gap 
measure too. HZ though makes no sense at all in this case,

Steve.

> diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c
> index 6dea72f49316..4c9467bf9ab6 100644
> --- a/fs/gfs2/rgrp.c
> +++ b/fs/gfs2/rgrp.c
> @@ -1900,21 +1900,18 @@ static bool gfs2_rgrp_congested(const struct gfs2_rgrpd *rgd, int loops)
>   }
>   
>   /**
> - * gfs2_rgrp_used_recently
> - * @rs: The block reservation with the rgrp to test
> + * gfs2_rgrp_used_recently - check if a rgrp has been used recently
> + * @rgd: The rgrp to test
>    * @msecs: The time limit in milliseconds
>    *
>    * Returns: True if the rgrp glock has been used within the time limit
>    */
> -static bool gfs2_rgrp_used_recently(const struct gfs2_blkreserv *rs,
> -				    u64 msecs)
> +static inline bool gfs2_rgrp_used_recently(const struct gfs2_rgrpd *rgd,
> +					   u64 msecs)
>   {
> -	u64 tdiff;
> -
> -	tdiff = ktime_to_ns(ktime_sub(ktime_get_real(),
> -                            rs->rs_rbm.rgd->rd_gl->gl_dstamp));
> -
> -	return tdiff > (msecs * 1000 * 1000);
> +	return (ktime_before(ktime_get_real(),
> +			     ktime_add(rgd->rd_gl->gl_dstamp,
> +				       ms_to_ktime(msecs))));
>   }
>   
>   static u32 gfs2_orlov_skip(const struct gfs2_inode *ip)
> @@ -2014,7 +2011,7 @@ int gfs2_inplace_reserve(struct gfs2_inode *ip, struct gfs2_alloc_parms *ap)
>   				    !fast_to_acquire(rs->rs_rbm.rgd))
>   					goto next_rgrp;
>   				if ((loops < 2) &&
> -				    gfs2_rgrp_used_recently(rs, 1000) &&
> +				    gfs2_rgrp_used_recently(rs->rs_rbm.rgd, HZ) &&
>   				    gfs2_rgrp_congested(rs->rs_rbm.rgd, loops))
>   					goto next_rgrp;
>   			}



  reply	other threads:[~2018-01-18  9:04 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-17 14:23 [Cluster-devel] [GFS2 PATCH 0/2] GFS2: Rework rgrp glock congestion functions for intra-node Bob Peterson
2018-01-17 14:23 ` [Cluster-devel] [GFS2 PATCH 1/2] GFS2: Simplify gfs2_rgrp_used_recently Bob Peterson
2018-01-18  9:04   ` Steven Whitehouse [this message]
2018-01-17 14:23 ` [Cluster-devel] [GFS2 PATCH 2/2] GFS2: Split gfs2_rgrp_congested into inter-node and intra-node cases Bob Peterson
2018-01-18  9:08   ` Steven Whitehouse
2018-01-19 14:43     ` Bob Peterson
2018-01-24 17:04       ` Bob Peterson
2018-01-24 20:46         ` Steven Whitehouse
2018-01-25 11:47         ` Steven Whitehouse

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=236e32c9-6fd5-a76f-9f15-1bd56bc4f384@redhat.com \
    --to=swhiteho@redhat.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;
as well as URLs for NNTP newsgroup(s).