From owner-freebsd-fs@freebsd.org Sat Aug 8 10:29:13 2015 Return-Path: Delivered-To: freebsd-fs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 741079B5D8B for ; Sat, 8 Aug 2015 10:29:13 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id 5967BE9F for ; Sat, 8 Aug 2015 10:29:13 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: by mailman.ysv.freebsd.org (Postfix) id 565319B5D8A; Sat, 8 Aug 2015 10:29:13 +0000 (UTC) Delivered-To: fs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 55EA69B5D89 for ; Sat, 8 Aug 2015 10:29:13 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C76E3E9E for ; Sat, 8 Aug 2015 10:29:12 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id t78AT27l005719 (version=TLSv1 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Sat, 8 Aug 2015 13:29:02 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua t78AT27l005719 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id t78AT0Nn005718; Sat, 8 Aug 2015 13:29:00 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 8 Aug 2015 13:29:00 +0300 From: Konstantin Belousov To: Willem Jan Withagen Cc: fs@freebsd.org Subject: Re: Using SSDs as swap Message-ID: <20150808102900.GA2072@kib.kiev.ua> References: <55C5D48E.6010605@digiware.nl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <55C5D48E.6010605@digiware.nl> User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Aug 2015 10:29:13 -0000 On Sat, Aug 08, 2015 at 12:06:06PM +0200, Willem Jan Withagen wrote: > one of the following commits just passed with this in the log, and it > triggered again a question I've been having for some time again already. > > ---- > Log: > Enable BIO_DELETE passthru in GELI, so TRIM/UNMAP can work as expected > when > GELI is used on a SSD or inside virtual machine, so that guest can tell > host that it is no longer using some of the storage. > ----- > > In ZFS I slice my SSD's into log and caches, but on a a server with > little memory (which can't be grown) I use a partion on each ssd as swap > as well. So swappinging does not have to seek, and has faster loading > time. To allocate a few GB on aan SSD to swap is not really all that > painfull, given current sizes, but the speed difference with regular > spindels is impressive. > > But the questions are: > 1) Does the swap driver understand that backing-store needs a TRIM? No. > 1a) if not would it be useful, and what would it take to implement? One good thing is that it is simply the question of coding: the VM already has a place where it informs the swap pager that the page copy in swap is no longer needed. this is the vm_pager_page_unswapped() call and swap pager method swap_pager_unswapped(). swp_pager_meta_ctl() would need to issue BIO_DELETE to the backing storage. On the other hand, note that this would increase the amount of work performed, even for the swap volumes located on the rotating media, which is more typical and reasonable setup. I think an implementation and a knob to turn it off, or configure per swap partition, would be reasonable. > 2) Does the SSD "suffer" unneeded from swapping on it? Depends on your swapping activity, but yes, I believe that intense swapping would wear SSD in the short time.