Re: Atomic operation for physically moving a page

From: Valdis . Kletnieks
Date: Fri Jun 18 2004 - 20:10:06 EST


On Fri, 18 Jun 2004 17:37:12 PDT, Ashwin Rao <ashwin_s_rao@xxxxxxxxx> said:
> I want to copy a page from one physical location to
> another (taking the appr. locks).

At the risk of sounding stupid, what problem are you trying to solve by copying
a page? Not only (as you note) could the page be referenced by multiple
processes, it could (conceivably) belong to a kernel slab or something, or be a
buffer for an in-flight I/O request, or any number of other possibly-racy
situations.

If it's only a specific *type* of page, or explaining why you're trying to do
it, or what timing/etc constraints you have (if it's a sufficiently rare(*) case,
it might make sense to just grab the BKL and copy the page with a memcpy().)

(*) Yes, I know the BKL isn't something you want to grab if you can help it.
However, if we're on an unlikely error path or similar and other options aren't suitable...

Attachment: pgp00000.pgp
Description: PGP signature