diff options
author | Dmitriy Monakhov <dmonakhov@openvz.org> | 2006-11-07 15:40:54 +0100 |
---|---|---|
committer | Adrian Bunk <bunk@stusta.de> | 2006-11-07 15:40:54 +0100 |
commit | 8bd3ff1d04183848b589c53e94e4467a83746c8f (patch) | |
tree | d13f06316472a45341da2a05e25634c2285b8c59 /mm | |
parent | de4fdc932162e6d9a1b350bd3536dc9ad2f1f5e3 (diff) |
from mm/memory.c:
1434 static inline void cow_user_page(struct page *dst, struct page *src, unsigned long va)
1435 {
1436 /*
1437 * If the source page was a PFN mapping, we don't have
1438 * a "struct page" for it. We do a best-effort copy by
1439 * just copying from the original user address. If that
1440 * fails, we just zero-fill it. Live with it.
1441 */
1442 if (unlikely(!src)) {
1443 void *kaddr = kmap_atomic(dst, KM_USER0);
1444 void __user *uaddr = (void __user *)(va & PAGE_MASK);
1445
1446 /*
1447 * This really shouldn't fail, because the page is there
1448 * in the page tables. But it might just be unreadable,
1449 * in which case we just give up and fill the result with
1450 * zeroes.
1451 */
1452 if (__copy_from_user_inatomic(kaddr, uaddr, PAGE_SIZE))
1453 memset(kaddr, 0, PAGE_SIZE);
1454 kunmap_atomic(kaddr, KM_USER0);
#### D-cache have to be flushed here.
#### It seems it is just forgotten.
1455 return;
1456
1457 }
1458 copy_user_highpage(dst, src, va);
#### Ok here. flush_dcache_page() called from this func if arch need it
1459 }
Signed-off-by: Dmitriy Monakhov <dmonakhov@openvz.org>
Acked-by: David Miller <davem@davemloft.net>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/memory.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/mm/memory.c b/mm/memory.c index 85e80a57db2..a4caa2f223e 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -1418,6 +1418,7 @@ static inline void cow_user_page(struct page *dst, struct page *src, unsigned lo if (__copy_from_user_inatomic(kaddr, uaddr, PAGE_SIZE)) memset(kaddr, 0, PAGE_SIZE); kunmap_atomic(kaddr, KM_USER0); + flush_dcache_page(dst); return; } |