From mboxrd@z Thu Jan 1 00:00:00 1970 Date: Thu, 24 Jun 2004 16:19:59 +0900 From: IWAMOTO Toshihiro Subject: Re: Atomic operation for physically moving a page (for memory defragmentation) In-Reply-To: <1088024190.28102.24.camel@nighthawk> References: <20040619031536.61508.qmail@web10902.mail.yahoo.com> <1087619137.4921.93.camel@nighthawk> <20040623.205906.71913783.taka@valinux.co.jp> <1088024190.28102.24.camel@nighthawk> MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Message-Id: <20040624071959.B76D970A2D@sv1.valinux.co.jp> Sender: owner-linux-mm@kvack.org Return-Path: To: Dave Hansen Cc: Hirokazu Takahashi , ashwin_s_rao@yahoo.com, Valdis.Kletnieks@vt.edu, Linux Kernel Mailing List , linux-mm List-ID: At Wed, 23 Jun 2004 13:56:30 -0700, Dave Hansen wrote: > > On Wed, 2004-06-23 at 04:59, Hirokazu Takahashi wrote: > > We should know that many part of kernel code will access the page > > without holding a lock_page(). The lock_page() can't block them. > > No, but it will block them from establishing a new PTE to the page. You > need to: > > 1. make sure no new PTEs can be established to the page > 2. make sure there are no valid PTEs to the page. > 3. do the move > > My suggestion relates to 1, only. I wonder if you are talking exclusively about swap (anonymous) pages, where lock_page() might work. (I wonder why lock_page() is needed in do_swap_page(), btw.) For page caches, usually lock_page() cannot prevent accesses to them, and there are several kernel functions which don't need PTE mappings for access. One of such functions is do_generic_mapping_read(). -- IWAMOTO Toshihiro -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: aart@kvack.org