From owner-freebsd-fs@freebsd.org Wed Aug 26 00:35:51 2020 Return-Path: Delivered-To: freebsd-fs@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 736723C2B2D for ; Wed, 26 Aug 2020 00:35:51 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qk1-x72a.google.com (mail-qk1-x72a.google.com [IPv6:2607:f8b0:4864:20::72a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Bbn2s6vLpz4Pkg for ; Wed, 26 Aug 2020 00:35:49 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qk1-x72a.google.com with SMTP id g26so435899qka.3 for ; Tue, 25 Aug 2020 17:35:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=P4u62pshsC6POJDUgAjwHHpvMUMY6DW+4S1Vy0E+l0k=; b=gHxKzvDNG8MjG116KNlLi+Q825vofgbAASDhfWidvxW5lMJxBEhBC40XB8RI6I6OEq b78w8BPU19iE4yf21qJ1lsQnlzWWG3sthORPDORl4fAc2dGYFPVmqXTrCEcv0Ww9JkXg cpujehy4gg2+ydKtkReCSN0GqXd1fhju/FGX/iRmPvPGVknbTMezecZIwm8lm5g5VP86 lpmkfYRR5BXU87gqv0Sp6b1aO1OFjCCl5+oM1PV1cSjegeOot3uCX8GPYtHEOjWQwsRU sLG6I4gQ7te7TNXhFUJOYHgFCqroQ4TAv4vPIuoLKXG6Tix5f/3IJRJyqBGDQzYGEbqe lRZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=P4u62pshsC6POJDUgAjwHHpvMUMY6DW+4S1Vy0E+l0k=; b=ZUEp2sQTpOl0+6zV/Z3PNW2H8oe2YWA0Eovkgu4j5DAwMDkzjxIVO2IAcGWt6aTps6 /GeGrs910dXlWC/URztz0THohsMD3yE95mrXNVNq+SWROMPw2Tm4MEktpWS/LF7e+MfZ umMQWVEdWHBJB1auJs7k9frFlXMnxUStjan1VHIKcP/b8M/qU1U4Y6jQm1PXjEnr5InC BHMVX1R8Idg1V+ChqGmoalmze8Y0D50WfJ5GZ+nhTGLH1EUx6U9UsWgCXBK/1b+jaeZE 51ur+0Dy35Ct882ejQDhk+e6dfE+0ePAF+nladRUJH9kcAOZQeUVX3x8CflQrFkAYDeD FTWQ== X-Gm-Message-State: AOAM533bJYnQTidiWTYJ03m4G1861a0OHJzDUJadZauaMRyP6OmMChIQ NL9ScRqhyue+C8CeghgBclKQerB34p9bmmx8V4bVafINNuk= X-Google-Smtp-Source: ABdhPJyz5wP+YFSlW2l8NyDd+BS6DUrsFCwNUByFMp6FiEgLVFJxMXXTO3OA+OgWKIafTC1A5Al/BZbOYb+uULNSd5o= X-Received: by 2002:a05:620a:686:: with SMTP id f6mr12056281qkh.60.1598402148752; Tue, 25 Aug 2020 17:35:48 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Warner Losh Date: Tue, 25 Aug 2020 18:35:34 -0600 Message-ID: Subject: Re: Boot time TRIM ? To: Zaphod Beeblebrox Cc: freebsd-fs , FreeBSD Hackers X-Rspamd-Queue-Id: 4Bbn2s6vLpz4Pkg X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=gHxKzvDN; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::72a) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [0.97 / 15.00]; RCVD_TLS_ALL(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com:s=20150623]; NEURAL_HAM_MEDIUM(-0.12)[-0.122]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; NEURAL_SPAM_SHORT(0.09)[0.091]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-fs@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::72a:from]; R_SPF_NA(0.00)[no SPF record]; FREEMAIL_TO(0.00)[gmail.com]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; SUBJECT_ENDS_QUESTION(1.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; MAILMAN_DEST(0.00)[freebsd-fs]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.33 X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Aug 2020 00:35:51 -0000 On Tue, Aug 25, 2020, 2:02 PM Zaphod Beeblebrox wrote: > So, as I was looking at the performance of an NVME that I use for swap and > ZFS cache, I realized after reboot, that since ZFS cache doesn't survive > reboot and OBVIOUSLY swap doesn't, might it be best practice to issue a > TRIM on boot? > No. Large TRIMs suck on too many devices. It might be helpful on a few devices. Some SSDs I've used would take minutes to trim... Now... a trim on the whole device from userland before adding swap in RC... > might work. AFAIK, we still don't have any structure to swap before it's > added. Not quite. We have to avoid trimming the first 8k to avoid stepping on boot blocks. The rest would be fair game. I'm pretty sure this is not the right thing for ZFS cache and log > partitions, tho. > Likely. ZFS should likely trim the useless areas. Also, as a point of information, does ZFS issue TRIMs to the LOG after data > gets committed into a transaction? > As it opens up holes, it will trim. FreeBSD ZFS and OpenZFS have different trim strategies, though, and I've not studied OpenZFS well enough. The FreeBSD implementation schedules TRIMs in batches... I'm curious about this because for NVME that are a hybrid of different > storage --- commonly 10-20 percent faster MLC and 80 percent slower TLC (or > what-have-you) ... the TRIM usage can dramatically affect the performance. > Yes, but the answer is it depends. The drive's firmware manages these things. Usually the mlc/slc bits of the drive are reserved for a pool to write quickly to. Then the drive rewrites this data to TLC when the free pool of blocks gets small enough. I did some testing of this at work wrt swap, but we didn't swap enough for this to matter... Warner _______________________________________________ > freebsd-fs@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-fs > To unsubscribe, send any mail to "freebsd-fs-unsubscribe@freebsd.org" >