* [Cluster-devel] [GFS2 PATCH] GFS2: Insert some cond_resched statements into recovery
[not found] <1000649791.17221377.1492627791779.JavaMail.zimbra@redhat.com>
@ 2017-04-19 18:50 ` Bob Peterson
2017-04-26 16:09 ` Steven Whitehouse
0 siblings, 1 reply; 2+ messages in thread
From: Bob Peterson @ 2017-04-19 18:50 UTC (permalink / raw)
To: cluster-devel.redhat.com
Hi,
During recovery, GFS2 can be a CPU hog while it replays its journals.
This can prevent realtime processes like corosync from getting their
proper time slices. This patch inserts some cond_resched statements
into the recovery loops, and also while it searches for the proper
starting location in the journal.
Signed-off-by: Bob Peterson <rpeterso@redhat.com>
---
fs/gfs2/lops.c | 3 +++
fs/gfs2/recovery.c | 2 ++
2 files changed, 5 insertions(+)
diff --git a/fs/gfs2/lops.c b/fs/gfs2/lops.c
index b1f9144..aa7507c 100644
--- a/fs/gfs2/lops.c
+++ b/fs/gfs2/lops.c
@@ -566,6 +566,7 @@ static int buf_lo_scan_elements(struct gfs2_jdesc *jd, unsigned int start,
break;
jd->jd_replayed_blocks++;
+ cond_resched();
}
return error;
@@ -722,6 +723,7 @@ static int revoke_lo_scan_elements(struct gfs2_jdesc *jd, unsigned int start,
brelse(bh);
offset = sizeof(struct gfs2_meta_header);
first = 0;
+ cond_resched();
}
return 0;
@@ -802,6 +804,7 @@ static int databuf_lo_scan_elements(struct gfs2_jdesc *jd, unsigned int start,
brelse(bh_ip);
jd->jd_replayed_blocks++;
+ cond_resched();
}
return error;
diff --git a/fs/gfs2/recovery.c b/fs/gfs2/recovery.c
index 113b609..b5873f7 100644
--- a/fs/gfs2/recovery.c
+++ b/fs/gfs2/recovery.c
@@ -287,6 +287,7 @@ int gfs2_find_jhead(struct gfs2_jdesc *jd, struct gfs2_log_header_host *head)
blk_1 = blk_m;
else
blk_2 = blk_m;
+ cond_resched();
}
error = jhead_scan(jd, &lh_1);
@@ -602,6 +603,7 @@ int gfs2_recover_journal(struct gfs2_jdesc *jd, bool wait)
rv = queue_work(gfs_recovery_wq, &jd->jd_work);
BUG_ON(!rv);
+ cond_resched();
if (wait)
wait_on_bit(&jd->jd_flags, JDF_RECOVERY,
TASK_UNINTERRUPTIBLE);
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [Cluster-devel] [GFS2 PATCH] GFS2: Insert some cond_resched statements into recovery
2017-04-19 18:50 ` [Cluster-devel] [GFS2 PATCH] GFS2: Insert some cond_resched statements into recovery Bob Peterson
@ 2017-04-26 16:09 ` Steven Whitehouse
0 siblings, 0 replies; 2+ messages in thread
From: Steven Whitehouse @ 2017-04-26 16:09 UTC (permalink / raw)
To: cluster-devel.redhat.com
Hi,
That generally looks ok, but not sure why we would need to have a
cond_resched() in gfs2_recover_journal() since that only schedules work
on a work queue. Even if it is doing that for several different
journals, that should not take very long. The other cond_resched() calls
all make sense to me though,
Steve.
On 19/04/17 19:50, Bob Peterson wrote:
> Hi,
>
> During recovery, GFS2 can be a CPU hog while it replays its journals.
> This can prevent realtime processes like corosync from getting their
> proper time slices. This patch inserts some cond_resched statements
> into the recovery loops, and also while it searches for the proper
> starting location in the journal.
>
> Signed-off-by: Bob Peterson <rpeterso@redhat.com>
> ---
> fs/gfs2/lops.c | 3 +++
> fs/gfs2/recovery.c | 2 ++
> 2 files changed, 5 insertions(+)
>
> diff --git a/fs/gfs2/lops.c b/fs/gfs2/lops.c
> index b1f9144..aa7507c 100644
> --- a/fs/gfs2/lops.c
> +++ b/fs/gfs2/lops.c
> @@ -566,6 +566,7 @@ static int buf_lo_scan_elements(struct gfs2_jdesc *jd, unsigned int start,
> break;
>
> jd->jd_replayed_blocks++;
> + cond_resched();
> }
>
> return error;
> @@ -722,6 +723,7 @@ static int revoke_lo_scan_elements(struct gfs2_jdesc *jd, unsigned int start,
> brelse(bh);
> offset = sizeof(struct gfs2_meta_header);
> first = 0;
> + cond_resched();
> }
>
> return 0;
> @@ -802,6 +804,7 @@ static int databuf_lo_scan_elements(struct gfs2_jdesc *jd, unsigned int start,
> brelse(bh_ip);
>
> jd->jd_replayed_blocks++;
> + cond_resched();
> }
>
> return error;
> diff --git a/fs/gfs2/recovery.c b/fs/gfs2/recovery.c
> index 113b609..b5873f7 100644
> --- a/fs/gfs2/recovery.c
> +++ b/fs/gfs2/recovery.c
> @@ -287,6 +287,7 @@ int gfs2_find_jhead(struct gfs2_jdesc *jd, struct gfs2_log_header_host *head)
> blk_1 = blk_m;
> else
> blk_2 = blk_m;
> + cond_resched();
> }
>
> error = jhead_scan(jd, &lh_1);
> @@ -602,6 +603,7 @@ int gfs2_recover_journal(struct gfs2_jdesc *jd, bool wait)
> rv = queue_work(gfs_recovery_wq, &jd->jd_work);
> BUG_ON(!rv);
>
> + cond_resched();
> if (wait)
> wait_on_bit(&jd->jd_flags, JDF_RECOVERY,
> TASK_UNINTERRUPTIBLE);
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-04-26 16:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <1000649791.17221377.1492627791779.JavaMail.zimbra@redhat.com>
2017-04-19 18:50 ` [Cluster-devel] [GFS2 PATCH] GFS2: Insert some cond_resched statements into recovery Bob Peterson
2017-04-26 16:09 ` 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.