From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bob Peterson Date: Wed, 19 Apr 2017 14:50:11 -0400 (EDT) Subject: [Cluster-devel] [GFS2 PATCH] GFS2: Insert some cond_resched statements into recovery In-Reply-To: <1000649791.17221377.1492627791779.JavaMail.zimbra@redhat.com> Message-ID: <2047552789.17221463.1492627811593.JavaMail.zimbra@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, 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);