From: Hannes Reinecke <hare@suse.de>
To: Mike Snitzer <snitzer@redhat.com>
Cc: Damien LeMoal <damien.lemoal@wdc.com>, dm-devel@redhat.com
Subject: [PATCH 5/6] dm-zoned: terminate reclaim on congestion
Date: Tue, 19 May 2020 10:14:23 +0200 [thread overview]
Message-ID: <20200519081424.103318-6-hare@suse.de> (raw)
In-Reply-To: <20200519081424.103318-1-hare@suse.de>
When dmz_get_chunk_mapping() selects a zone which is under reclaim
we should terminating the reclaim copy process; as we're changing
the zone itself reclaim needs to run afterwards again anyway.
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
drivers/md/dm-zoned-metadata.c | 2 ++
drivers/md/dm-zoned-reclaim.c | 6 ++++--
drivers/md/dm-zoned.h | 3 +++
3 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/drivers/md/dm-zoned-metadata.c b/drivers/md/dm-zoned-metadata.c
index ee613ba2e8aa..857390030cac 100644
--- a/drivers/md/dm-zoned-metadata.c
+++ b/drivers/md/dm-zoned-metadata.c
@@ -1851,7 +1851,9 @@ static void dmz_wait_for_reclaim(struct dmz_metadata *zmd, struct dm_zone *zone)
{
dmz_unlock_map(zmd);
dmz_unlock_metadata(zmd);
+ set_bit(DMZ_RECLAIM_TERMINATE, &zone->flags);
wait_on_bit_timeout(&zone->flags, DMZ_RECLAIM, TASK_UNINTERRUPTIBLE, HZ);
+ clear_bit(DMZ_RECLAIM_TERMINATE, &zone->flags);
dmz_lock_metadata(zmd);
dmz_lock_map(zmd);
}
diff --git a/drivers/md/dm-zoned-reclaim.c b/drivers/md/dm-zoned-reclaim.c
index 1283405bec29..3ed88581dc48 100644
--- a/drivers/md/dm-zoned-reclaim.c
+++ b/drivers/md/dm-zoned-reclaim.c
@@ -143,6 +143,9 @@ static int dmz_reclaim_copy(struct dmz_reclaim *zrc,
if (dst_dev->flags & DMZ_BDEV_DYING)
return -EIO;
+ if (dmz_reclaim_should_terminate(src_zone))
+ return -EINTR;
+
/* Get a valid region from the source zone */
ret = dmz_first_valid_block(zmd, src_zone, &block);
if (ret <= 0)
@@ -517,7 +520,7 @@ static void dmz_reclaim_work(struct work_struct *work)
dmz_nr_rnd_zones(zmd));
ret = dmz_do_reclaim(zrc);
- if (ret) {
+ if (ret && ret != -EINTR) {
DMDEBUG("(%s): Reclaim error %d",
dmz_metadata_label(zmd), ret);
if (!dmz_check_dev(zmd))
@@ -617,4 +620,3 @@ void dmz_schedule_reclaim(struct dmz_reclaim *zrc)
if (dmz_should_reclaim(zrc, p_unmap))
mod_delayed_work(zrc->wq, &zrc->work, 0);
}
-
diff --git a/drivers/md/dm-zoned.h b/drivers/md/dm-zoned.h
index 288054dd7cf4..8083607b9535 100644
--- a/drivers/md/dm-zoned.h
+++ b/drivers/md/dm-zoned.h
@@ -127,6 +127,7 @@ enum {
/* Zone internal state */
DMZ_RECLAIM,
DMZ_SEQ_WRITE_ERR,
+ DMZ_RECLAIM_TERMINATE,
};
/*
@@ -140,6 +141,8 @@ enum {
#define dmz_is_readonly(z) test_bit(DMZ_READ_ONLY, &(z)->flags)
#define dmz_in_reclaim(z) test_bit(DMZ_RECLAIM, &(z)->flags)
#define dmz_seq_write_err(z) test_bit(DMZ_SEQ_WRITE_ERR, &(z)->flags)
+#define dmz_reclaim_should_terminate(z) \
+ test_bit(DMZ_RECLAIM_TERMINATE, &(z)->flags)
#define dmz_is_meta(z) test_bit(DMZ_META, &(z)->flags)
#define dmz_is_buf(z) test_bit(DMZ_BUF, &(z)->flags)
--
2.16.4
next prev parent reply other threads:[~2020-05-19 8:14 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-19 8:14 [PATCHv2 0/6] dm-zoned: improve cache performance Hannes Reinecke
2020-05-19 8:14 ` [PATCH 1/6] dm-zoned: return NULL if dmz_get_zone_for_reclaim() fails to find a zone Hannes Reinecke
2020-05-19 22:15 ` Damien Le Moal
2020-05-19 8:14 ` [PATCH 2/6] dm-zoned: separate random and cache zones Hannes Reinecke
2020-05-19 22:23 ` Damien Le Moal
2020-05-19 8:14 ` [PATCH 3/6] dm-zoned: reclaim random zones when idle Hannes Reinecke
2020-05-19 22:26 ` Damien Le Moal
2020-05-19 8:14 ` [PATCH 4/6] dm-zoned: start reclaim with sequential zones Hannes Reinecke
2020-05-19 22:27 ` Damien Le Moal
2020-05-19 8:14 ` Hannes Reinecke [this message]
2020-05-19 22:29 ` [PATCH 5/6] dm-zoned: terminate reclaim on congestion Damien Le Moal
2020-05-19 8:14 ` [PATCH 6/6] dm-zoned: remove unused variable in dmz_do_reclaim() Hannes Reinecke
2020-05-19 22:29 ` Damien Le Moal
2020-05-19 17:36 ` [PATCHv2 0/6] dm-zoned: improve cache performance Mike Snitzer
2020-05-19 22:36 ` Damien Le Moal
2020-05-20 18:53 ` Mike Snitzer
2020-05-20 23:59 ` Damien Le Moal
2020-05-21 7:56 ` Damien Le Moal
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=20200519081424.103318-6-hare@suse.de \
--to=hare@suse.de \
--cc=damien.lemoal@wdc.com \
--cc=dm-devel@redhat.com \
--cc=snitzer@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.