From: Steven Whitehouse Date: Wed, 26 Apr 2017 17:09:27 +0100 Subject: [Cluster-devel] [GFS2 PATCH] GFS2: Insert some cond_resched statements into recovery In-Reply-To: <2047552789.17221463.1492627811593.JavaMail.zimbra@redhat.com> References: <2047552789.17221463.1492627811593.JavaMail.zimbra@redhat.com> Message-ID: <596e2cd9-03d5-d1c7-53f5-aa8a043b1bbf@redhat.com> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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 > --- > 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); >