cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
* [Cluster-devel] [GFS2 PATCH] [TRY 2] GFS2: Instruct DLM to avoid queue convert slowdown
       [not found] <e803b409-6098-4529-b6dc-36c4178cf07d@zmail12.collab.prod.int.phx2.redhat.com>
@ 2012-04-10 18:13 ` Bob Peterson
  2012-04-10 18:21   ` Steven Whitehouse
  0 siblings, 1 reply; 4+ messages in thread
From: Bob Peterson @ 2012-04-10 18:13 UTC (permalink / raw)
  To: cluster-devel.redhat.com

Hi,

Here is my revised patch based on Steve's suggestion to base the
flag on the recent GLF_BLOCKING flag.

We still need to keep this on hold until the prerequisite dlm patch
is properly upstream.

Regards,

Bob Peterson
Red Hat File Systems

Signed-off-by: Bob Peterson <rpeterso@redhat.com> 
---
Author: Bob Peterson <rpeterso@redhat.com>
Date:   Tue Apr 10 14:08:11 2012 -0500

    GFS2: Instruct DLM to avoid queue convert slowdowns
    
    This patch instructs DLM to prevent an "in place" conversion, where the
    lock just stays on the granted queue, and instead forces the conversion to
    the back of the convert queue. This is done on upward conversions only.
    
    This is useful in cases where, for example, a lock is frequently needed in
    PR on one node, but another node needs it temporarily in EX to update it.
    This may happen, for example, when the rindex is being updated by gfs2_grow.
    The gfs2_grow needs to have the lock in EX, but the other nodes need to
    re-read it to retrieve the updates. The glock is already granted in PR on
    the non-growing nodes, so this prevents them from continually re-granting
    the lock in PR, and forces the EX from gfs2_grow to go through.

diff --git a/fs/gfs2/lock_dlm.c b/fs/gfs2/lock_dlm.c
index f8411bd..ed9c5ca 100644
--- a/fs/gfs2/lock_dlm.c
+++ b/fs/gfs2/lock_dlm.c
@@ -200,11 +200,15 @@ static int make_mode(const unsigned int lmstate)
 	return -1;
 }
 
-static u32 make_flags(const u32 lkid, const unsigned int gfs_flags,
+static u32 make_flags(struct gfs2_glock *gl, const unsigned int gfs_flags,
 		      const int req)
 {
 	u32 lkf = DLM_LKF_VALBLK;
+	u32 lkid = gl->gl_lksb.sb_lkid;
+	int is_upconvert = 0;
 
+	if (test_bit(GLF_BLOCKING, &gl->gl_flags))
+		is_upconvert = 1;
 	if (gfs_flags & LM_FLAG_TRY)
 		lkf |= DLM_LKF_NOQUEUE;
 
@@ -227,8 +231,11 @@ static u32 make_flags(const u32 lkid, const unsigned int gfs_flags,
 			BUG();
 	}
 
-	if (lkid != 0) 
+	if (lkid != 0) {
 		lkf |= DLM_LKF_CONVERT;
+		if (is_upconvert)
+			lkf |= DLM_LKF_QUECVT;
+	}
 
 	return lkf;
 }
@@ -250,7 +257,7 @@ static int gdlm_lock(struct gfs2_glock *gl, unsigned int req_state,
 	char strname[GDLM_STRNAME_BYTES] = "";
 
 	req = make_mode(req_state);
-	lkf = make_flags(gl->gl_lksb.sb_lkid, flags, req);
+	lkf = make_flags(gl, flags, req);
 	gfs2_glstats_inc(gl, GFS2_LKS_DCOUNT);
 	gfs2_sbstats_inc(gl, GFS2_LKS_DCOUNT);
 	if (gl->gl_lksb.sb_lkid) {



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Cluster-devel] [GFS2 PATCH] [TRY 2] GFS2: Instruct DLM to avoid queue convert slowdown
  2012-04-10 18:13 ` [Cluster-devel] [GFS2 PATCH] [TRY 2] GFS2: Instruct DLM to avoid queue convert slowdown Bob Peterson
@ 2012-04-10 18:21   ` Steven Whitehouse
  2012-04-10 18:45     ` [Cluster-devel] [GFS2 PATCH] [TRY 3] " Bob Peterson
  0 siblings, 1 reply; 4+ messages in thread
From: Steven Whitehouse @ 2012-04-10 18:21 UTC (permalink / raw)
  To: cluster-devel.redhat.com

Hi,

On Tue, 2012-04-10 at 14:13 -0400, Bob Peterson wrote:
> Hi,
> 
> Here is my revised patch based on Steve's suggestion to base the
> flag on the recent GLF_BLOCKING flag.
> 
> We still need to keep this on hold until the prerequisite dlm patch
> is properly upstream.
> 
> Regards,
> 
> Bob Peterson
> Red Hat File Systems
> 
> Signed-off-by: Bob Peterson <rpeterso@redhat.com> 
> ---
> Author: Bob Peterson <rpeterso@redhat.com>
> Date:   Tue Apr 10 14:08:11 2012 -0500
> 
>     GFS2: Instruct DLM to avoid queue convert slowdowns
>     
>     This patch instructs DLM to prevent an "in place" conversion, where the
>     lock just stays on the granted queue, and instead forces the conversion to
>     the back of the convert queue. This is done on upward conversions only.
>     
>     This is useful in cases where, for example, a lock is frequently needed in
>     PR on one node, but another node needs it temporarily in EX to update it.
>     This may happen, for example, when the rindex is being updated by gfs2_grow.
>     The gfs2_grow needs to have the lock in EX, but the other nodes need to
>     re-read it to retrieve the updates. The glock is already granted in PR on
>     the non-growing nodes, so this prevents them from continually re-granting
>     the lock in PR, and forces the EX from gfs2_grow to go through.
> 
> diff --git a/fs/gfs2/lock_dlm.c b/fs/gfs2/lock_dlm.c
> index f8411bd..ed9c5ca 100644
> --- a/fs/gfs2/lock_dlm.c
> +++ b/fs/gfs2/lock_dlm.c
> @@ -200,11 +200,15 @@ static int make_mode(const unsigned int lmstate)
>  	return -1;
>  }
>  
> -static u32 make_flags(const u32 lkid, const unsigned int gfs_flags,
> +static u32 make_flags(struct gfs2_glock *gl, const unsigned int gfs_flags,
>  		      const int req)
>  {
>  	u32 lkf = DLM_LKF_VALBLK;
> +	u32 lkid = gl->gl_lksb.sb_lkid;
> +	int is_upconvert = 0;
>  
> +	if (test_bit(GLF_BLOCKING, &gl->gl_flags))
> +		is_upconvert = 1;
Rather than create this is_upconvert variable here...

>  	if (gfs_flags & LM_FLAG_TRY)
>  		lkf |= DLM_LKF_NOQUEUE;
>  
> @@ -227,8 +231,11 @@ static u32 make_flags(const u32 lkid, const unsigned int gfs_flags,
>  			BUG();
>  	}
>  
> -	if (lkid != 0) 
> +	if (lkid != 0) {
>  		lkf |= DLM_LKF_CONVERT;
> +		if (is_upconvert)
why not just test the flag bit here?

Otherwise looks good,

Steve.

> +			lkf |= DLM_LKF_QUECVT;
> +	}
>  
>  	return lkf;
>  }
> @@ -250,7 +257,7 @@ static int gdlm_lock(struct gfs2_glock *gl, unsigned int req_state,
>  	char strname[GDLM_STRNAME_BYTES] = "";
>  
>  	req = make_mode(req_state);
> -	lkf = make_flags(gl->gl_lksb.sb_lkid, flags, req);
> +	lkf = make_flags(gl, flags, req);
>  	gfs2_glstats_inc(gl, GFS2_LKS_DCOUNT);
>  	gfs2_sbstats_inc(gl, GFS2_LKS_DCOUNT);
>  	if (gl->gl_lksb.sb_lkid) {
> 




^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Cluster-devel] [GFS2 PATCH] [TRY 3] GFS2: Instruct DLM to avoid queue convert slowdown
  2012-04-10 18:21   ` Steven Whitehouse
@ 2012-04-10 18:45     ` Bob Peterson
  2012-04-10 19:02       ` Steven Whitehouse
  0 siblings, 1 reply; 4+ messages in thread
From: Bob Peterson @ 2012-04-10 18:45 UTC (permalink / raw)
  To: cluster-devel.redhat.com

----- Original Message -----
| why not just test the flag bit here?
| 
| Otherwise looks good,
| 
| Steve.

Hi,

Silly me. Good catch. It's been a long day. Sigh.

Regards,

Bob Peterson
Red Hat File Systems

Signed-off-by: Bob Peterson <rpeterso@redhat.com>
---
Author: Bob Peterson <rpeterso@redhat.com>
Date:   Tue Apr 10 14:08:11 2012 -0500

    GFS2: Instruct DLM to avoid queue convert slowdowns
    
    This patch instructs DLM to prevent an "in place" conversion, where the
    lock just stays on the granted queue, and instead forces the conversion to
    the back of the convert queue. This is done on upward conversions only.
    
    This is useful in cases where, for example, a lock is frequently needed in
    PR on one node, but another node needs it temporarily in EX to update it.
    This may happen, for example, when the rindex is being updated by gfs2_grow.
    The gfs2_grow needs to have the lock in EX, but the other nodes need to
    re-read it to retrieve the updates. The glock is already granted in PR on
    the non-growing nodes, so this prevents them from continually re-granting
    the lock in PR, and forces the EX from gfs2_grow to go through.

diff --git a/fs/gfs2/lock_dlm.c b/fs/gfs2/lock_dlm.c
index f8411bd..5f5e70e 100644
--- a/fs/gfs2/lock_dlm.c
+++ b/fs/gfs2/lock_dlm.c
@@ -200,10 +200,11 @@ static int make_mode(const unsigned int lmstate)
 	return -1;
 }
 
-static u32 make_flags(const u32 lkid, const unsigned int gfs_flags,
+static u32 make_flags(struct gfs2_glock *gl, const unsigned int gfs_flags,
 		      const int req)
 {
 	u32 lkf = DLM_LKF_VALBLK;
+	u32 lkid = gl->gl_lksb.sb_lkid;
 
 	if (gfs_flags & LM_FLAG_TRY)
 		lkf |= DLM_LKF_NOQUEUE;
@@ -227,8 +228,11 @@ static u32 make_flags(const u32 lkid, const unsigned int gfs_flags,
 			BUG();
 	}
 
-	if (lkid != 0) 
+	if (lkid != 0) {
 		lkf |= DLM_LKF_CONVERT;
+		if (test_bit(GLF_BLOCKING, &gl->gl_flags))
+			lkf |= DLM_LKF_QUECVT;
+	}
 
 	return lkf;
 }
@@ -250,7 +254,7 @@ static int gdlm_lock(struct gfs2_glock *gl, unsigned int req_state,
 	char strname[GDLM_STRNAME_BYTES] = "";
 
 	req = make_mode(req_state);
-	lkf = make_flags(gl->gl_lksb.sb_lkid, flags, req);
+	lkf = make_flags(gl, flags, req);
 	gfs2_glstats_inc(gl, GFS2_LKS_DCOUNT);
 	gfs2_sbstats_inc(gl, GFS2_LKS_DCOUNT);
 	if (gl->gl_lksb.sb_lkid) {



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Cluster-devel] [GFS2 PATCH] [TRY 3] GFS2: Instruct DLM to avoid queue convert slowdown
  2012-04-10 18:45     ` [Cluster-devel] [GFS2 PATCH] [TRY 3] " Bob Peterson
@ 2012-04-10 19:02       ` Steven Whitehouse
  0 siblings, 0 replies; 4+ messages in thread
From: Steven Whitehouse @ 2012-04-10 19:02 UTC (permalink / raw)
  To: cluster-devel.redhat.com

Hi,

Thanks - that looks good. I'll add it to the queue as soon as the DLM
patch has made it to the required state too,

Steve.

On Tue, 2012-04-10 at 14:45 -0400, Bob Peterson wrote:
> ----- Original Message -----
> | why not just test the flag bit here?
> | 
> | Otherwise looks good,
> | 
> | Steve.
> 
> Hi,
> 
> Silly me. Good catch. It's been a long day. Sigh.
> 
> Regards,
> 
> Bob Peterson
> Red Hat File Systems
> 
> Signed-off-by: Bob Peterson <rpeterso@redhat.com>
> ---
> Author: Bob Peterson <rpeterso@redhat.com>
> Date:   Tue Apr 10 14:08:11 2012 -0500
> 
>     GFS2: Instruct DLM to avoid queue convert slowdowns
>     
>     This patch instructs DLM to prevent an "in place" conversion, where the
>     lock just stays on the granted queue, and instead forces the conversion to
>     the back of the convert queue. This is done on upward conversions only.
>     
>     This is useful in cases where, for example, a lock is frequently needed in
>     PR on one node, but another node needs it temporarily in EX to update it.
>     This may happen, for example, when the rindex is being updated by gfs2_grow.
>     The gfs2_grow needs to have the lock in EX, but the other nodes need to
>     re-read it to retrieve the updates. The glock is already granted in PR on
>     the non-growing nodes, so this prevents them from continually re-granting
>     the lock in PR, and forces the EX from gfs2_grow to go through.
> 
> diff --git a/fs/gfs2/lock_dlm.c b/fs/gfs2/lock_dlm.c
> index f8411bd..5f5e70e 100644
> --- a/fs/gfs2/lock_dlm.c
> +++ b/fs/gfs2/lock_dlm.c
> @@ -200,10 +200,11 @@ static int make_mode(const unsigned int lmstate)
>  	return -1;
>  }
>  
> -static u32 make_flags(const u32 lkid, const unsigned int gfs_flags,
> +static u32 make_flags(struct gfs2_glock *gl, const unsigned int gfs_flags,
>  		      const int req)
>  {
>  	u32 lkf = DLM_LKF_VALBLK;
> +	u32 lkid = gl->gl_lksb.sb_lkid;
>  
>  	if (gfs_flags & LM_FLAG_TRY)
>  		lkf |= DLM_LKF_NOQUEUE;
> @@ -227,8 +228,11 @@ static u32 make_flags(const u32 lkid, const unsigned int gfs_flags,
>  			BUG();
>  	}
>  
> -	if (lkid != 0) 
> +	if (lkid != 0) {
>  		lkf |= DLM_LKF_CONVERT;
> +		if (test_bit(GLF_BLOCKING, &gl->gl_flags))
> +			lkf |= DLM_LKF_QUECVT;
> +	}
>  
>  	return lkf;
>  }
> @@ -250,7 +254,7 @@ static int gdlm_lock(struct gfs2_glock *gl, unsigned int req_state,
>  	char strname[GDLM_STRNAME_BYTES] = "";
>  
>  	req = make_mode(req_state);
> -	lkf = make_flags(gl->gl_lksb.sb_lkid, flags, req);
> +	lkf = make_flags(gl, flags, req);
>  	gfs2_glstats_inc(gl, GFS2_LKS_DCOUNT);
>  	gfs2_sbstats_inc(gl, GFS2_LKS_DCOUNT);
>  	if (gl->gl_lksb.sb_lkid) {




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-04-10 19:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <e803b409-6098-4529-b6dc-36c4178cf07d@zmail12.collab.prod.int.phx2.redhat.com>
2012-04-10 18:13 ` [Cluster-devel] [GFS2 PATCH] [TRY 2] GFS2: Instruct DLM to avoid queue convert slowdown Bob Peterson
2012-04-10 18:21   ` Steven Whitehouse
2012-04-10 18:45     ` [Cluster-devel] [GFS2 PATCH] [TRY 3] " Bob Peterson
2012-04-10 19:02       ` Steven Whitehouse

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).