linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC]blk: mark discard request sync
@ 2012-03-16  7:40 Shaohua Li
  2012-03-20 16:47 ` Vivek Goyal
  0 siblings, 1 reply; 3+ messages in thread
From: Shaohua Li @ 2012-03-16  7:40 UTC (permalink / raw)
  To: linux-kernel@vger.kernel.org; +Cc: axboe@kernel.dk, Vivek Goyal


Subject: blk: mark discard request sync

discard is called in jbd for example. If discard is slowed down, all
file operations could be impacted (eg, journal is full). And we always
wait for discard to finish. So looks we should mark discard as sync.

Signed-off-by: Shaohua Li <shli@fusionio.com>
---
  block/blk-lib.c |    2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux/block/blk-lib.c
===================================================================
--- linux.orig/block/blk-lib.c	2012-03-16 10:20:49.621517546 +0800
+++ linux/block/blk-lib.c	2012-03-16 10:21:55.901517256 +0800
@@ -42,7 +42,7 @@ int blkdev_issue_discard(struct block_de
  {
  	DECLARE_COMPLETION_ONSTACK(wait);
  	struct request_queue *q = bdev_get_queue(bdev);
-	int type = REQ_WRITE | REQ_DISCARD;
+	int type = REQ_WRITE | REQ_DISCARD | REQ_SYNC;
  	unsigned int max_discard_sectors;
  	struct bio_batch bb;
  	struct bio *bio;

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFC]blk: mark discard request sync
  2012-03-16  7:40 [RFC]blk: mark discard request sync Shaohua Li
@ 2012-03-20 16:47 ` Vivek Goyal
  2012-03-21  1:01   ` Shaohua Li
  0 siblings, 1 reply; 3+ messages in thread
From: Vivek Goyal @ 2012-03-20 16:47 UTC (permalink / raw)
  To: Shaohua Li; +Cc: linux-kernel@vger.kernel.org, axboe@kernel.dk

On Fri, Mar 16, 2012 at 03:40:14PM +0800, Shaohua Li wrote:
> 
> Subject: blk: mark discard request sync
> 
> discard is called in jbd for example. If discard is slowed down, all
> file operations could be impacted (eg, journal is full). And we always
> wait for discard to finish. So looks we should mark discard as sync.
> 
> Signed-off-by: Shaohua Li <shli@fusionio.com>

This one is tricky and I am not sure what's the right thing to do.

Generally the philosophy seems to be that request is sync is somebody
is waiting on it. To me even on async writes somebody is waiting (either
file system or a writer which has been throttled). So if we don't do
async writes in reasonable amount of time, we start getting "task blocked
for more than 120 seconds" message.

Do you have some test cases to show how bad the problem is if we don't
issue discard as SYNC request.

Thanks
Vivek

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFC]blk: mark discard request sync
  2012-03-20 16:47 ` Vivek Goyal
@ 2012-03-21  1:01   ` Shaohua Li
  0 siblings, 0 replies; 3+ messages in thread
From: Shaohua Li @ 2012-03-21  1:01 UTC (permalink / raw)
  To: Vivek Goyal; +Cc: linux-kernel@vger.kernel.org, axboe@kernel.dk

2012/3/21 Vivek Goyal <vgoyal@redhat.com>:
> On Fri, Mar 16, 2012 at 03:40:14PM +0800, Shaohua Li wrote:
>>
>> Subject: blk: mark discard request sync
>>
>> discard is called in jbd for example. If discard is slowed down, all
>> file operations could be impacted (eg, journal is full). And we always
>> wait for discard to finish. So looks we should mark discard as sync.
>>
>> Signed-off-by: Shaohua Li <shli@fusionio.com>
>
> This one is tricky and I am not sure what's the right thing to do.
>
> Generally the philosophy seems to be that request is sync is somebody
> is waiting on it. To me even on async writes somebody is waiting (either
> file system or a writer which has been throttled). So if we don't do
> async writes in reasonable amount of time, we start getting "task blocked
> for more than 120 seconds" message.
Not just waiting. If jbd is slow and full, things will get crazy.

> Do you have some test cases to show how bad the problem is if we don't
> issue discard as SYNC request.
I came this idea when debugging Holger's discard slow problem, though his
problem isn't related to the issue because he is using noop. I realized this
could be a problem if ioscheduler is cfq. I tested a workload which deletes
a lot of small files. With a fusionio card (changing ioscheduler to
cfq), marking
discard sync gives slightly better performance. For ssd with slow discard, this
might be more significant (I didn't try, no such ssd).

But any way, I haven't too strong reason we should do this, this's why it's RFC.

Thanks,
Shaohua

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-03-21  1:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-16  7:40 [RFC]blk: mark discard request sync Shaohua Li
2012-03-20 16:47 ` Vivek Goyal
2012-03-21  1:01   ` Shaohua Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).