All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mikulas Patocka <mpatocka@redhat.com>
To: Mike Snitzer <msnitzer@redhat.com>
Cc: dm-devel@redhat.com
Subject: [PATCH] dm-writecache: use low watermark
Date: Thu, 7 Jun 2018 15:58:19 -0400 (EDT)	[thread overview]
Message-ID: <alpine.LRH.2.02.1806071557500.17754@file01.intranet.prod.int.rdu2.redhat.com> (raw)

Fix a bug that low watermark was ignored and high watermark was used as
both low and high.

The patch also verifies that high watermark is greater or equal than low
watermark - if this condition is violated, the driver would consume too
much CPU.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>

---
 drivers/md/dm-writecache.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Index: linux-2.6/drivers/md/dm-writecache.c
===================================================================
--- linux-2.6.orig/drivers/md/dm-writecache.c	2018-06-07 21:21:47.000000000 +0200
+++ linux-2.6/drivers/md/dm-writecache.c	2018-06-07 21:23:21.000000000 +0200
@@ -1590,7 +1590,7 @@ restart:
 	wbl.size = 0;
 	while (!list_empty(&wc->lru) &&
 	       (wc->writeback_all ||
-		wc->freelist_size + wc->writeback_size <= wc->freelist_high_watermark)) {
+		wc->freelist_size + wc->writeback_size <= wc->freelist_low_watermark)) {
 
 		n_walked++;
 		if (unlikely(n_walked > WRITEBACK_LATENCY) &&
@@ -2033,6 +2033,12 @@ invalid_optional:
 		}
 	}
 
+	if (high_wm_percent < low_wm_percent) {
+		r = -EINVAL;
+		ti->error = "High watermark must be greater or equal than low watermark";
+		goto bad;
+	}
+
 	if (!WC_MODE_PMEM(wc)) {
 		struct dm_io_region region;
 		struct dm_io_request req;

             reply	other threads:[~2018-06-07 19:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-07 19:58 Mikulas Patocka [this message]
2018-06-07 22:51 ` [PATCH v2] dm-writecache: use low watermark Mikulas Patocka

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=alpine.LRH.2.02.1806071557500.17754@file01.intranet.prod.int.rdu2.redhat.com \
    --to=mpatocka@redhat.com \
    --cc=dm-devel@redhat.com \
    --cc=msnitzer@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.