Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 11351
b: refs/heads/master
c: 861f2fb
h: refs/heads/master
i:
  11349: 02b8996
  11347: cda6cda
  11343: 313807d
v: v3
  • Loading branch information
Hugh Dickins authored and Linus Torvalds committed Oct 30, 2005
1 parent c714cdd commit 617ae2b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d0de32d9b71e11cc51618c2045086e9694093d01
refs/heads/master: 861f2fb8e796022b4928cab9c74fca6681a1c557
19 changes: 9 additions & 10 deletions trunk/mm/fremap.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,34 +20,32 @@
#include <asm/cacheflush.h>
#include <asm/tlbflush.h>

static inline void zap_pte(struct mm_struct *mm, struct vm_area_struct *vma,
static int zap_pte(struct mm_struct *mm, struct vm_area_struct *vma,
unsigned long addr, pte_t *ptep)
{
pte_t pte = *ptep;
struct page *page = NULL;

if (pte_none(pte))
return;
if (pte_present(pte)) {
unsigned long pfn = pte_pfn(pte);
struct page *page;

flush_cache_page(vma, addr, pfn);
pte = ptep_clear_flush(vma, addr, ptep);
if (unlikely(!pfn_valid(pfn))) {
print_bad_pte(vma, pte, addr);
return;
goto out;
}
page = pfn_to_page(pfn);
if (pte_dirty(pte))
set_page_dirty(page);
page_remove_rmap(page);
page_cache_release(page);
dec_mm_counter(mm, file_rss);
} else {
if (!pte_file(pte))
free_swap_and_cache(pte_to_swp_entry(pte));
pte_clear(mm, addr, ptep);
}
out:
return !!page;
}

/*
Expand Down Expand Up @@ -96,9 +94,9 @@ int install_page(struct mm_struct *mm, struct vm_area_struct *vma,
if (page_mapcount(page) > INT_MAX/2)
goto err_unlock;

zap_pte(mm, vma, addr, pte);
if (pte_none(*pte) || !zap_pte(mm, vma, addr, pte))
inc_mm_counter(mm, file_rss);

inc_mm_counter(mm, file_rss);
flush_icache_page(vma, page);
set_pte_at(mm, addr, pte, mk_pte(page, prot));
page_add_file_rmap(page);
Expand Down Expand Up @@ -145,7 +143,8 @@ int install_file_pte(struct mm_struct *mm, struct vm_area_struct *vma,
if (!pte)
goto err_unlock;

zap_pte(mm, vma, addr, pte);
if (!pte_none(*pte) && zap_pte(mm, vma, addr, pte))
dec_mm_counter(mm, file_rss);

set_pte_at(mm, addr, pte, pgoff_to_pte(pgoff));
pte_val = *pte;
Expand Down

0 comments on commit 617ae2b

Please sign in to comment.