Date: Tue, 8 Feb 2011 23:37:21 +0200 From: Kostik Belousov <kostikbel@gmail.com> To: Emil Muratov <gpm@hotplug.ru> Cc: freebsd-fs@freebsd.org Subject: Re: Memory leak in ZFS? Message-ID: <20110208213721.GE78089@deviant.kiev.zoral.com.ua> In-Reply-To: <op.vqlsazg6aevz08@ghost-pc.home.lan> References: <AANLkTi=8fFwiaQ4%2Bm_cWFkXwpa4_W0_DDV2aW8vyNU4E@mail.gmail.com> <op.vqjyb21daevz08@ghost-pc.home.lan> <4D510BBB.1060708@kkip.pl> <20110208102727.GA8555@icarus.home.lan> <4D511F65.2050503@kkip.pl> <4D519F97.2000805@kkip.pl> <20110208203653.GC78089@deviant.kiev.zoral.com.ua> <op.vqlsazg6aevz08@ghost-pc.home.lan>
next in thread | previous in thread | raw e-mail | index | archive | help
--g7y1ijQH9DuGXLTD
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
On Wed, Feb 09, 2011 at 12:22:01AM +0300, Emil Muratov wrote:
> >Try this. I the similar fix is needed for tmpfs, but there are some
> >more issues and pending rewrite, so I decided not to touch it.
> >
> >commit 8e5885bce1afecd419e40240a2d7ab90deb0392a
> >Author: Konstantin Belousov <kostik@pooma.home>
> >Date: Tue Feb 8 22:35:29 2011 +0200
> >
> > Do not forget to activate the page
> >
> >diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c =
=20
> >b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
> >index e8191b3..7343c72 100644
> >--- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
> >+++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
>=20
>=20
> What is this patch up against? I can't apply it to the STABLE. :(
HEAD.
I adopted the patch to stable/8, but did not even compiled it.
Index: cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c (revision 218456)
+++ cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c (working copy)
@@ -347,6 +347,9 @@ page_unlock(vm_page_t pp)
{
=20
vm_page_wakeup(pp);
+ vm_page_lock_queues();
+ vm_page_activate(pp);
+ vm_page_unlock_queues();
}
=20
static caddr_t
@@ -465,7 +468,7 @@ again:
if (error =3D=3D 0)
uiomove_fromphys(&m, off, bytes, uio);
VM_OBJECT_LOCK(obj);
- vm_page_wakeup(m);
+ page_unlock(m);
} else if (uio->uio_segflg =3D=3D UIO_NOCOPY) {
/*
* The code below is here to make sendfile(2) work
@@ -504,10 +507,16 @@ again:
zfs_unmap_page(sf);
}
VM_OBJECT_LOCK(obj);
- if (error =3D=3D 0)
- m->valid =3D VM_PAGE_BITS_ALL;
vm_page_io_finish(m);
+ vm_page_lock_queues();
if (error =3D=3D 0) {
+ m->valid =3D VM_PAGE_BITS_ALL;
+ vm_page_activate(m);
+ } else
+ vm_page_free(m);
+ vm_page_unlock_queues();
+
+ if (error =3D=3D 0) {
uio->uio_resid -=3D bytes;
uio->uio_offset +=3D bytes;
}
--g7y1ijQH9DuGXLTD
Content-Type: application/pgp-signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (FreeBSD)
iEYEARECAAYFAk1Rt5EACgkQC3+MBN1Mb4gBrACfYLFi1Ynk7Xi5WgF7A0WfNguT
hFIAnRTy4cJuvwUBUEnKbjJFyEGbqibH
=ecGZ
-----END PGP SIGNATURE-----
--g7y1ijQH9DuGXLTD--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110208213721.GE78089>
