Skip to contentSkip to conversation

pblk: fix max_io calculation

PATCH Applied Javier González 3 participants 3 messages Mar 7, 2019 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pblk: fix max_io calculation

When calculating the maximun I/O size allowed into the buffer, consider the write size (ws_opt) used by the write thread in order to cover the case in which, due to flushes, the mem and subm pointers are disaligned by (ws_opt - 1). This case currently translates into a stall when an I/O of the largest possible size is submitted.

Fixes f9f9d1ae2c66 ("lightnvm: pblk: prevent stall due to wb threshold")

---

Matias: Can you apply this as a fix to 5.1. This is a case I missed when fixing the wb threshold, which is also scheduled for 5.1

Thanks,
Javier

 drivers/lightnvm/pblk-rl.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/lightnvm/pblk-rl.c +6 -1
index b014957dde0b..a5f8bc2defbc 100644
@@ -233,10 +233,15 @@ void pblk_rl_init(struct pblk_rl *rl, int budget, int threshold)
 	/* To start with, all buffer is available to user I/O writers */
 	rl->rb_budget = budget;
 	rl->rb_user_max = budget;
-	rl->rb_max_io = threshold ? (budget - threshold) : (budget - 1);
 	rl->rb_gc_max = 0;
 	rl->rb_state = PBLK_RL_HIGH;
 
+	/* Maximize I/O size and ansure that back threshold is respected */
+	if (threshold)
+		rl->rb_max_io = budget - pblk->min_write_pgs_data - threshold;
+	else
+		rl->rb_max_io = budget - pblk->min_write_pgs_data - 1;
+
 	atomic_set(&rl->rb_user_cnt, 0);
 	atomic_set(&rl->rb_gc_cnt, 0);
 	atomic_set(&rl->rb_space, -1);
Signature · 1 line
2.17.1
#1 lore raw
Quoted 32 lines · Javier González

When calculating the maximun I/O size allowed into the buffer, consider the write size (ws_opt) used by the write thread in order to cover the case in which, due to flushes, the mem and subm pointers are disaligned by (ws_opt - 1). This case currently translates into a stall when an I/O of the largest possible size is submitted.

Fixes f9f9d1ae2c66 ("lightnvm: pblk: prevent stall due to wb threshold")

---

Matias: Can you apply this as a fix to 5.1. This is a case I missed when fixing the wb threshold, which is also scheduled for 5.1

Thanks,
Javier

  drivers/lightnvm/pblk-rl.c | 7 ++++++-
  1 file changed, 6 insertions(+), 1 deletion(-)
drivers/lightnvm/pblk-rl.c +0 -1
index b014957dde0b..a5f8bc2defbc 100644
@@ -233,10 +233,15 @@ void pblk_rl_init(struct pblk_rl *rl, int budget, int threshold)
  	/* To start with, all buffer is available to user I/O writers */
  	rl->rb_budget = budget;
  	rl->rb_user_max = budget;
-	rl->rb_max_io = threshold ? (budget - threshold) : (budget - 1);
  	rl->rb_gc_max = 0;
  	rl->rb_state = PBLK_RL_HIGH;

drivers/lightnvm/pblk-rl.c void pblk_rl_init(struct pblk_rl *rl, int budget, int threshold) · line 247

Quoted 10 lines
drivers/lightnvm/pblk-rl.c +6 -0
 
+	/* Maximize I/O size and ansure that back threshold is respected */
+	if (threshold)
+		rl->rb_max_io = budget - pblk->min_write_pgs_data - threshold;
+	else
+		rl->rb_max_io = budget - pblk->min_write_pgs_data - 1;
+
  	atomic_set(&rl->rb_user_cnt, 0);
  	atomic_set(&rl->rb_gc_cnt, 0);
  	atomic_set(&rl->rb_space, -1);

Hi Jens,

If possible, could you please pick this one up for 5.1? It fixes a previous patch that was introduced in 5.1 that should fix a stall, but didn't quite catch it.

Thank you,
-Matias

maintainer Applied
#2 lore raw
Quoted 46 lines · Matias Bjørling
Quoted 32 lines · Javier González

When calculating the maximun I/O size allowed into the buffer, consider the write size (ws_opt) used by the write thread in order to cover the case in which, due to flushes, the mem and subm pointers are disaligned by (ws_opt - 1). This case currently translates into a stall when an I/O of the largest possible size is submitted.

Fixes f9f9d1ae2c66 ("lightnvm: pblk: prevent stall due to wb threshold")

---

Matias: Can you apply this as a fix to 5.1. This is a case I missed when fixing the wb threshold, which is also scheduled for 5.1

Thanks,
Javier

  drivers/lightnvm/pblk-rl.c | 7 ++++++-
  1 file changed, 6 insertions(+), 1 deletion(-)
drivers/lightnvm/pblk-rl.c +0 -1
index b014957dde0b..a5f8bc2defbc 100644
@@ -233,10 +233,15 @@ void pblk_rl_init(struct pblk_rl *rl, int budget, int threshold)
  	/* To start with, all buffer is available to user I/O writers */
  	rl->rb_budget = budget;
  	rl->rb_user_max = budget;
-	rl->rb_max_io = threshold ? (budget - threshold) : (budget - 1);
  	rl->rb_gc_max = 0;
  	rl->rb_state = PBLK_RL_HIGH;

drivers/lightnvm/pblk-rl.c void pblk_rl_init(struct pblk_rl *rl, int budget, int threshold) · line 247

Quoted 10 lines
drivers/lightnvm/pblk-rl.c +6 -0
 
+	/* Maximize I/O size and ansure that back threshold is respected */
+	if (threshold)
+		rl->rb_max_io = budget - pblk->min_write_pgs_data - threshold;
+	else
+		rl->rb_max_io = budget - pblk->min_write_pgs_data - 1;
+
  	atomic_set(&rl->rb_user_cnt, 0);
  	atomic_set(&rl->rb_gc_cnt, 0);
  	atomic_set(&rl->rb_space, -1);

Hi Jens,

Quoted 3 lines

If possible, could you please pick this one up for 5.1? It fixes a previous patch that was introduced in 5.1 that should fix a stall, but didn't quite catch it.

Applied

Signature · 1 line
Jens Axboe