* [Cluster-devel] [GFS2 PATCH] GFS2: Reduce contention on gfs2_log_lock
[not found] <1807832995.17105545.1485795653131.JavaMail.zimbra@redhat.com>
@ 2017-01-30 17:03 ` Bob Peterson
2017-01-30 17:06 ` Steven Whitehouse
0 siblings, 1 reply; 2+ messages in thread
From: Bob Peterson @ 2017-01-30 17:03 UTC (permalink / raw)
To: cluster-devel.redhat.com
Hi,
Here is a revised patch for gfs2_log_lock contention based on a
suggestion from Steve Whitehouse. This is much simpler than the
previous patch I posted. Benchmarking has proven the performance
differences are not worth the additional risk of the previous.
Patch description:
---
This patch modifies functions gfs2_trans_add_meta and _data so that
they check whether the buffer_head is already in a transaction,
and if so, avoid taking the gfs2_log_lock.
Signed-off-by: Bob Peterson <rpeterso@redhat.com>
---
diff --git a/fs/gfs2/trans.c b/fs/gfs2/trans.c
index 483c5a7..affef3c 100644
--- a/fs/gfs2/trans.c
+++ b/fs/gfs2/trans.c
@@ -170,6 +170,10 @@ void gfs2_trans_add_data(struct gfs2_glock *gl, struct buffer_head *bh)
}
lock_buffer(bh);
+ if (buffer_pinned(bh)) {
+ set_bit(TR_TOUCHED, &tr->tr_flags);
+ goto out;
+ }
gfs2_log_lock(sdp);
bd = bh->b_private;
if (bd == NULL) {
@@ -192,6 +196,7 @@ void gfs2_trans_add_data(struct gfs2_glock *gl, struct buffer_head *bh)
list_add_tail(&bd->bd_list, &tr->tr_databuf);
}
gfs2_log_unlock(sdp);
+out:
unlock_buffer(bh);
}
@@ -201,10 +206,14 @@ void gfs2_trans_add_meta(struct gfs2_glock *gl, struct buffer_head *bh)
struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
struct gfs2_bufdata *bd;
struct gfs2_meta_header *mh;
- struct gfs2_trans *tr;
+ struct gfs2_trans *tr = current->journal_info;
enum gfs2_freeze_state state = atomic_read(&sdp->sd_freeze_state);
lock_buffer(bh);
+ if (buffer_pinned(bh)) {
+ set_bit(TR_TOUCHED, &tr->tr_flags);
+ goto out;
+ }
gfs2_log_lock(sdp);
bd = bh->b_private;
if (bd == NULL) {
@@ -220,7 +229,6 @@ void gfs2_trans_add_meta(struct gfs2_glock *gl, struct buffer_head *bh)
gfs2_log_lock(sdp);
}
gfs2_assert(sdp, bd->bd_gl == gl);
- tr = current->journal_info;
set_bit(TR_TOUCHED, &tr->tr_flags);
if (!list_empty(&bd->bd_list))
goto out_unlock;
@@ -243,6 +251,7 @@ void gfs2_trans_add_meta(struct gfs2_glock *gl, struct buffer_head *bh)
tr->tr_num_buf_new++;
out_unlock:
gfs2_log_unlock(sdp);
+out:
unlock_buffer(bh);
}
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [Cluster-devel] [GFS2 PATCH] GFS2: Reduce contention on gfs2_log_lock
2017-01-30 17:03 ` [Cluster-devel] [GFS2 PATCH] GFS2: Reduce contention on gfs2_log_lock Bob Peterson
@ 2017-01-30 17:06 ` Steven Whitehouse
0 siblings, 0 replies; 2+ messages in thread
From: Steven Whitehouse @ 2017-01-30 17:06 UTC (permalink / raw)
To: cluster-devel.redhat.com
Hi,
Acked-by: Steven Whitehouse <swhiteho@redhat.com>
Steve.
On 30/01/17 17:03, Bob Peterson wrote:
> Hi,
>
> Here is a revised patch for gfs2_log_lock contention based on a
> suggestion from Steve Whitehouse. This is much simpler than the
> previous patch I posted. Benchmarking has proven the performance
> differences are not worth the additional risk of the previous.
>
> Patch description:
> ---
> This patch modifies functions gfs2_trans_add_meta and _data so that
> they check whether the buffer_head is already in a transaction,
> and if so, avoid taking the gfs2_log_lock.
>
> Signed-off-by: Bob Peterson <rpeterso@redhat.com>
> ---
> diff --git a/fs/gfs2/trans.c b/fs/gfs2/trans.c
> index 483c5a7..affef3c 100644
> --- a/fs/gfs2/trans.c
> +++ b/fs/gfs2/trans.c
> @@ -170,6 +170,10 @@ void gfs2_trans_add_data(struct gfs2_glock *gl, struct buffer_head *bh)
> }
>
> lock_buffer(bh);
> + if (buffer_pinned(bh)) {
> + set_bit(TR_TOUCHED, &tr->tr_flags);
> + goto out;
> + }
> gfs2_log_lock(sdp);
> bd = bh->b_private;
> if (bd == NULL) {
> @@ -192,6 +196,7 @@ void gfs2_trans_add_data(struct gfs2_glock *gl, struct buffer_head *bh)
> list_add_tail(&bd->bd_list, &tr->tr_databuf);
> }
> gfs2_log_unlock(sdp);
> +out:
> unlock_buffer(bh);
> }
>
> @@ -201,10 +206,14 @@ void gfs2_trans_add_meta(struct gfs2_glock *gl, struct buffer_head *bh)
> struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
> struct gfs2_bufdata *bd;
> struct gfs2_meta_header *mh;
> - struct gfs2_trans *tr;
> + struct gfs2_trans *tr = current->journal_info;
> enum gfs2_freeze_state state = atomic_read(&sdp->sd_freeze_state);
>
> lock_buffer(bh);
> + if (buffer_pinned(bh)) {
> + set_bit(TR_TOUCHED, &tr->tr_flags);
> + goto out;
> + }
> gfs2_log_lock(sdp);
> bd = bh->b_private;
> if (bd == NULL) {
> @@ -220,7 +229,6 @@ void gfs2_trans_add_meta(struct gfs2_glock *gl, struct buffer_head *bh)
> gfs2_log_lock(sdp);
> }
> gfs2_assert(sdp, bd->bd_gl == gl);
> - tr = current->journal_info;
> set_bit(TR_TOUCHED, &tr->tr_flags);
> if (!list_empty(&bd->bd_list))
> goto out_unlock;
> @@ -243,6 +251,7 @@ void gfs2_trans_add_meta(struct gfs2_glock *gl, struct buffer_head *bh)
> tr->tr_num_buf_new++;
> out_unlock:
> gfs2_log_unlock(sdp);
> +out:
> unlock_buffer(bh);
> }
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-01-30 17:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <1807832995.17105545.1485795653131.JavaMail.zimbra@redhat.com>
2017-01-30 17:03 ` [Cluster-devel] [GFS2 PATCH] GFS2: Reduce contention on gfs2_log_lock Bob Peterson
2017-01-30 17:06 ` Steven Whitehouse
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.