Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754577Ab1EGBY1 (ORCPT ); Fri, 6 May 2011 21:24:27 -0400 Received: from mx2.fusionio.com ([66.114.96.31]:41054 "EHLO mx2.fusionio.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753464Ab1EGBY0 (ORCPT ); Fri, 6 May 2011 21:24:26 -0400 X-ASG-Debug-ID: 1304731464-01de28096b1b720001-xx1T2L X-Barracuda-Envelope-From: JAxboe@fusionio.com Message-ID: <4DC49F48.6010509@fusionio.com> Date: Fri, 6 May 2011 19:24:24 -0600 From: Jens Axboe MIME-Version: 1.0 To: Lukas Czerner CC: "linux-fsdevel@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Dmitry Monakhov , Jeff Moyer Subject: Re: [PATCH 1/3] blkdev: Submit discard bio in batches in blkdev_issue_discard() References: <1304345841-20063-1-git-send-email-lczerner@redhat.com> <4DBEDA78.7020502@fusionio.com> X-ASG-Orig-Subj: Re: [PATCH 1/3] blkdev: Submit discard bio in batches in blkdev_issue_discard() In-Reply-To: Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit X-Barracuda-Connect: mail1.int.fusionio.com[10.101.1.21] X-Barracuda-Start-Time: 1304731464 X-Barracuda-URL: http://10.101.1.181:8000/cgi-mod/mark.cgi X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=9.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.2.62992 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2217 Lines: 55 On 2011-05-05 09:20, Lukas Czerner wrote: > On Mon, 2 May 2011, Jens Axboe wrote: > >> On 2011-05-02 08:17, Lukas Czerner wrote: >>> Currently we are waiting for every submitted REQ_DISCARD bio separately, >>> but it can have unwanted consequences of repeatedly flushing the queue, >>> so we rather submit bios in batches and wait for the entire batch, hence >>> narrowing the window of other ios going in. >>> >>> Use bio_batch_end_io() and struct bio_batch for that purpose, the same >>> is used by blkdev_issue_zeroout(). Also change bio_batch_end_io() so we >>> always set !BIO_UPTODATE in the case of error and remove the check for >>> bb, since we are the only user of this function and we always set this. >>> >>> Remove bio_get()/bio_put() from the blkdev_issue_discard() since >>> bio_alloc() and bio_batch_end_io() is doing the same thing, hence it is >>> not needed anymore. >>> >>> I have done simple dd testing with surprising results. The script I have >>> used is: >>> >>> for i in $(seq 10); do >>> echo $i >>> dd if=/dev/sdb1 of=/dev/sdc1 bs=4k & >>> sleep 5 >>> done >>> /usr/bin/time -f %e ./blkdiscard /dev/sdc1 >>> >>> Running time of BLKDISCARD on the whole device: >>> with patch without patch >>> 0.95 15.58 >>> >>> So we can see that in this artificial test the kernel with the patch >>> applied is approx 16x faster in discarding the device. >> >> Good results. It'd be more efficient to add the vectored discard support >> and use it for this too though, and it would get rid of the need to wait >> on the batches since there'd be just one discard bio for the ranges. >> > > Since we do not have vectored discard yet, can this change go in as it > is ? Also, Christoph thinks that it would not help anyway since the we do > batch the discard requests only when it exceeds the max range. Sure, it need not be a show stopper. I will apply 1-2 for now to for-2.6.40/core. -- Jens Axboe -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/