From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matthew Wilcox Subject: Re: Where does a process wait after requesting some data file ? Date: Thu, 15 Jan 2009 07:00:13 -0700 Message-ID: <20090115140013.GC29283@parisc-linux.org> References: <38b2ab8a0901150550w7106f6ebwa7ae36f6f0d9ad3d@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-fsdevel@vger.kernel.org To: Francis Moreau Return-path: Received: from palinux.external.hp.com ([192.25.206.14]:40343 "EHLO mail.parisc-linux.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755004AbZAOOAO (ORCPT ); Thu, 15 Jan 2009 09:00:14 -0500 Content-Disposition: inline In-Reply-To: <38b2ab8a0901150550w7106f6ebwa7ae36f6f0d9ad3d@mail.gmail.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Thu, Jan 15, 2009 at 02:50:27PM +0100, Francis Moreau wrote: > Let's say that a process wants to read a page of data stored in a file. > For that it issues a sys_read(). > > Now the data page is not in the page cache and it must be fetched from > the disk. > > So I assume while the data page is recovered from the disk, the process > is suspended until the data are ready to be read. > > Could anybody show me where in the source code where the process is > suspended ? Sure. Take a look in mm/filemap.c. Filesystems that use the page cache will usually end up calling do_generic_file_read() one way or another. It tries to find the page in the page cache, when it doesn't find the page, it creates it, then calls ->readpage() to start the read, and lock_page_killable() to wait for the page to be read. As the comment says, when the read finishes, it will unlock the page and the reader will continue. -- Matthew Wilcox Intel Open Source Technology Centre "Bill, look, we understand that you're interested in selling us this operating system, but compare it to ours. We can't possibly take such a retrograde step."