From owner-freebsd-arch@FreeBSD.ORG Sat Feb 25 15:14:55 2012 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2C3941065675 for ; Sat, 25 Feb 2012 15:14:55 +0000 (UTC) (envelope-from pawel@dawidek.net) Received: from mail.dawidek.net (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id 8824A8FC13 for ; Sat, 25 Feb 2012 15:14:54 +0000 (UTC) Received: from localhost (89-73-195-149.dynamic.chello.pl [89.73.195.149]) by mail.dawidek.net (Postfix) with ESMTPSA id CC9F89DD; Sat, 25 Feb 2012 16:14:51 +0100 (CET) Date: Sat, 25 Feb 2012 16:13:34 +0100 From: Pawel Jakub Dawidek To: Attilio Rao Message-ID: <20120225151334.GH1344@garage.freebsd.pl> References: <20120203193719.GB3283@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="dDnEQgWzhgf+8aPe" Content-Disposition: inline In-Reply-To: X-OS: FreeBSD 10.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: Konstantin Belousov , arch@freebsd.org Subject: Re: Prefaulting for i/o buffers X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Feb 2012 15:14:55 -0000 --dDnEQgWzhgf+8aPe Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Feb 25, 2012 at 01:01:32PM +0000, Attilio Rao wrote: > Il 03 febbraio 2012 19:37, Konstantin Belousov ha s= critto: > > FreeBSD I/O infrastructure has well known issue with deadlock caused > > by vnode lock order reversal when buffers supplied to read(2) or > > write(2) syscalls are backed by mmaped file. > > > > I previously published the patches to convert i/o path to use VMIO, > > based on the Jeff Roberson proposal, see > > http://wiki.freebsd.org/VM6. As a side effect, the VM6 fixed the > > deadlock. Since that work is very intrusive and did not got any > > follow-up, it get stalled. > > > > Below is very lightweight patch which only goal is to fix deadlock in > > the least intrusive way. This is possible after FreeBSD got the > > vm_fault_quick_hold_pages(9) and vm_fault_disable_pagefaults(9) KPIs. > > http://people.freebsd.org/~kib/misc/vm1.3.patch >=20 > Hi, > I was reviewing: > http://people.freebsd.org/~kib/misc/vm1.11.patch >=20 > and I think it is great. It is simple enough and I don't have further > comments on it. >=20 > However, as a side note, I was thinking if we could get one day at the > point to integrate rangelocks into vnodes lockmgr directly. > It would be a huge patch, rewrtiting the locking of several members of > vnodes likely, but I think it would be worth it in terms of cleaness > of the interface and less overhead. Also, it would be interesting to > consider merging rangelock implementation in ZFS' one, at some point. I personal opinion about rangelocks and many other VFS features we currently have is that it is good idea in theory, but in practise it tends to overcomplicate VFS. I'm in opinion that we should move as much stuff as we can to individual file systems. We try to implement everything in VFS itself in hope that this will simplify file systems we have. It then turns out only one file system is really using this stuff (most of the time it is UFS) and this is PITA for all the other file systems as well as maintaining VFS. VFS became so complicated over the years that there are maybe few people that can understand it, and every single change to VFS is a huge risk of potentially breaking some unrelated parts. File systems most of the time know much better how they work and what should be done to make them optimal. For example ZFS had range locking =66rom day one, but we can't take advantage of this, because our VFS "knows better" how ZFS locking should be done. There plenty of examples: - range vnode locking, - shared vnode locking, - quota (which I believe is still part of UFS, but I remember ideas of moving it to VFS), - suspend/resume fs, - buffer cache, - vnodes reclamation. I'm sure there are other examples. In my opinion we should do whatever we can to simplify VFS. Having complex VFS makes it harder, _not_ easier to develop file systems for and port file systems to FreeBSD. Interaction with VFS was definiately the hardest part of my work to port ZFS to FreeBSD. --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://tupytaj.pl --dDnEQgWzhgf+8aPe Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (FreeBSD) iEYEARECAAYFAk9I+p4ACgkQForvXbEpPzQgHACfZaE1YXFSq/O7ry49e6kZ+dMr Fq0An28wA1tET0i4dA1GbvqYx0GhGPMS =oWR/ -----END PGP SIGNATURE----- --dDnEQgWzhgf+8aPe--