From owner-freebsd-fs@FreeBSD.ORG Tue Feb 8 21:37:26 2011 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 18700106566B for ; Tue, 8 Feb 2011 21:37:26 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id A6EAE8FC18 for ; Tue, 8 Feb 2011 21:37:25 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id p18LbLLc083154 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 8 Feb 2011 23:37:21 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4) with ESMTP id p18LbL8X086125; Tue, 8 Feb 2011 23:37:21 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id p18LbL2M086124; Tue, 8 Feb 2011 23:37:21 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 8 Feb 2011 23:37:21 +0200 From: Kostik Belousov To: Emil Muratov Message-ID: <20110208213721.GE78089@deviant.kiev.zoral.com.ua> References: <4D510BBB.1060708@kkip.pl> <20110208102727.GA8555@icarus.home.lan> <4D511F65.2050503@kkip.pl> <4D519F97.2000805@kkip.pl> <20110208203653.GC78089@deviant.kiev.zoral.com.ua> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="g7y1ijQH9DuGXLTD" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-3.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00, DNS_FROM_OPENWHOIS autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: freebsd-fs@freebsd.org Subject: Re: Memory leak in ZFS? X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Feb 2011 21:37:26 -0000 --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 > >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--