From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754585AbZHOAit (ORCPT ); Fri, 14 Aug 2009 20:38:49 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752765AbZHOAis (ORCPT ); Fri, 14 Aug 2009 20:38:48 -0400 Received: from mail-yx0-f175.google.com ([209.85.210.175]:65388 "EHLO mail-yx0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750851AbZHOAiq convert rfc822-to-8bit (ORCPT ); Fri, 14 Aug 2009 20:38:46 -0400 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=ceIK0UUZTKmU6BMhnaSqY9GRPSu2L7oY00nvABHJLsyR2WUAo1bAWYIZtgSaR1Ngry MWX5E6Ikhp110Hfe+iD7EEpJtVT8NEDs8cnj2DDOyhON7zQd8Z1SDw5GNDPghoTd35Jc tEm4/lpfktlYY5MsSPgP0d9bMRR/CsBMkCswY= MIME-Version: 1.0 In-Reply-To: <87f94c370908141730y3ddcb7bbj65d24b612fc0e96d@mail.gmail.com> References: <200908122007.43522.ngupta@vflare.org> <87f94c370908131115r680a7523w3cdbc78b9e82373c@mail.gmail.com> <3e8340490908131354q167840fcv124ec56c92bbb830@mail.gmail.com> <4A85E0DC.9040101@rtr.ca> <20090814234539.GE27148@parisc-linux.org> <87f94c370908141730y3ddcb7bbj65d24b612fc0e96d@mail.gmail.com> Date: Fri, 14 Aug 2009 18:38:47 -0600 Message-ID: Subject: Re: Discard support (was Re: [PATCH] swap: send callback when swap slot is freed) From: Chris Worley To: Greg Freemyer Cc: Matthew Wilcox , Mark Lord , Bryan Donlan , david@lang.hm, Markus Trippelsdorf , Matthew Wilcox , Hugh Dickins , Nitin Gupta , Ingo Molnar , Peter Zijlstra , linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-scsi@vger.kernel.org, linux-ide@vger.kernel.org, Linux RAID Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 14, 2009 at 6:30 PM, Greg Freemyer wrote: > On Fri, Aug 14, 2009 at 8:19 PM, Chris Worley wrote: >> On Fri, Aug 14, 2009 at 5:45 PM, Matthew Wilcox wrote: >>> On Fri, Aug 14, 2009 at 05:21:32PM -0600, Chris Worley wrote: >>>> Sooner is better than waiting to coalesce.  The longer an LBA is >>>> inactive, the better for any management scheme.  If you wait until >>>> it's reused, you might as well forgo the advantages of TRIM/UNMAP.  If >>>> a the controller wants to coalesce, let it coalesce. >>> >>> I'm sorry, you're wrong.  There is a tradeoff point, and it's different >>> for each drive model.  Sending down a steady stream of tiny TRIMs is >>> going to give terrible performance. >> >> Sounds like you might be using junk for a device? >> >> For junk, a little coalescing may be warranted... like in the I/O >> schedular, but no more than 100usecs wait before posting, or then you >> effect high performing devices too. >> >> Chris > > Why? > > AIUI, on every write a high performing device allocates a new erase > block from its free lists, writes to it, and puts the now unused erase > block on the free list. So erase blocks are 512 bytes (if I write 512 bytes, an erase block is now freed)? Not true. >  That erase block becomes available for reuse > some milliseconds later. > > As long as the SSD has enough free erase blocks to work with I see no > disadvantage in delaying a discard by minutes, hours or days in most > cases.  The exception is when the filesystem is almost full and the > SSD is short of erase blocks to work with. That "exception..." is another good reason why. > > In that case it will want to get as many free erase blocks as it can > as fast as it can get them. Exactly. Chris > > Greg >