Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 2 Feb 2023 08:17:09 -0800
From:      Bakul Shah <bakul@iitbombay.org>
To:        jbo@insane.engineer
Cc:        "hackers@freebsd.org" <hackers@freebsd.org>
Subject:   Re: Swap, ZFS & ARC
Message-ID:  <3DEFA166-79E8-49AD-B0DD-7E524C8EAAE8@iitbombay.org>
In-Reply-To: <ysSGWaXF7vCDubzgFdov_9k6SMLNdZ3-zHV-2LOraYOxV_8yoAkDVPqDSicYsgBw1KdL6BjP4FkK1KFs7NKZ4RRXcSDxVe_Qy_i7b_5AbSI=@insane.engineer>
References:  <ysSGWaXF7vCDubzgFdov_9k6SMLNdZ3-zHV-2LOraYOxV_8yoAkDVPqDSicYsgBw1KdL6BjP4FkK1KFs7NKZ4RRXcSDxVe_Qy_i7b_5AbSI=@insane.engineer>

next in thread | previous in thread | raw e-mail | index | archive | help

--Apple-Mail=_3A2A755A-EAD4-4C04-ADE4-2E010592DBA9
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=us-ascii


On Feb 2, 2023, at 6:28 AM, jbo@insane.engineer wrote:
>=20
> Hello folks,
>=20
> 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.
>=20
> 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. If this data then gets accessed, it =
might be cached by ARC essentially eating up memory again which seems =
counter productive.
> Is there any magic which prevents swap partitions from being loaded =
into ARC? Or is this a non-issue for some other reason?

I suspect this bug affects FreeBSD as well:

https://github.com/openzfs/zfs/issues/7734

=46rom https://github.com/openzfs/zfs/issues/7734#issuecomment-422082279

I'm not an expert in this area of the code, but I think that swap on =
ZVOL is inherently unreliable due to writes to the swap ZVOL having to =
go through the normal TXG sync and ZIO write paths, which can require =
lots of memory allocations by design (and these memory allocations can =
stall due to a low memory situation). I believe this to be true for swap =
on ZVOL for illumos, as well as Linux, and presumably FreeBSD too =
(although I have no experience using it on FreeBSD, so I could be =
wrong).

FYI. I don't know enough about zfs internals so can't say if this poster =
is right or not but I too have just used a disk partition as opposed to =
a zvolume for swap.=

--Apple-Mail=_3A2A755A-EAD4-4C04-ADE4-2E010592DBA9
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
	charset=us-ascii

<html><head><meta http-equiv=3D"content-type" content=3D"text/html; =
charset=3Dus-ascii"></head><body style=3D"overflow-wrap: break-word; =
-webkit-nbsp-mode: space; line-break: =
after-white-space;"><div><br></div>On Feb 2, 2023, at 6:28 AM, =
jbo@insane.engineer wrote:<br><blockquote type=3D"cite"><br =
class=3D"Apple-interchange-newline">Hello folks,<br><br>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.<br><br>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. If this data then gets accessed, it might be =
cached by ARC essentially eating up memory again which seems counter =
productive.<br>Is there any magic which prevents swap partitions from =
being loaded into ARC? Or is this a non-issue for some other =
reason?<br></blockquote><br>I suspect this bug affects FreeBSD as =
well:<div><br>https://github.com/openzfs/zfs/issues/7734<br><br>From&nbsp;=
https://github.com/openzfs/zfs/issues/7734#issuecomment-422082279<br><br><=
blockquote style=3D"margin: 0 0 0 40px; border: none; padding: =
0px;"><div>I'm not an expert in this area of the code, but I think that =
swap on ZVOL is inherently unreliable due to writes to the swap ZVOL =
having to go through the normal TXG sync and ZIO write paths, which can =
require lots of memory allocations by design (and these memory =
allocations can stall due to a low memory situation). I believe this to =
be true for swap on ZVOL for illumos, as well as Linux, and presumably =
FreeBSD too (although I have no experience using it on FreeBSD, so I =
could be wrong).</div></blockquote><br><div>FYI. I don't know enough =
about zfs internals so can't say if this poster is right or not but I =
too have just used a disk partition as opposed to a zvolume for =
swap.</div></div></body></html>=

--Apple-Mail=_3A2A755A-EAD4-4C04-ADE4-2E010592DBA9--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3DEFA166-79E8-49AD-B0DD-7E524C8EAAE8>