Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 164418
b: refs/heads/master
c: 1c2fb7a
h: refs/heads/master
v: v3
  • Loading branch information
Andrea Arcangeli authored and Linus Torvalds committed Sep 22, 2009
1 parent 4e8246c commit 35947ec
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 21 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: 9ba6929480088a85c1ff60a4b1f1c9fc80dbd2b7
refs/heads/master: 1c2fb7a4c2ca7a958b02bc1e615d0254990bba8d
11 changes: 4 additions & 7 deletions trunk/include/linux/ksm.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ struct mmu_gather;
int ksm_madvise(struct vm_area_struct *vma, unsigned long start,
unsigned long end, int advice, unsigned long *vm_flags);
int __ksm_enter(struct mm_struct *mm);
void __ksm_exit(struct mm_struct *mm,
struct mmu_gather **tlbp, unsigned long end);
void __ksm_exit(struct mm_struct *mm);

static inline int ksm_fork(struct mm_struct *mm, struct mm_struct *oldmm)
{
Expand All @@ -41,11 +40,10 @@ static inline bool ksm_test_exit(struct mm_struct *mm)
return atomic_read(&mm->mm_users) == 0;
}

static inline void ksm_exit(struct mm_struct *mm,
struct mmu_gather **tlbp, unsigned long end)
static inline void ksm_exit(struct mm_struct *mm)
{
if (test_bit(MMF_VM_MERGEABLE, &mm->flags))
__ksm_exit(mm, tlbp, end);
__ksm_exit(mm);
}

/*
Expand Down Expand Up @@ -86,8 +84,7 @@ static inline bool ksm_test_exit(struct mm_struct *mm)
return 0;
}

static inline void ksm_exit(struct mm_struct *mm,
struct mmu_gather **tlbp, unsigned long end)
static inline void ksm_exit(struct mm_struct *mm)
{
}

Expand Down
1 change: 1 addition & 0 deletions trunk/kernel/fork.c
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,7 @@ void mmput(struct mm_struct *mm)

if (atomic_dec_and_test(&mm->mm_users)) {
exit_aio(mm);
ksm_exit(mm);
exit_mmap(mm);
set_mm_exe_file(mm, NULL);
if (!list_empty(&mm->mmlist)) {
Expand Down
5 changes: 1 addition & 4 deletions trunk/mm/ksm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1416,8 +1416,7 @@ int __ksm_enter(struct mm_struct *mm)
return 0;
}

void __ksm_exit(struct mm_struct *mm,
struct mmu_gather **tlbp, unsigned long end)
void __ksm_exit(struct mm_struct *mm)
{
struct mm_slot *mm_slot;
int easy_to_free = 0;
Expand Down Expand Up @@ -1450,10 +1449,8 @@ void __ksm_exit(struct mm_struct *mm,
clear_bit(MMF_VM_MERGEABLE, &mm->flags);
mmdrop(mm);
} else if (mm_slot) {
tlb_finish_mmu(*tlbp, 0, end);
down_write(&mm->mmap_sem);
up_write(&mm->mmap_sem);
*tlbp = tlb_gather_mmu(mm, 1);
}
}

Expand Down
4 changes: 2 additions & 2 deletions trunk/mm/memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -2648,7 +2648,7 @@ static int do_anonymous_page(struct mm_struct *mm, struct vm_area_struct *vma,
entry = maybe_mkwrite(pte_mkdirty(entry), vma);

page_table = pte_offset_map_lock(mm, pmd, address, &ptl);
if (!pte_none(*page_table) || ksm_test_exit(mm))
if (!pte_none(*page_table))
goto release;

inc_mm_counter(mm, anon_rss);
Expand Down Expand Up @@ -2792,7 +2792,7 @@ static int __do_fault(struct mm_struct *mm, struct vm_area_struct *vma,
* handle that later.
*/
/* Only go through if we didn't race with anybody else... */
if (likely(pte_same(*page_table, orig_pte) && !ksm_test_exit(mm))) {
if (likely(pte_same(*page_table, orig_pte))) {
flush_icache_page(vma, page);
entry = mk_pte(page, vma->vm_page_prot);
if (flags & FAULT_FLAG_WRITE)
Expand Down
7 changes: 0 additions & 7 deletions trunk/mm/mmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -2113,13 +2113,6 @@ void exit_mmap(struct mm_struct *mm)
end = unmap_vmas(&tlb, vma, 0, -1, &nr_accounted, NULL);
vm_unacct_memory(nr_accounted);

/*
* For KSM to handle OOM without deadlock when it's breaking COW in a
* likely victim of the OOM killer, we must serialize with ksm_exit()
* after freeing mm's pages but before freeing its page tables.
*/
ksm_exit(mm, &tlb, end);

free_pgtables(tlb, vma, FIRST_USER_ADDRESS, 0);
tlb_finish_mmu(tlb, 0, end);

Expand Down

0 comments on commit 35947ec

Please sign in to comment.