Re: Atomic operation for physically moving a page (for memory defragmentation)

From: IWAMOTO Toshihiro
Date: Thu Jun 24 2004 - 02:22:36 EST


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 from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/