From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JyskS-0002mV-Qh for qemu-devel@nongnu.org; Wed, 21 May 2008 14:09:12 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JyskR-0002kX-DQ for qemu-devel@nongnu.org; Wed, 21 May 2008 14:09:12 -0400 Received: from [199.232.76.173] (port=38882 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JyskR-0002kE-7H for qemu-devel@nongnu.org; Wed, 21 May 2008 14:09:11 -0400 Received: from host36-195-149-62.serverdedicati.aruba.it ([62.149.195.36]:57607 helo=mx.cpushare.com) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JyskR-0003uD-15 for qemu-devel@nongnu.org; Wed, 21 May 2008 14:09:11 -0400 Date: Wed, 21 May 2008 20:08:52 +0200 From: Andrea Arcangeli Subject: Re: [Qemu-devel] Re: [PATCH][v2] Align file accesses with cache=off (O_DIRECT) Message-ID: <20080521180852.GI22488@duo.random> References: <48343106.4070801@codemonkey.ws> <48343844.1050107@qumranet.com> <20080521153454.GB20527@shareable.org> <48344793.2020902@codemonkey.ws> <20080521162406.GA21501@shareable.org> <48345258.9040004@qumranet.com> <20080521170129.GF22488@duo.random> <48345949.4050903@qumranet.com> <20080521174754.GG22488@duo.random> <483461B0.20709@codemonkey.ws> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <483461B0.20709@codemonkey.ws> Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: Blue Swirl , Laurent Vivier , qemu-devel@nongnu.org, Paul Brook On Wed, May 21, 2008 at 12:53:52PM -0500, Anthony Liguori wrote: > MAP_SHARED cannot be done transparently to the guest, that's the motivating > reason behind MAP_PRIVATE. Could you elaborate on what means 'done transparently'? The only difference is for writes. When guest writes MAP_PRIVATE will copy-on-write. How can it be good if guest generates many copy-on-writes and eliminates the cache from the mapping and replaces it with anonymous memory? I can't see how MAP_PRIVATE could replace O_DIRECT, there's no way to write anything to disk with MAP_PRIVATE, msync on a MAP_PRIVATE is a pure overhead noop for example, only MAP_SHARED has a chance to modify any bit present on disk and it'll require msync at least every time the host OS waits for I/O completion and assumes the journal metadata/data is written on disk. The real good thing I see of MAP_PRIVATE/MAP_SHARED vs O_DIRECT, is that the guest would boot the second time without triggering reads from disks. But after guest is booted, the runtime of the guest is likely going to be better with O_DIRECT, the guest has its own filesystem caches in the guest memory, replicating them shouldn't pay off significantly for the guest runtime even on a laptop, and it provides disavantages in the host by polluting host caches already existing in the guest, and it'll decrease fairness of the system, without mentioning the need of msync for journaling. So besides the initial boot time I don't see many advantages for MAP_PRIVATE/MAP_SHARED at least unless you're running msdos ;).