Date: Sat, 8 Aug 2015 20:51:29 +0200 From: Willem Jan Withagen <wjw@digiware.nl> To: Konstantin Belousov <kostikbel@gmail.com>, Warren Block <wblock@wonkity.com> Cc: fs@freebsd.org Subject: Re: Using SSDs as swap Message-ID: <55C64FB1.9070402@digiware.nl> In-Reply-To: <20150808183234.GG2072@kib.kiev.ua> References: <55C5D48E.6010605@digiware.nl> <20150808102900.GA2072@kib.kiev.ua> <55C5E34B.9010905@digiware.nl> <20150808113750.GC2072@kib.kiev.ua> <55C60441.7040906@digiware.nl> <alpine.BSF.2.20.1508081222371.53526@wonkity.com> <20150808183234.GG2072@kib.kiev.ua>
next in thread | previous in thread | raw e-mail | index | archive | help
On 8-8-2015 20:32, Konstantin Belousov wrote: > On Sat, Aug 08, 2015 at 12:26:38PM -0600, Warren Block wrote: >> On Sat, 8 Aug 2015, Willem Jan Withagen wrote: >>> >>> So perhaps the nicest thing to do for the SSDs is TRIM swap at >>> startup??? So the the SSD controller van do its garbage collection and >>> then keep the remainder of the stuff as it is. >> >> This can be done now by using a swap file on a UFS partition with trim >> enabled. The catch is that the swap file has to be deleted and >> recreated to trigger the trim. The delete is quick, but the create >> depends on the size of the file and the speed of the hardware. (And no, >> sparse files do not work as swap files.) > This could work, in the sense that swap would indeed work as a swap, > and not as a deadlock generator. But it adds very significant (up to > 100% in the CPU time, I think) overhead. > > Note that you cannot swap to file directly, you must create md(4) over > the file and swap to it. > > But doing such layer over layer to get the TRIM is somewhat silly. Right, added layering is not really something you'd be looking for here. We talking about incidental swapping to SSD, so then the system is already under pressure. >> Maybe rotate swap files like log files, so they could be created when >> the system is idle. 'mmm, once swap is in use, I do not think you can unswap? So even if the sytem is idle, was was not swapped back in because it is needed stays out on swap. Look at my curent swap on a ZFS file server, I added 2 SSDs partitions about 1,2 ago. But even the old swap was not released.... { swap on SSD's are on ad{2,3}p2 } Device 1K-blocks Used Avail Capacity /dev/ada2p2 8388608 122M 7.9G 1% /dev/ada3p2 8388608 123M 7.9G 2% /dev/gpt/swap0 8388608 4.6M 8.0G 0% /dev/gpt/swap1 8388608 5.0M 8.0G 0% Total 33554432 255M 32G 1% (Yes, I realise that 32Gb swap for a 8Gb system is somewhat silly) Different idea if we do not want to TRIM from the kernel when issueing swapon: Would it be possible to use camcontrol to issue a "trim" on a (GPT) swap partition? Or does gpart anything that could be conceived as a TRIM. Because then the initscript would first check for saved cores, and once done that trim the swappartition with a commandline tool? --WjW
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?55C64FB1.9070402>