linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Dave Hansen <haveblue@us.ibm.com>
To: IWAMOTO Toshihiro <iwamoto@valinux.co.jp>
Cc: Hirokazu Takahashi <taka@valinux.co.jp>,
	ashwin_s_rao@yahoo.com, Valdis.Kletnieks@vt.edu,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	linux-mm <linux-mm@kvack.org>
Subject: Re: Atomic operation for physically moving a page (for memory	defragmentation)
Date: Thu, 24 Jun 2004 04:31:39 -0700	[thread overview]
Message-ID: <1088076699.3918.234.camel@nighthawk> (raw)
In-Reply-To: <20040624071959.B76D970A2D@sv1.valinux.co.jp>

On Thu, 2004-06-24 at 00:19, IWAMOTO Toshihiro wrote:
> 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 was talking about access to the pages through the user page tables,
only.  You can't really fully prevent other access to them, because some
other kernel user could always do something like kmap() and write to the
page.  There's probably some handy-dandy way to trap these kinds of
accesses in hardware, but Linux itself certainly can't provide that
guarantee without some restructuring to check for these areas any time
that a set_pte() is done.  

Remember, we don't do things like rmap for the *kernel* users of pages. 

> (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().

You'll also have a generic problem with anything that does DMA, or that
uses the kernel page tables of any kind (kmap, vmalloc, etc...).

The DMA problem is a lot easier when there's an IOMMU, and even easier
on a partitioned ppc64 system where we have a virtualization layer to
take care of any areas under DMA that might undergo remapping. 

-- Dave

--
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: <a href=mailto:"aart@kvack.org"> aart@kvack.org </a>

  reply	other threads:[~2004-06-24 11:31 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-19  0:37 Atomic operation for physically moving a page Ashwin Rao
2004-06-19  1:03 ` Valdis.Kletnieks
2004-06-19  2:53   ` Dave Hansen
2004-06-19  3:15   ` Atomic operation for physically moving a page (for memory defragmentation) Ashwin Rao
2004-06-19  3:34     ` Valdis.Kletnieks
2004-06-19  4:25     ` Dave Hansen
2004-06-23  9:04       ` IWAMOTO Toshihiro
2004-06-23 11:59       ` Hirokazu Takahashi
2004-06-23 20:56         ` Dave Hansen
2004-06-24  7:19           ` IWAMOTO Toshihiro
2004-06-24 11:31             ` Dave Hansen [this message]
2004-06-23 10:32     ` Hirokazu Takahashi
2004-06-19  2:43 ` Atomic operation for physically moving a page Dave Hansen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1088076699.3918.234.camel@nighthawk \
    --to=haveblue@us.ibm.com \
    --cc=Valdis.Kletnieks@vt.edu \
    --cc=ashwin_s_rao@yahoo.com \
    --cc=iwamoto@valinux.co.jp \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=taka@valinux.co.jp \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox