From nobody Thu Feb 02 16:49:39 2023 X-Original-To: hackers@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4P74X244Kvz3kM5l for ; Thu, 2 Feb 2023 16:49:54 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [IPv6:2a00:1450:4864:20::630]) (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 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4P74X215HWz3q2f for ; Thu, 2 Feb 2023 16:49:54 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-ej1-x630.google.com with SMTP id mc11so7640987ejb.10 for ; Thu, 02 Feb 2023 08:49:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=gE7ThT1KWpqlw+gTTZIL7C9BVutbs9mjO1A65zlTe5Y=; b=iJ7FOoI3sVbtKG/66BA0DligyJ2x/wHcnkfR4uRm1/Su6aQLdFLoGfm8BvlH2CAcFB CAJuMCYXvmVOxJWlJtwWa/fjzAN69mOc/FXFrrqn9NHnLGq1MG18jEx05mgfMNDFV3fv mt1CfDhKExd5l4WZvI2QCH2lBb+JpLnme16XPXAPWjLdI5Rt+5qBb5dvCkWU8mTenjhk Ds3++F/jvd1LpdKox+IThAjZ+vic9BVqKcyOIPvQ2cZxHMTHQ0nh7myVj+yKWkW5Yoxs mYVLv/VKkGtd2qYCeVzFwqa3UIVzyL2y5fRK65tr5PHvW+hY/wM+zwUxNiFj0bCGKG+K fnGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=gE7ThT1KWpqlw+gTTZIL7C9BVutbs9mjO1A65zlTe5Y=; b=Ei7+ZnXpKrLkfxAeV9RU/PDJzBipxjObIIi08lt+4iJWg9i2LyTZFwBNjSVTANrZ26 v8XT10tBzlKrNGuyTjUHSppcOJQfP+F0ZgInHigLIWL0zI5qWlIedOzvWPE/lr+PfzU7 Zfd1DFflU5QYouBM5fBpygdD2cGQybxqXABvs4sy6mL+vjcPL1rOVwr2q7Z5yUG0oVjV 1lpZtCnX4K/85KxckGXXS7jUkTZLVDcUU4FU7TGIBjHbSOqsRwgUfVpATJ1fLP0AiKaE pYEbh2etetXpus/3OsFHZM+dXX/tWPeM7JNksbGJ/w7CVLgNoDBFjjWiu4T471J4aMRn HwGg== X-Gm-Message-State: AO0yUKWngpn4JSN1eZ2Eu8biZcTk8ENe9nVPPp7BOKvawgzYCtgq/aNy LC9fzv7hZlncge9ugNyDnkup2k3c4up3HsJKgc8v9Gb5mildwQ== X-Google-Smtp-Source: AK7set9cQ3vmcenQMs97xsZ6DlM/LAxDUW9bk1CR9icOxQUwIS9Hu+cn2znuht74zDMwxRlp/5z57YwsqjW8Gb5cffo= X-Received: by 2002:a17:906:e09a:b0:877:ec5e:87ce with SMTP id gh26-20020a170906e09a00b00877ec5e87cemr2080783ejb.262.1675356591114; Thu, 02 Feb 2023 08:49:51 -0800 (PST) List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@freebsd.org MIME-Version: 1.0 References: <1689ba8c-a317-ce1f-2854-99566468a9ed@grosbein.net> In-Reply-To: <1689ba8c-a317-ce1f-2854-99566468a9ed@grosbein.net> From: Warner Losh Date: Thu, 2 Feb 2023 09:49:39 -0700 Message-ID: Subject: Re: Swap, ZFS & ARC To: Eugene Grosbein Cc: jbo@insane.engineer, "hackers@freebsd.org" Content-Type: multipart/alternative; boundary="0000000000007c5f6d05f3ba5acf" X-Rspamd-Queue-Id: 4P74X215HWz3q2f X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-ThisMailContainsUnwantedMimeParts: N --0000000000007c5f6d05f3ba5acf Content-Type: text/plain; charset="UTF-8" On Thu, Feb 2, 2023 at 7:42 AM Eugene Grosbein wrote: > 02.02.2023 21:28, jbo@insane.engineer wrote: > > Hello folks, > > > > Based on a discussion on the forums not so long ago I tried to figure > out how swap usage on a ZFS system plays together with ARC. However, I > could find very little to no information on this which leads me to believe > that there is some "core concept" I might be oblivious to. > > > > The main question is basically this: Your system starts to swap out data > from RAM to your swap partition. > > This swap data on disk ultimately resides somewhere in a ZFS pool. > > I prefer not doing this. That is, all my systems have swap partition > outside of ZFS pool. > I agree. Don't swap to anything but a raw partition if you have any way possible to avoid it. Swapping to anything ZFS provides is a bad idea because ZFS has to do memory allocations to do the I/O, which might not be possible when heavily swapping on a memory constrained system. If it can't allocate memory to do the swapping, it can't release the dirty memory that is being swapped out, possibly leading to deadlock. I actively avoid it unless there's no alternative, just like I actively avoid swapping to a file in a filesystem like UFS if I can avoid it too... Warner --0000000000007c5f6d05f3ba5acf Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
On Thu, Feb 2, 2023 at 7:42 AM Eugene= Grosbein <eugen@grosbein.net&= gt; wrote:
02.02= .2023 21:28, jbo@insane.engineer wrote:
> Hello folks,
>
> Based on a discussion on the forums not so long ago I tried to figure = out how swap usage on a ZFS system plays together with ARC. However, I coul= d find very little to no information on this which leads me to believe that= there is some "core concept" I might be oblivious to.
>
> The main question is basically this: Your system starts to swap out da= ta from RAM to your swap partition.
> This swap data on disk ultimately resides somewhere in a ZFS pool.

I prefer not doing this. That is, all my systems have swap partition outsid= e of ZFS pool.

I agree. Don't swap = to anything but a raw partition if you have any way possible to avoid it. S= wapping to anything ZFS provides is a bad idea because ZFS has to do memory= allocations to do the I/O, which might not be possible when heavily swappi= ng on a memory constrained system. If it can't allocate memory to do th= e swapping, it can't release the dirty memory that is being swapped out= , possibly leading to deadlock.

I actively avoid i= t unless there's no alternative, just like I actively avoid swapping to= a file in a filesystem like UFS if I can avoid it too...

Warner
--0000000000007c5f6d05f3ba5acf--