Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 319
b: refs/heads/master
c: ee39b37
h: refs/heads/master
i:
  317: e28663e
  315: 33d7eae
  311: 4a57dbd
  303: c025114
  287: feef0a3
  255: 6267268
v: v3
  • Loading branch information
Hugh Dickins authored and Linus Torvalds committed Apr 19, 2005
1 parent afee334 commit 3b729a5
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 40 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: e0da382c92626ad1d7f4b7527d19b80104d67a83
refs/heads/master: ee39b37b23da0b6ec53a8ebe90ff41c016f8ae27
8 changes: 0 additions & 8 deletions trunk/include/asm-ia64/processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,6 @@
*/
#define TASK_SIZE (current->thread.task_size)

/*
* MM_VM_SIZE(mm) gives the maximum address (plus 1) which may contain a mapping for
* address-space MM. Note that with 32-bit tasks, this is still DEFAULT_TASK_SIZE,
* because the kernel may have installed helper-mappings above TASK_SIZE. For example,
* for x86 emulation, the LDT and GDT are mapped above TASK_SIZE.
*/
#define MM_VM_SIZE(mm) DEFAULT_TASK_SIZE

/*
* This decides where the kernel will search for a free chunk of vm
* space during mmap's.
Expand Down
4 changes: 0 additions & 4 deletions trunk/include/asm-ppc64/processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -542,10 +542,6 @@ extern struct task_struct *last_task_used_altivec;
#define TASK_SIZE (test_thread_flag(TIF_32BIT) ? \
TASK_SIZE_USER32 : TASK_SIZE_USER64)

/* We can't actually tell the TASK_SIZE given just the mm, but default
* to the 64-bit case to make sure that enough gets cleaned up. */
#define MM_VM_SIZE(mm) TASK_SIZE_USER64

/* This decides where the kernel will search for a free chunk of vm
* space during mmap's.
*/
Expand Down
2 changes: 0 additions & 2 deletions trunk/include/asm-s390/processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,6 @@ extern struct task_struct *last_task_used_math;

#endif /* __s390x__ */

#define MM_VM_SIZE(mm) DEFAULT_TASK_SIZE

#define HAVE_ARCH_PICK_MMAP_LAYOUT

typedef struct {
Expand Down
9 changes: 2 additions & 7 deletions trunk/include/linux/mm.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@ extern int sysctl_legacy_va_layout;
#include <asm/processor.h>
#include <asm/atomic.h>

#ifndef MM_VM_SIZE
#define MM_VM_SIZE(mm) ((TASK_SIZE + PGDIR_SIZE - 1) & PGDIR_MASK)
#endif

#define nth_page(page,n) pfn_to_page(page_to_pfn((page)) + (n))

/*
Expand Down Expand Up @@ -582,13 +578,12 @@ struct zap_details {
pgoff_t first_index; /* Lowest page->index to unmap */
pgoff_t last_index; /* Highest page->index to unmap */
spinlock_t *i_mmap_lock; /* For unmap_mapping_range: */
unsigned long break_addr; /* Where unmap_vmas stopped */
unsigned long truncate_count; /* Compare vm_truncate_count */
};

void zap_page_range(struct vm_area_struct *vma, unsigned long address,
unsigned long zap_page_range(struct vm_area_struct *vma, unsigned long address,
unsigned long size, struct zap_details *);
int unmap_vmas(struct mmu_gather **tlbp, struct mm_struct *mm,
unsigned long unmap_vmas(struct mmu_gather **tlb, struct mm_struct *mm,
struct vm_area_struct *start_vma, unsigned long start_addr,
unsigned long end_addr, unsigned long *nr_accounted,
struct zap_details *);
Expand Down
28 changes: 13 additions & 15 deletions trunk/mm/memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,7 @@ static void unmap_page_range(struct mmu_gather *tlb, struct vm_area_struct *vma,
* @nr_accounted: Place number of unmapped pages in vm-accountable vma's here
* @details: details of nonlinear truncation or shared cache invalidation
*
* Returns the number of vma's which were covered by the unmapping.
* Returns the end address of the unmapping (restart addr if interrupted).
*
* Unmap all pages in the vma list. Called under page_table_lock.
*
Expand All @@ -662,20 +662,19 @@ static void unmap_page_range(struct mmu_gather *tlb, struct vm_area_struct *vma,
* ensure that any thus-far unmapped pages are flushed before unmap_vmas()
* drops the lock and schedules.
*/
int unmap_vmas(struct mmu_gather **tlbp, struct mm_struct *mm,
unsigned long unmap_vmas(struct mmu_gather **tlbp, struct mm_struct *mm,
struct vm_area_struct *vma, unsigned long start_addr,
unsigned long end_addr, unsigned long *nr_accounted,
struct zap_details *details)
{
unsigned long zap_bytes = ZAP_BLOCK_SIZE;
unsigned long tlb_start = 0; /* For tlb_finish_mmu */
int tlb_start_valid = 0;
int ret = 0;
unsigned long start = start_addr;
spinlock_t *i_mmap_lock = details? details->i_mmap_lock: NULL;
int fullmm = tlb_is_full_mm(*tlbp);

for ( ; vma && vma->vm_start < end_addr; vma = vma->vm_next) {
unsigned long start;
unsigned long end;

start = max(vma->vm_start, start_addr);
Expand All @@ -688,7 +687,6 @@ int unmap_vmas(struct mmu_gather **tlbp, struct mm_struct *mm,
if (vma->vm_flags & VM_ACCOUNT)
*nr_accounted += (end - start) >> PAGE_SHIFT;

ret++;
while (start != end) {
unsigned long block;

Expand Down Expand Up @@ -719,7 +717,6 @@ int unmap_vmas(struct mmu_gather **tlbp, struct mm_struct *mm,
if (i_mmap_lock) {
/* must reset count of rss freed */
*tlbp = tlb_gather_mmu(mm, fullmm);
details->break_addr = start;
goto out;
}
spin_unlock(&mm->page_table_lock);
Expand All @@ -733,7 +730,7 @@ int unmap_vmas(struct mmu_gather **tlbp, struct mm_struct *mm,
}
}
out:
return ret;
return start; /* which is now the end (or restart) address */
}

/**
Expand All @@ -743,7 +740,7 @@ int unmap_vmas(struct mmu_gather **tlbp, struct mm_struct *mm,
* @size: number of bytes to zap
* @details: details of nonlinear truncation or shared cache invalidation
*/
void zap_page_range(struct vm_area_struct *vma, unsigned long address,
unsigned long zap_page_range(struct vm_area_struct *vma, unsigned long address,
unsigned long size, struct zap_details *details)
{
struct mm_struct *mm = vma->vm_mm;
Expand All @@ -753,15 +750,16 @@ void zap_page_range(struct vm_area_struct *vma, unsigned long address,

if (is_vm_hugetlb_page(vma)) {
zap_hugepage_range(vma, address, size);
return;
return end;
}

lru_add_drain();
spin_lock(&mm->page_table_lock);
tlb = tlb_gather_mmu(mm, 0);
unmap_vmas(&tlb, mm, vma, address, end, &nr_accounted, details);
end = unmap_vmas(&tlb, mm, vma, address, end, &nr_accounted, details);
tlb_finish_mmu(tlb, address, end);
spin_unlock(&mm->page_table_lock);
return end;
}

/*
Expand Down Expand Up @@ -1348,7 +1346,7 @@ static int do_wp_page(struct mm_struct *mm, struct vm_area_struct * vma,
* i_mmap_lock.
*
* In order to make forward progress despite repeatedly restarting some
* large vma, note the break_addr set by unmap_vmas when it breaks out:
* large vma, note the restart_addr from unmap_vmas when it breaks out:
* and restart from that address when we reach that vma again. It might
* have been split or merged, shrunk or extended, but never shifted: so
* restart_addr remains valid so long as it remains in the vma's range.
Expand Down Expand Up @@ -1386,8 +1384,8 @@ static int unmap_mapping_range_vma(struct vm_area_struct *vma,
}
}

details->break_addr = end_addr;
zap_page_range(vma, start_addr, end_addr - start_addr, details);
restart_addr = zap_page_range(vma, start_addr,
end_addr - start_addr, details);

/*
* We cannot rely on the break test in unmap_vmas:
Expand All @@ -1398,14 +1396,14 @@ static int unmap_mapping_range_vma(struct vm_area_struct *vma,
need_break = need_resched() ||
need_lockbreak(details->i_mmap_lock);

if (details->break_addr >= end_addr) {
if (restart_addr >= end_addr) {
/* We have now completed this vma: mark it so */
vma->vm_truncate_count = details->truncate_count;
if (!need_break)
return 0;
} else {
/* Note restart_addr in vma's truncate_count field */
vma->vm_truncate_count = details->break_addr;
vma->vm_truncate_count = restart_addr;
if (!need_break)
goto again;
}
Expand Down
6 changes: 3 additions & 3 deletions trunk/mm/mmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1900,6 +1900,7 @@ void exit_mmap(struct mm_struct *mm)
struct mmu_gather *tlb;
struct vm_area_struct *vma = mm->mmap;
unsigned long nr_accounted = 0;
unsigned long end;

lru_add_drain();

Expand All @@ -1908,10 +1909,10 @@ void exit_mmap(struct mm_struct *mm)
flush_cache_mm(mm);
tlb = tlb_gather_mmu(mm, 1);
/* Use -1 here to ensure all VMAs in the mm are unmapped */
mm->map_count -= unmap_vmas(&tlb, mm, vma, 0, -1, &nr_accounted, NULL);
end = unmap_vmas(&tlb, mm, vma, 0, -1, &nr_accounted, NULL);
vm_unacct_memory(nr_accounted);
free_pgtables(&tlb, vma, 0, 0);
tlb_finish_mmu(tlb, 0, MM_VM_SIZE(mm));
tlb_finish_mmu(tlb, 0, end);

mm->mmap = mm->mmap_cache = NULL;
mm->mm_rb = RB_ROOT;
Expand All @@ -1931,7 +1932,6 @@ void exit_mmap(struct mm_struct *mm)
vma = next;
}

BUG_ON(mm->map_count); /* This is just debugging */
BUG_ON(mm->nr_ptes); /* This is just debugging */
}

Expand Down

0 comments on commit 3b729a5

Please sign in to comment.