From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mark B Subject: Re: same page access Date: Wed, 22 Oct 2003 19:09:58 +0200 Sender: linux-fsdevel-owner@vger.kernel.org Message-ID: <200310221909.58066.mark@lemna.hr> References: <1065553341.8172.45.camel@patehci2> <200310221015.17946.mark@lemna.hr> <20031022112128.GN18370@parcelfarce.linux.theplanet.co.uk> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Cc: linux-fsdevel@vger.kernel.org Return-path: Received: from as102.hinet.hr ([195.29.150.42]:63248 "EHLO as102.htnet.hr") by vger.kernel.org with ESMTP id S263489AbTJVRES (ORCPT ); Wed, 22 Oct 2003 13:04:18 -0400 To: Matthew Wilcox In-Reply-To: <20031022112128.GN18370@parcelfarce.linux.theplanet.co.uk> Content-Disposition: inline List-Id: linux-fsdevel.vger.kernel.org On Wednesday 22 October 2003 13:21, you wrote: > On Wed, Oct 22, 2003 at 10:15:17AM +0200, Mark B wrote: > > I usually dig around kernel code to find answers, but I think this would > > take alot more time to dig than to explain from someone. > > > > Process 1 opens a file x, and does a read on the first few bytes, which > > in turn causes kernel to load the first page from the file (if the > > filesystem is using address_space_operations for all of it's access to > > files) > > Now a process 2 opens the same file and overwrites a few first bytes. > > > > Now, how does the kernel update the Process 1's page if it is already > > loaded? > > It doesn't. A subsequent write() to a file doesn't affect any previous > read()s by this or any other process. The situation is diferent if > you're talking about mmap(), but as far as I can tell, you aren't. Mmm sorry I formulated the question a bit wrong, here's the correction; I know that the data what was read() before the write() can't be affected, it's a perfectly normal condition, but I'm talking about the page of data the kernel loaded in the VFS for that file handle, is the data the same copy of data that is served to other processes? So a read() by P1 after P2 has did a write() in the same area, will it lead to a reload of the page since the P2 marked the area dirty? Or simply they're working on the same memory page? Is there any locking (by commit_write()?) Mark -- Mark Burazin mark@lemna.hr ---<>---<>---<>---<>---<>---<>---<>---<>---<> Lemna d.o.o. http://www.lemna.biz - info@lemna.hr <>---<>---<>---<>---<>---<>---<>---<>---<>---