diff options
Diffstat (limited to 'mm')
-rw-r--r-- | mm/mmap.c | 61 | ||||
-rw-r--r-- | mm/mprotect.c | 2 | ||||
-rw-r--r-- | mm/mremap.c | 2 |
3 files changed, 37 insertions, 28 deletions
@@ -1571,33 +1571,11 @@ int expand_upwards(struct vm_area_struct *vma, unsigned long address) | |||
1571 | } | 1571 | } |
1572 | #endif /* CONFIG_STACK_GROWSUP || CONFIG_IA64 */ | 1572 | #endif /* CONFIG_STACK_GROWSUP || CONFIG_IA64 */ |
1573 | 1573 | ||
1574 | #ifdef CONFIG_STACK_GROWSUP | ||
1575 | int expand_stack(struct vm_area_struct *vma, unsigned long address) | ||
1576 | { | ||
1577 | return expand_upwards(vma, address); | ||
1578 | } | ||
1579 | |||
1580 | struct vm_area_struct * | ||
1581 | find_extend_vma(struct mm_struct *mm, unsigned long addr) | ||
1582 | { | ||
1583 | struct vm_area_struct *vma, *prev; | ||
1584 | |||
1585 | addr &= PAGE_MASK; | ||
1586 | vma = find_vma_prev(mm, addr, &prev); | ||
1587 | if (vma && (vma->vm_start <= addr)) | ||
1588 | return vma; | ||
1589 | if (!prev || expand_stack(prev, addr)) | ||
1590 | return NULL; | ||
1591 | if (prev->vm_flags & VM_LOCKED) { | ||
1592 | make_pages_present(addr, prev->vm_end); | ||
1593 | } | ||
1594 | return prev; | ||
1595 | } | ||
1596 | #else | ||
1597 | /* | 1574 | /* |
1598 | * vma is the first one with address < vma->vm_start. Have to extend vma. | 1575 | * vma is the first one with address < vma->vm_start. Have to extend vma. |
1599 | */ | 1576 | */ |
1600 | int expand_stack(struct vm_area_struct *vma, unsigned long address) | 1577 | static inline int expand_downwards(struct vm_area_struct *vma, |
1578 | unsigned long address) | ||
1601 | { | 1579 | { |
1602 | int error; | 1580 | int error; |
1603 | 1581 | ||
@@ -1634,6 +1612,38 @@ int expand_stack(struct vm_area_struct *vma, unsigned long address) | |||
1634 | return error; | 1612 | return error; |
1635 | } | 1613 | } |
1636 | 1614 | ||
1615 | int expand_stack_downwards(struct vm_area_struct *vma, unsigned long address) | ||
1616 | { | ||
1617 | return expand_downwards(vma, address); | ||
1618 | } | ||
1619 | |||
1620 | #ifdef CONFIG_STACK_GROWSUP | ||
1621 | int expand_stack(struct vm_area_struct *vma, unsigned long address) | ||
1622 | { | ||
1623 | return expand_upwards(vma, address); | ||
1624 | } | ||
1625 | |||
1626 | struct vm_area_struct * | ||
1627 | find_extend_vma(struct mm_struct *mm, unsigned long addr) | ||
1628 | { | ||
1629 | struct vm_area_struct *vma, *prev; | ||
1630 | |||
1631 | addr &= PAGE_MASK; | ||
1632 | vma = find_vma_prev(mm, addr, &prev); | ||
1633 | if (vma && (vma->vm_start <= addr)) | ||
1634 | return vma; | ||
1635 | if (!prev || expand_stack(prev, addr)) | ||
1636 | return NULL; | ||
1637 | if (prev->vm_flags & VM_LOCKED) | ||
1638 | make_pages_present(addr, prev->vm_end); | ||
1639 | return prev; | ||
1640 | } | ||
1641 | #else | ||
1642 | int expand_stack(struct vm_area_struct *vma, unsigned long address) | ||
1643 | { | ||
1644 | return expand_downwards(vma, address); | ||
1645 | } | ||
1646 | |||
1637 | struct vm_area_struct * | 1647 | struct vm_area_struct * |
1638 | find_extend_vma(struct mm_struct * mm, unsigned long addr) | 1648 | find_extend_vma(struct mm_struct * mm, unsigned long addr) |
1639 | { | 1649 | { |
@@ -1651,9 +1661,8 @@ find_extend_vma(struct mm_struct * mm, unsigned long addr) | |||
1651 | start = vma->vm_start; | 1661 | start = vma->vm_start; |
1652 | if (expand_stack(vma, addr)) | 1662 | if (expand_stack(vma, addr)) |
1653 | return NULL; | 1663 | return NULL; |
1654 | if (vma->vm_flags & VM_LOCKED) { | 1664 | if (vma->vm_flags & VM_LOCKED) |
1655 | make_pages_present(addr, start); | 1665 | make_pages_present(addr, start); |
1656 | } | ||
1657 | return vma; | 1666 | return vma; |
1658 | } | 1667 | } |
1659 | #endif | 1668 | #endif |
diff --git a/mm/mprotect.c b/mm/mprotect.c index 3b8f3c0c63f3..e8346c30abec 100644 --- a/mm/mprotect.c +++ b/mm/mprotect.c | |||
@@ -128,7 +128,7 @@ static void change_protection(struct vm_area_struct *vma, | |||
128 | flush_tlb_range(vma, start, end); | 128 | flush_tlb_range(vma, start, end); |
129 | } | 129 | } |
130 | 130 | ||
131 | static int | 131 | int |
132 | mprotect_fixup(struct vm_area_struct *vma, struct vm_area_struct **pprev, | 132 | mprotect_fixup(struct vm_area_struct *vma, struct vm_area_struct **pprev, |
133 | unsigned long start, unsigned long end, unsigned long newflags) | 133 | unsigned long start, unsigned long end, unsigned long newflags) |
134 | { | 134 | { |
diff --git a/mm/mremap.c b/mm/mremap.c index bc7c52efc71b..8ea5c2412c6e 100644 --- a/mm/mremap.c +++ b/mm/mremap.c | |||
@@ -120,7 +120,7 @@ static void move_ptes(struct vm_area_struct *vma, pmd_t *old_pmd, | |||
120 | 120 | ||
121 | #define LATENCY_LIMIT (64 * PAGE_SIZE) | 121 | #define LATENCY_LIMIT (64 * PAGE_SIZE) |
122 | 122 | ||
123 | static unsigned long move_page_tables(struct vm_area_struct *vma, | 123 | unsigned long move_page_tables(struct vm_area_struct *vma, |
124 | unsigned long old_addr, struct vm_area_struct *new_vma, | 124 | unsigned long old_addr, struct vm_area_struct *new_vma, |
125 | unsigned long new_addr, unsigned long len) | 125 | unsigned long new_addr, unsigned long len) |
126 | { | 126 | { |