diff options
Diffstat (limited to 'mm/memory.c')
-rw-r--r-- | mm/memory.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/mm/memory.c b/mm/memory.c index e83f9440bb66..7893eb4bb8c0 100644 --- a/mm/memory.c +++ b/mm/memory.c | |||
@@ -340,8 +340,6 @@ static inline void add_mm_rss(struct mm_struct *mm, int file_rss, int anon_rss) | |||
340 | add_mm_counter(mm, anon_rss, anon_rss); | 340 | add_mm_counter(mm, anon_rss, anon_rss); |
341 | } | 341 | } |
342 | 342 | ||
343 | #define NO_RSS 2 /* Increment neither file_rss nor anon_rss */ | ||
344 | |||
345 | /* | 343 | /* |
346 | * This function is called to print an error when a pte in a | 344 | * This function is called to print an error when a pte in a |
347 | * !VM_RESERVED region is found pointing to an invalid pfn (which | 345 | * !VM_RESERVED region is found pointing to an invalid pfn (which |
@@ -368,16 +366,15 @@ void print_bad_pte(struct vm_area_struct *vma, pte_t pte, unsigned long vaddr) | |||
368 | * but may be dropped within p[mg]d_alloc() and pte_alloc_map(). | 366 | * but may be dropped within p[mg]d_alloc() and pte_alloc_map(). |
369 | */ | 367 | */ |
370 | 368 | ||
371 | static inline int | 369 | static inline void |
372 | copy_one_pte(struct mm_struct *dst_mm, struct mm_struct *src_mm, | 370 | copy_one_pte(struct mm_struct *dst_mm, struct mm_struct *src_mm, |
373 | pte_t *dst_pte, pte_t *src_pte, struct vm_area_struct *vma, | 371 | pte_t *dst_pte, pte_t *src_pte, struct vm_area_struct *vma, |
374 | unsigned long addr) | 372 | unsigned long addr, int *rss) |
375 | { | 373 | { |
376 | unsigned long vm_flags = vma->vm_flags; | 374 | unsigned long vm_flags = vma->vm_flags; |
377 | pte_t pte = *src_pte; | 375 | pte_t pte = *src_pte; |
378 | struct page *page; | 376 | struct page *page; |
379 | unsigned long pfn; | 377 | unsigned long pfn; |
380 | int anon = NO_RSS; | ||
381 | 378 | ||
382 | /* pte contains position in swap or file, so copy. */ | 379 | /* pte contains position in swap or file, so copy. */ |
383 | if (unlikely(!pte_present(pte))) { | 380 | if (unlikely(!pte_present(pte))) { |
@@ -428,11 +425,10 @@ copy_one_pte(struct mm_struct *dst_mm, struct mm_struct *src_mm, | |||
428 | pte = pte_mkold(pte); | 425 | pte = pte_mkold(pte); |
429 | get_page(page); | 426 | get_page(page); |
430 | page_dup_rmap(page); | 427 | page_dup_rmap(page); |
431 | anon = !!PageAnon(page); | 428 | rss[!!PageAnon(page)]++; |
432 | 429 | ||
433 | out_set_pte: | 430 | out_set_pte: |
434 | set_pte_at(dst_mm, addr, dst_pte, pte); | 431 | set_pte_at(dst_mm, addr, dst_pte, pte); |
435 | return anon; | ||
436 | } | 432 | } |
437 | 433 | ||
438 | static int copy_pte_range(struct mm_struct *dst_mm, struct mm_struct *src_mm, | 434 | static int copy_pte_range(struct mm_struct *dst_mm, struct mm_struct *src_mm, |
@@ -441,7 +437,7 @@ static int copy_pte_range(struct mm_struct *dst_mm, struct mm_struct *src_mm, | |||
441 | { | 437 | { |
442 | pte_t *src_pte, *dst_pte; | 438 | pte_t *src_pte, *dst_pte; |
443 | int progress = 0; | 439 | int progress = 0; |
444 | int rss[NO_RSS+1], anon; | 440 | int rss[2]; |
445 | 441 | ||
446 | again: | 442 | again: |
447 | rss[1] = rss[0] = 0; | 443 | rss[1] = rss[0] = 0; |
@@ -467,8 +463,7 @@ again: | |||
467 | progress++; | 463 | progress++; |
468 | continue; | 464 | continue; |
469 | } | 465 | } |
470 | anon = copy_one_pte(dst_mm, src_mm, dst_pte, src_pte, vma,addr); | 466 | copy_one_pte(dst_mm, src_mm, dst_pte, src_pte, vma, addr, rss); |
471 | rss[anon]++; | ||
472 | progress += 8; | 467 | progress += 8; |
473 | } while (dst_pte++, src_pte++, addr += PAGE_SIZE, addr != end); | 468 | } while (dst_pte++, src_pte++, addr += PAGE_SIZE, addr != end); |
474 | spin_unlock(&src_mm->page_table_lock); | 469 | spin_unlock(&src_mm->page_table_lock); |