GFS2: Insert some cond_resched statements into recovery
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/1 GFS2: Insert some cond_resched statements into recovery
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.
--- fs/gfs2/lops.c | 3 +++ fs/gfs2/recovery.c | 2 ++ 2 files changed, 5 insertions(+)
fs/gfs2/lops.c +3 -0
@@ -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;
fs/gfs2/recovery.c +2 -0
@@ -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 );
PATCH 1/1 GFS2: Insert some cond_resched statements into recovery
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.
Quoted 63 lines · Bob Peterson
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_reschedstatements into the recovery loops, and also while it searches for the proper starting location in the journal.Signed-off-by Bob Peterson <[email protected]>--- fs/gfs2/lops.c | 3 +++ fs/gfs2/recovery.c | 2 ++ 2 files changed, 5 insertions(+)fs/gfs2/lops.c +3
-0@@ -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;fs/gfs2/recovery.c +2
-0@@ -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 );