All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bob Peterson <rpeterso@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [GFS2 PATCH] GFS2: Insert some cond_resched statements into recovery
Date: Wed, 19 Apr 2017 14:50:11 -0400 (EDT)	[thread overview]
Message-ID: <2047552789.17221463.1492627811593.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <1000649791.17221377.1492627791779.JavaMail.zimbra@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);



       reply	other threads:[~2017-04-19 18:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1000649791.17221377.1492627791779.JavaMail.zimbra@redhat.com>
2017-04-19 18:50 ` Bob Peterson [this message]
2017-04-26 16:09   ` [Cluster-devel] [GFS2 PATCH] GFS2: Insert some cond_resched statements into recovery Steven Whitehouse

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2047552789.17221463.1492627811593.JavaMail.zimbra@redhat.com \
    --to=rpeterso@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.