diff options
Diffstat (limited to 'mm')
-rw-r--r-- | mm/backing-dev.c | 3 | ||||
-rw-r--r-- | mm/memory.c | 70 | ||||
-rw-r--r-- | mm/memory_hotplug.c | 9 | ||||
-rw-r--r-- | mm/migrate.c | 59 | ||||
-rw-r--r-- | mm/page_cgroup.c | 59 | ||||
-rw-r--r-- | mm/slob.c | 2 | ||||
-rw-r--r-- | mm/slub.c | 8 | ||||
-rw-r--r-- | mm/sparse.c | 2 | ||||
-rw-r--r-- | mm/swap.c | 20 | ||||
-rw-r--r-- | mm/swapfile.c | 9 | ||||
-rw-r--r-- | mm/vmalloc.c | 22 | ||||
-rw-r--r-- | mm/vmscan.c | 2 |
12 files changed, 181 insertions, 84 deletions
diff --git a/mm/backing-dev.c b/mm/backing-dev.c index f2e574dbc300..801c08b046e6 100644 --- a/mm/backing-dev.c +++ b/mm/backing-dev.c | |||
@@ -176,6 +176,9 @@ int bdi_register(struct backing_dev_info *bdi, struct device *parent, | |||
176 | int ret = 0; | 176 | int ret = 0; |
177 | struct device *dev; | 177 | struct device *dev; |
178 | 178 | ||
179 | if (bdi->dev) /* The driver needs to use separate queues per device */ | ||
180 | goto exit; | ||
181 | |||
179 | va_start(args, fmt); | 182 | va_start(args, fmt); |
180 | dev = device_create_vargs(bdi_class, parent, MKDEV(0, 0), bdi, fmt, args); | 183 | dev = device_create_vargs(bdi_class, parent, MKDEV(0, 0), bdi, fmt, args); |
181 | va_end(args); | 184 | va_end(args); |
diff --git a/mm/memory.c b/mm/memory.c index 164951c47305..f01b7eed6e16 100644 --- a/mm/memory.c +++ b/mm/memory.c | |||
@@ -669,6 +669,16 @@ int copy_page_range(struct mm_struct *dst_mm, struct mm_struct *src_mm, | |||
669 | if (is_vm_hugetlb_page(vma)) | 669 | if (is_vm_hugetlb_page(vma)) |
670 | return copy_hugetlb_page_range(dst_mm, src_mm, vma); | 670 | return copy_hugetlb_page_range(dst_mm, src_mm, vma); |
671 | 671 | ||
672 | if (unlikely(is_pfn_mapping(vma))) { | ||
673 | /* | ||
674 | * We do not free on error cases below as remove_vma | ||
675 | * gets called on error from higher level routine | ||
676 | */ | ||
677 | ret = track_pfn_vma_copy(vma); | ||
678 | if (ret) | ||
679 | return ret; | ||
680 | } | ||
681 | |||
672 | /* | 682 | /* |
673 | * We need to invalidate the secondary MMU mappings only when | 683 | * We need to invalidate the secondary MMU mappings only when |
674 | * there could be a permission downgrade on the ptes of the | 684 | * there could be a permission downgrade on the ptes of the |
@@ -915,6 +925,9 @@ unsigned long unmap_vmas(struct mmu_gather **tlbp, | |||
915 | if (vma->vm_flags & VM_ACCOUNT) | 925 | if (vma->vm_flags & VM_ACCOUNT) |
916 | *nr_accounted += (end - start) >> PAGE_SHIFT; | 926 | *nr_accounted += (end - start) >> PAGE_SHIFT; |
917 | 927 | ||
928 | if (unlikely(is_pfn_mapping(vma))) | ||
929 | untrack_pfn_vma(vma, 0, 0); | ||
930 | |||
918 | while (start != end) { | 931 | while (start != end) { |
919 | if (!tlb_start_valid) { | 932 | if (!tlb_start_valid) { |
920 | tlb_start = start; | 933 | tlb_start = start; |
@@ -1430,6 +1443,7 @@ out: | |||
1430 | int vm_insert_pfn(struct vm_area_struct *vma, unsigned long addr, | 1443 | int vm_insert_pfn(struct vm_area_struct *vma, unsigned long addr, |
1431 | unsigned long pfn) | 1444 | unsigned long pfn) |
1432 | { | 1445 | { |
1446 | int ret; | ||
1433 | /* | 1447 | /* |
1434 | * Technically, architectures with pte_special can avoid all these | 1448 | * Technically, architectures with pte_special can avoid all these |
1435 | * restrictions (same for remap_pfn_range). However we would like | 1449 | * restrictions (same for remap_pfn_range). However we would like |
@@ -1444,7 +1458,15 @@ int vm_insert_pfn(struct vm_area_struct *vma, unsigned long addr, | |||
1444 | 1458 | ||
1445 | if (addr < vma->vm_start || addr >= vma->vm_end) | 1459 | if (addr < vma->vm_start || addr >= vma->vm_end) |
1446 | return -EFAULT; | 1460 | return -EFAULT; |
1447 | return insert_pfn(vma, addr, pfn, vma->vm_page_prot); | 1461 | if (track_pfn_vma_new(vma, vma->vm_page_prot, pfn, PAGE_SIZE)) |
1462 | return -EINVAL; | ||
1463 | |||
1464 | ret = insert_pfn(vma, addr, pfn, vma->vm_page_prot); | ||
1465 | |||
1466 | if (ret) | ||
1467 | untrack_pfn_vma(vma, pfn, PAGE_SIZE); | ||
1468 | |||
1469 | return ret; | ||
1448 | } | 1470 | } |
1449 | EXPORT_SYMBOL(vm_insert_pfn); | 1471 | EXPORT_SYMBOL(vm_insert_pfn); |
1450 | 1472 | ||
@@ -1575,14 +1597,17 @@ int remap_pfn_range(struct vm_area_struct *vma, unsigned long addr, | |||
1575 | * behaviour that some programs depend on. We mark the "original" | 1597 | * behaviour that some programs depend on. We mark the "original" |
1576 | * un-COW'ed pages by matching them up with "vma->vm_pgoff". | 1598 | * un-COW'ed pages by matching them up with "vma->vm_pgoff". |
1577 | */ | 1599 | */ |
1578 | if (is_cow_mapping(vma->vm_flags)) { | 1600 | if (addr == vma->vm_start && end == vma->vm_end) |
1579 | if (addr != vma->vm_start || end != vma->vm_end) | ||
1580 | return -EINVAL; | ||
1581 | vma->vm_pgoff = pfn; | 1601 | vma->vm_pgoff = pfn; |
1582 | } | 1602 | else if (is_cow_mapping(vma->vm_flags)) |
1603 | return -EINVAL; | ||
1583 | 1604 | ||
1584 | vma->vm_flags |= VM_IO | VM_RESERVED | VM_PFNMAP; | 1605 | vma->vm_flags |= VM_IO | VM_RESERVED | VM_PFNMAP; |
1585 | 1606 | ||
1607 | err = track_pfn_vma_new(vma, prot, pfn, PAGE_ALIGN(size)); | ||
1608 | if (err) | ||
1609 | return -EINVAL; | ||
1610 | |||
1586 | BUG_ON(addr >= end); | 1611 | BUG_ON(addr >= end); |
1587 | pfn -= addr >> PAGE_SHIFT; | 1612 | pfn -= addr >> PAGE_SHIFT; |
1588 | pgd = pgd_offset(mm, addr); | 1613 | pgd = pgd_offset(mm, addr); |
@@ -1594,6 +1619,10 @@ int remap_pfn_range(struct vm_area_struct *vma, unsigned long addr, | |||
1594 | if (err) | 1619 | if (err) |
1595 | break; | 1620 | break; |
1596 | } while (pgd++, addr = next, addr != end); | 1621 | } while (pgd++, addr = next, addr != end); |
1622 | |||
1623 | if (err) | ||
1624 | untrack_pfn_vma(vma, pfn, PAGE_ALIGN(size)); | ||
1625 | |||
1597 | return err; | 1626 | return err; |
1598 | } | 1627 | } |
1599 | EXPORT_SYMBOL(remap_pfn_range); | 1628 | EXPORT_SYMBOL(remap_pfn_range); |
@@ -2865,9 +2894,9 @@ int in_gate_area_no_task(unsigned long addr) | |||
2865 | #endif /* __HAVE_ARCH_GATE_AREA */ | 2894 | #endif /* __HAVE_ARCH_GATE_AREA */ |
2866 | 2895 | ||
2867 | #ifdef CONFIG_HAVE_IOREMAP_PROT | 2896 | #ifdef CONFIG_HAVE_IOREMAP_PROT |
2868 | static resource_size_t follow_phys(struct vm_area_struct *vma, | 2897 | int follow_phys(struct vm_area_struct *vma, |
2869 | unsigned long address, unsigned int flags, | 2898 | unsigned long address, unsigned int flags, |
2870 | unsigned long *prot) | 2899 | unsigned long *prot, resource_size_t *phys) |
2871 | { | 2900 | { |
2872 | pgd_t *pgd; | 2901 | pgd_t *pgd; |
2873 | pud_t *pud; | 2902 | pud_t *pud; |
@@ -2876,24 +2905,26 @@ static resource_size_t follow_phys(struct vm_area_struct *vma, | |||
2876 | spinlock_t *ptl; | 2905 | spinlock_t *ptl; |
2877 | resource_size_t phys_addr = 0; | 2906 | resource_size_t phys_addr = 0; |
2878 | struct mm_struct *mm = vma->vm_mm; | 2907 | struct mm_struct *mm = vma->vm_mm; |
2908 | int ret = -EINVAL; | ||
2879 | 2909 | ||
2880 | VM_BUG_ON(!(vma->vm_flags & (VM_IO | VM_PFNMAP))); | 2910 | if (!(vma->vm_flags & (VM_IO | VM_PFNMAP))) |
2911 | goto out; | ||
2881 | 2912 | ||
2882 | pgd = pgd_offset(mm, address); | 2913 | pgd = pgd_offset(mm, address); |
2883 | if (pgd_none(*pgd) || unlikely(pgd_bad(*pgd))) | 2914 | if (pgd_none(*pgd) || unlikely(pgd_bad(*pgd))) |
2884 | goto no_page_table; | 2915 | goto out; |
2885 | 2916 | ||
2886 | pud = pud_offset(pgd, address); | 2917 | pud = pud_offset(pgd, address); |
2887 | if (pud_none(*pud) || unlikely(pud_bad(*pud))) | 2918 | if (pud_none(*pud) || unlikely(pud_bad(*pud))) |
2888 | goto no_page_table; | 2919 | goto out; |
2889 | 2920 | ||
2890 | pmd = pmd_offset(pud, address); | 2921 | pmd = pmd_offset(pud, address); |
2891 | if (pmd_none(*pmd) || unlikely(pmd_bad(*pmd))) | 2922 | if (pmd_none(*pmd) || unlikely(pmd_bad(*pmd))) |
2892 | goto no_page_table; | 2923 | goto out; |
2893 | 2924 | ||
2894 | /* We cannot handle huge page PFN maps. Luckily they don't exist. */ | 2925 | /* We cannot handle huge page PFN maps. Luckily they don't exist. */ |
2895 | if (pmd_huge(*pmd)) | 2926 | if (pmd_huge(*pmd)) |
2896 | goto no_page_table; | 2927 | goto out; |
2897 | 2928 | ||
2898 | ptep = pte_offset_map_lock(mm, pmd, address, &ptl); | 2929 | ptep = pte_offset_map_lock(mm, pmd, address, &ptl); |
2899 | if (!ptep) | 2930 | if (!ptep) |
@@ -2908,13 +2939,13 @@ static resource_size_t follow_phys(struct vm_area_struct *vma, | |||
2908 | phys_addr <<= PAGE_SHIFT; /* Shift here to avoid overflow on PAE */ | 2939 | phys_addr <<= PAGE_SHIFT; /* Shift here to avoid overflow on PAE */ |
2909 | 2940 | ||
2910 | *prot = pgprot_val(pte_pgprot(pte)); | 2941 | *prot = pgprot_val(pte_pgprot(pte)); |
2942 | *phys = phys_addr; | ||
2943 | ret = 0; | ||
2911 | 2944 | ||
2912 | unlock: | 2945 | unlock: |
2913 | pte_unmap_unlock(ptep, ptl); | 2946 | pte_unmap_unlock(ptep, ptl); |
2914 | out: | 2947 | out: |
2915 | return phys_addr; | 2948 | return ret; |
2916 | no_page_table: | ||
2917 | return 0; | ||
2918 | } | 2949 | } |
2919 | 2950 | ||
2920 | int generic_access_phys(struct vm_area_struct *vma, unsigned long addr, | 2951 | int generic_access_phys(struct vm_area_struct *vma, unsigned long addr, |
@@ -2925,12 +2956,7 @@ int generic_access_phys(struct vm_area_struct *vma, unsigned long addr, | |||
2925 | void *maddr; | 2956 | void *maddr; |
2926 | int offset = addr & (PAGE_SIZE-1); | 2957 | int offset = addr & (PAGE_SIZE-1); |
2927 | 2958 | ||
2928 | if (!(vma->vm_flags & (VM_IO | VM_PFNMAP))) | 2959 | if (follow_phys(vma, addr, write, &prot, &phys_addr)) |
2929 | return -EINVAL; | ||
2930 | |||
2931 | phys_addr = follow_phys(vma, addr, write, &prot); | ||
2932 | |||
2933 | if (!phys_addr) | ||
2934 | return -EINVAL; | 2960 | return -EINVAL; |
2935 | 2961 | ||
2936 | maddr = ioremap_prot(phys_addr, PAGE_SIZE, prot); | 2962 | maddr = ioremap_prot(phys_addr, PAGE_SIZE, prot); |
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index b5b2b15085a8..b17371185468 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c | |||
@@ -189,7 +189,7 @@ static void grow_pgdat_span(struct pglist_data *pgdat, unsigned long start_pfn, | |||
189 | pgdat->node_start_pfn; | 189 | pgdat->node_start_pfn; |
190 | } | 190 | } |
191 | 191 | ||
192 | static int __add_zone(struct zone *zone, unsigned long phys_start_pfn) | 192 | static int __meminit __add_zone(struct zone *zone, unsigned long phys_start_pfn) |
193 | { | 193 | { |
194 | struct pglist_data *pgdat = zone->zone_pgdat; | 194 | struct pglist_data *pgdat = zone->zone_pgdat; |
195 | int nr_pages = PAGES_PER_SECTION; | 195 | int nr_pages = PAGES_PER_SECTION; |
@@ -216,7 +216,7 @@ static int __add_zone(struct zone *zone, unsigned long phys_start_pfn) | |||
216 | return 0; | 216 | return 0; |
217 | } | 217 | } |
218 | 218 | ||
219 | static int __add_section(struct zone *zone, unsigned long phys_start_pfn) | 219 | static int __meminit __add_section(struct zone *zone, unsigned long phys_start_pfn) |
220 | { | 220 | { |
221 | int nr_pages = PAGES_PER_SECTION; | 221 | int nr_pages = PAGES_PER_SECTION; |
222 | int ret; | 222 | int ret; |
@@ -273,7 +273,7 @@ static int __remove_section(struct zone *zone, struct mem_section *ms) | |||
273 | * call this function after deciding the zone to which to | 273 | * call this function after deciding the zone to which to |
274 | * add the new pages. | 274 | * add the new pages. |
275 | */ | 275 | */ |
276 | int __add_pages(struct zone *zone, unsigned long phys_start_pfn, | 276 | int __ref __add_pages(struct zone *zone, unsigned long phys_start_pfn, |
277 | unsigned long nr_pages) | 277 | unsigned long nr_pages) |
278 | { | 278 | { |
279 | unsigned long i; | 279 | unsigned long i; |
@@ -470,7 +470,8 @@ static void rollback_node_hotadd(int nid, pg_data_t *pgdat) | |||
470 | } | 470 | } |
471 | 471 | ||
472 | 472 | ||
473 | int add_memory(int nid, u64 start, u64 size) | 473 | /* we are OK calling __meminit stuff here - we have CONFIG_MEMORY_HOTPLUG */ |
474 | int __ref add_memory(int nid, u64 start, u64 size) | ||
474 | { | 475 | { |
475 | pg_data_t *pgdat = NULL; | 476 | pg_data_t *pgdat = NULL; |
476 | int new_pgdat = 0; | 477 | int new_pgdat = 0; |
diff --git a/mm/migrate.c b/mm/migrate.c index 1e0d6b237f44..037b0967c1e3 100644 --- a/mm/migrate.c +++ b/mm/migrate.c | |||
@@ -987,25 +987,18 @@ out: | |||
987 | /* | 987 | /* |
988 | * Determine the nodes of an array of pages and store it in an array of status. | 988 | * Determine the nodes of an array of pages and store it in an array of status. |
989 | */ | 989 | */ |
990 | static int do_pages_stat(struct mm_struct *mm, unsigned long nr_pages, | 990 | static void do_pages_stat_array(struct mm_struct *mm, unsigned long nr_pages, |
991 | const void __user * __user *pages, | 991 | const void __user **pages, int *status) |
992 | int __user *status) | ||
993 | { | 992 | { |
994 | unsigned long i; | 993 | unsigned long i; |
995 | int err; | ||
996 | 994 | ||
997 | down_read(&mm->mmap_sem); | 995 | down_read(&mm->mmap_sem); |
998 | 996 | ||
999 | for (i = 0; i < nr_pages; i++) { | 997 | for (i = 0; i < nr_pages; i++) { |
1000 | const void __user *p; | 998 | unsigned long addr = (unsigned long)(*pages); |
1001 | unsigned long addr; | ||
1002 | struct vm_area_struct *vma; | 999 | struct vm_area_struct *vma; |
1003 | struct page *page; | 1000 | struct page *page; |
1004 | 1001 | int err = -EFAULT; | |
1005 | err = -EFAULT; | ||
1006 | if (get_user(p, pages+i)) | ||
1007 | goto out; | ||
1008 | addr = (unsigned long) p; | ||
1009 | 1002 | ||
1010 | vma = find_vma(mm, addr); | 1003 | vma = find_vma(mm, addr); |
1011 | if (!vma) | 1004 | if (!vma) |
@@ -1024,12 +1017,52 @@ static int do_pages_stat(struct mm_struct *mm, unsigned long nr_pages, | |||
1024 | 1017 | ||
1025 | err = page_to_nid(page); | 1018 | err = page_to_nid(page); |
1026 | set_status: | 1019 | set_status: |
1027 | put_user(err, status+i); | 1020 | *status = err; |
1021 | |||
1022 | pages++; | ||
1023 | status++; | ||
1024 | } | ||
1025 | |||
1026 | up_read(&mm->mmap_sem); | ||
1027 | } | ||
1028 | |||
1029 | /* | ||
1030 | * Determine the nodes of a user array of pages and store it in | ||
1031 | * a user array of status. | ||
1032 | */ | ||
1033 | static int do_pages_stat(struct mm_struct *mm, unsigned long nr_pages, | ||
1034 | const void __user * __user *pages, | ||
1035 | int __user *status) | ||
1036 | { | ||
1037 | #define DO_PAGES_STAT_CHUNK_NR 16 | ||
1038 | const void __user *chunk_pages[DO_PAGES_STAT_CHUNK_NR]; | ||
1039 | int chunk_status[DO_PAGES_STAT_CHUNK_NR]; | ||
1040 | unsigned long i, chunk_nr = DO_PAGES_STAT_CHUNK_NR; | ||
1041 | int err; | ||
1042 | |||
1043 | for (i = 0; i < nr_pages; i += chunk_nr) { | ||
1044 | if (chunk_nr + i > nr_pages) | ||
1045 | chunk_nr = nr_pages - i; | ||
1046 | |||
1047 | err = copy_from_user(chunk_pages, &pages[i], | ||
1048 | chunk_nr * sizeof(*chunk_pages)); | ||
1049 | if (err) { | ||
1050 | err = -EFAULT; | ||
1051 | goto out; | ||
1052 | } | ||
1053 | |||
1054 | do_pages_stat_array(mm, chunk_nr, chunk_pages, chunk_status); | ||
1055 | |||
1056 | err = copy_to_user(&status[i], chunk_status, | ||
1057 | chunk_nr * sizeof(*chunk_status)); | ||
1058 | if (err) { | ||
1059 | err = -EFAULT; | ||
1060 | goto out; | ||
1061 | } | ||
1028 | } | 1062 | } |
1029 | err = 0; | 1063 | err = 0; |
1030 | 1064 | ||
1031 | out: | 1065 | out: |
1032 | up_read(&mm->mmap_sem); | ||
1033 | return err; | 1066 | return err; |
1034 | } | 1067 | } |
1035 | 1068 | ||
diff --git a/mm/page_cgroup.c b/mm/page_cgroup.c index 1223d927904d..ab27ff750519 100644 --- a/mm/page_cgroup.c +++ b/mm/page_cgroup.c | |||
@@ -21,7 +21,7 @@ static unsigned long total_usage; | |||
21 | #if !defined(CONFIG_SPARSEMEM) | 21 | #if !defined(CONFIG_SPARSEMEM) |
22 | 22 | ||
23 | 23 | ||
24 | void __init pgdat_page_cgroup_init(struct pglist_data *pgdat) | 24 | void __meminit pgdat_page_cgroup_init(struct pglist_data *pgdat) |
25 | { | 25 | { |
26 | pgdat->node_page_cgroup = NULL; | 26 | pgdat->node_page_cgroup = NULL; |
27 | } | 27 | } |
@@ -49,6 +49,9 @@ static int __init alloc_node_page_cgroup(int nid) | |||
49 | start_pfn = NODE_DATA(nid)->node_start_pfn; | 49 | start_pfn = NODE_DATA(nid)->node_start_pfn; |
50 | nr_pages = NODE_DATA(nid)->node_spanned_pages; | 50 | nr_pages = NODE_DATA(nid)->node_spanned_pages; |
51 | 51 | ||
52 | if (!nr_pages) | ||
53 | return 0; | ||
54 | |||
52 | table_size = sizeof(struct page_cgroup) * nr_pages; | 55 | table_size = sizeof(struct page_cgroup) * nr_pages; |
53 | 56 | ||
54 | base = __alloc_bootmem_node_nopanic(NODE_DATA(nid), | 57 | base = __alloc_bootmem_node_nopanic(NODE_DATA(nid), |
@@ -97,7 +100,8 @@ struct page_cgroup *lookup_page_cgroup(struct page *page) | |||
97 | return section->page_cgroup + pfn; | 100 | return section->page_cgroup + pfn; |
98 | } | 101 | } |
99 | 102 | ||
100 | int __meminit init_section_page_cgroup(unsigned long pfn) | 103 | /* __alloc_bootmem...() is protected by !slab_available() */ |
104 | int __init_refok init_section_page_cgroup(unsigned long pfn) | ||
101 | { | 105 | { |
102 | struct mem_section *section; | 106 | struct mem_section *section; |
103 | struct page_cgroup *base, *pc; | 107 | struct page_cgroup *base, *pc; |
@@ -106,19 +110,29 @@ int __meminit init_section_page_cgroup(unsigned long pfn) | |||
106 | 110 | ||
107 | section = __pfn_to_section(pfn); | 111 | section = __pfn_to_section(pfn); |
108 | 112 | ||
109 | if (section->page_cgroup) | 113 | if (!section->page_cgroup) { |
110 | return 0; | 114 | nid = page_to_nid(pfn_to_page(pfn)); |
111 | 115 | table_size = sizeof(struct page_cgroup) * PAGES_PER_SECTION; | |
112 | nid = page_to_nid(pfn_to_page(pfn)); | 116 | if (slab_is_available()) { |
113 | 117 | base = kmalloc_node(table_size, GFP_KERNEL, nid); | |
114 | table_size = sizeof(struct page_cgroup) * PAGES_PER_SECTION; | 118 | if (!base) |
115 | if (slab_is_available()) { | 119 | base = vmalloc_node(table_size, nid); |
116 | base = kmalloc_node(table_size, GFP_KERNEL, nid); | 120 | } else { |
117 | if (!base) | 121 | base = __alloc_bootmem_node_nopanic(NODE_DATA(nid), |
118 | base = vmalloc_node(table_size, nid); | 122 | table_size, |
119 | } else { | ||
120 | base = __alloc_bootmem_node_nopanic(NODE_DATA(nid), table_size, | ||
121 | PAGE_SIZE, __pa(MAX_DMA_ADDRESS)); | 123 | PAGE_SIZE, __pa(MAX_DMA_ADDRESS)); |
124 | } | ||
125 | } else { | ||
126 | /* | ||
127 | * We don't have to allocate page_cgroup again, but | ||
128 | * address of memmap may be changed. So, we have to initialize | ||
129 | * again. | ||
130 | */ | ||
131 | base = section->page_cgroup + pfn; | ||
132 | table_size = 0; | ||
133 | /* check address of memmap is changed or not. */ | ||
134 | if (base->page == pfn_to_page(pfn)) | ||
135 | return 0; | ||
122 | } | 136 | } |
123 | 137 | ||
124 | if (!base) { | 138 | if (!base) { |
@@ -158,7 +172,7 @@ void __free_page_cgroup(unsigned long pfn) | |||
158 | } | 172 | } |
159 | } | 173 | } |
160 | 174 | ||
161 | int online_page_cgroup(unsigned long start_pfn, | 175 | int __meminit online_page_cgroup(unsigned long start_pfn, |
162 | unsigned long nr_pages, | 176 | unsigned long nr_pages, |
163 | int nid) | 177 | int nid) |
164 | { | 178 | { |
@@ -183,7 +197,7 @@ int online_page_cgroup(unsigned long start_pfn, | |||
183 | return -ENOMEM; | 197 | return -ENOMEM; |
184 | } | 198 | } |
185 | 199 | ||
186 | int offline_page_cgroup(unsigned long start_pfn, | 200 | int __meminit offline_page_cgroup(unsigned long start_pfn, |
187 | unsigned long nr_pages, int nid) | 201 | unsigned long nr_pages, int nid) |
188 | { | 202 | { |
189 | unsigned long start, end, pfn; | 203 | unsigned long start, end, pfn; |
@@ -197,7 +211,7 @@ int offline_page_cgroup(unsigned long start_pfn, | |||
197 | 211 | ||
198 | } | 212 | } |
199 | 213 | ||
200 | static int page_cgroup_callback(struct notifier_block *self, | 214 | static int __meminit page_cgroup_callback(struct notifier_block *self, |
201 | unsigned long action, void *arg) | 215 | unsigned long action, void *arg) |
202 | { | 216 | { |
203 | struct memory_notify *mn = arg; | 217 | struct memory_notify *mn = arg; |
@@ -207,18 +221,23 @@ static int page_cgroup_callback(struct notifier_block *self, | |||
207 | ret = online_page_cgroup(mn->start_pfn, | 221 | ret = online_page_cgroup(mn->start_pfn, |
208 | mn->nr_pages, mn->status_change_nid); | 222 | mn->nr_pages, mn->status_change_nid); |
209 | break; | 223 | break; |
210 | case MEM_CANCEL_ONLINE: | ||
211 | case MEM_OFFLINE: | 224 | case MEM_OFFLINE: |
212 | offline_page_cgroup(mn->start_pfn, | 225 | offline_page_cgroup(mn->start_pfn, |
213 | mn->nr_pages, mn->status_change_nid); | 226 | mn->nr_pages, mn->status_change_nid); |
214 | break; | 227 | break; |
228 | case MEM_CANCEL_ONLINE: | ||
215 | case MEM_GOING_OFFLINE: | 229 | case MEM_GOING_OFFLINE: |
216 | break; | 230 | break; |
217 | case MEM_ONLINE: | 231 | case MEM_ONLINE: |
218 | case MEM_CANCEL_OFFLINE: | 232 | case MEM_CANCEL_OFFLINE: |
219 | break; | 233 | break; |
220 | } | 234 | } |
221 | ret = notifier_from_errno(ret); | 235 | |
236 | if (ret) | ||
237 | ret = notifier_from_errno(ret); | ||
238 | else | ||
239 | ret = NOTIFY_OK; | ||
240 | |||
222 | return ret; | 241 | return ret; |
223 | } | 242 | } |
224 | 243 | ||
@@ -248,7 +267,7 @@ void __init page_cgroup_init(void) | |||
248 | " want\n"); | 267 | " want\n"); |
249 | } | 268 | } |
250 | 269 | ||
251 | void __init pgdat_page_cgroup_init(struct pglist_data *pgdat) | 270 | void __meminit pgdat_page_cgroup_init(struct pglist_data *pgdat) |
252 | { | 271 | { |
253 | return; | 272 | return; |
254 | } | 273 | } |
@@ -535,7 +535,7 @@ struct kmem_cache *kmem_cache_create(const char *name, size_t size, | |||
535 | struct kmem_cache *c; | 535 | struct kmem_cache *c; |
536 | 536 | ||
537 | c = slob_alloc(sizeof(struct kmem_cache), | 537 | c = slob_alloc(sizeof(struct kmem_cache), |
538 | flags, ARCH_KMALLOC_MINALIGN, -1); | 538 | GFP_KERNEL, ARCH_KMALLOC_MINALIGN, -1); |
539 | 539 | ||
540 | if (c) { | 540 | if (c) { |
541 | c->name = name; | 541 | c->name = name; |
@@ -2931,8 +2931,10 @@ static int slab_memory_callback(struct notifier_block *self, | |||
2931 | case MEM_CANCEL_OFFLINE: | 2931 | case MEM_CANCEL_OFFLINE: |
2932 | break; | 2932 | break; |
2933 | } | 2933 | } |
2934 | 2934 | if (ret) | |
2935 | ret = notifier_from_errno(ret); | 2935 | ret = notifier_from_errno(ret); |
2936 | else | ||
2937 | ret = NOTIFY_OK; | ||
2936 | return ret; | 2938 | return ret; |
2937 | } | 2939 | } |
2938 | 2940 | ||
@@ -3595,7 +3597,7 @@ static int list_locations(struct kmem_cache *s, char *buf, | |||
3595 | for (i = 0; i < t.count; i++) { | 3597 | for (i = 0; i < t.count; i++) { |
3596 | struct location *l = &t.loc[i]; | 3598 | struct location *l = &t.loc[i]; |
3597 | 3599 | ||
3598 | if (len > PAGE_SIZE - 100) | 3600 | if (len > PAGE_SIZE - KSYM_SYMBOL_LEN - 100) |
3599 | break; | 3601 | break; |
3600 | len += sprintf(buf + len, "%7ld ", l->count); | 3602 | len += sprintf(buf + len, "%7ld ", l->count); |
3601 | 3603 | ||
diff --git a/mm/sparse.c b/mm/sparse.c index 39db301b920d..083f5b63e7a8 100644 --- a/mm/sparse.c +++ b/mm/sparse.c | |||
@@ -570,7 +570,7 @@ static void free_section_usemap(struct page *memmap, unsigned long *usemap) | |||
570 | * set. If this is <=0, then that means that the passed-in | 570 | * set. If this is <=0, then that means that the passed-in |
571 | * map was not consumed and must be freed. | 571 | * map was not consumed and must be freed. |
572 | */ | 572 | */ |
573 | int sparse_add_one_section(struct zone *zone, unsigned long start_pfn, | 573 | int __meminit sparse_add_one_section(struct zone *zone, unsigned long start_pfn, |
574 | int nr_pages) | 574 | int nr_pages) |
575 | { | 575 | { |
576 | unsigned long section_nr = pfn_to_section_nr(start_pfn); | 576 | unsigned long section_nr = pfn_to_section_nr(start_pfn); |
@@ -299,7 +299,6 @@ void lru_add_drain(void) | |||
299 | put_cpu(); | 299 | put_cpu(); |
300 | } | 300 | } |
301 | 301 | ||
302 | #if defined(CONFIG_NUMA) || defined(CONFIG_UNEVICTABLE_LRU) | ||
303 | static void lru_add_drain_per_cpu(struct work_struct *dummy) | 302 | static void lru_add_drain_per_cpu(struct work_struct *dummy) |
304 | { | 303 | { |
305 | lru_add_drain(); | 304 | lru_add_drain(); |
@@ -313,18 +312,6 @@ int lru_add_drain_all(void) | |||
313 | return schedule_on_each_cpu(lru_add_drain_per_cpu); | 312 | return schedule_on_each_cpu(lru_add_drain_per_cpu); |
314 | } | 313 | } |
315 | 314 | ||
316 | #else | ||
317 | |||
318 | /* | ||
319 | * Returns 0 for success | ||
320 | */ | ||
321 | int lru_add_drain_all(void) | ||
322 | { | ||
323 | lru_add_drain(); | ||
324 | return 0; | ||
325 | } | ||
326 | #endif | ||
327 | |||
328 | /* | 315 | /* |
329 | * Batched page_cache_release(). Decrement the reference count on all the | 316 | * Batched page_cache_release(). Decrement the reference count on all the |
330 | * passed pages. If it fell to zero then remove the page from the LRU and | 317 | * passed pages. If it fell to zero then remove the page from the LRU and |
@@ -445,6 +432,7 @@ void ____pagevec_lru_add(struct pagevec *pvec, enum lru_list lru) | |||
445 | for (i = 0; i < pagevec_count(pvec); i++) { | 432 | for (i = 0; i < pagevec_count(pvec); i++) { |
446 | struct page *page = pvec->pages[i]; | 433 | struct page *page = pvec->pages[i]; |
447 | struct zone *pagezone = page_zone(page); | 434 | struct zone *pagezone = page_zone(page); |
435 | int file; | ||
448 | 436 | ||
449 | if (pagezone != zone) { | 437 | if (pagezone != zone) { |
450 | if (zone) | 438 | if (zone) |
@@ -456,8 +444,12 @@ void ____pagevec_lru_add(struct pagevec *pvec, enum lru_list lru) | |||
456 | VM_BUG_ON(PageUnevictable(page)); | 444 | VM_BUG_ON(PageUnevictable(page)); |
457 | VM_BUG_ON(PageLRU(page)); | 445 | VM_BUG_ON(PageLRU(page)); |
458 | SetPageLRU(page); | 446 | SetPageLRU(page); |
459 | if (is_active_lru(lru)) | 447 | file = is_file_lru(lru); |
448 | zone->recent_scanned[file]++; | ||
449 | if (is_active_lru(lru)) { | ||
460 | SetPageActive(page); | 450 | SetPageActive(page); |
451 | zone->recent_rotated[file]++; | ||
452 | } | ||
461 | add_page_to_lru_list(zone, page, lru); | 453 | add_page_to_lru_list(zone, page, lru); |
462 | } | 454 | } |
463 | if (zone) | 455 | if (zone) |
diff --git a/mm/swapfile.c b/mm/swapfile.c index 90cb67a5417c..54a9f87e5162 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c | |||
@@ -1462,6 +1462,15 @@ static int __init procswaps_init(void) | |||
1462 | __initcall(procswaps_init); | 1462 | __initcall(procswaps_init); |
1463 | #endif /* CONFIG_PROC_FS */ | 1463 | #endif /* CONFIG_PROC_FS */ |
1464 | 1464 | ||
1465 | #ifdef MAX_SWAPFILES_CHECK | ||
1466 | static int __init max_swapfiles_check(void) | ||
1467 | { | ||
1468 | MAX_SWAPFILES_CHECK(); | ||
1469 | return 0; | ||
1470 | } | ||
1471 | late_initcall(max_swapfiles_check); | ||
1472 | #endif | ||
1473 | |||
1465 | /* | 1474 | /* |
1466 | * Written 01/25/92 by Simmule Turner, heavily changed by Linus. | 1475 | * Written 01/25/92 by Simmule Turner, heavily changed by Linus. |
1467 | * | 1476 | * |
diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 30f826d484f0..1ddb77ba3995 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c | |||
@@ -77,7 +77,6 @@ static void vunmap_page_range(unsigned long addr, unsigned long end) | |||
77 | 77 | ||
78 | BUG_ON(addr >= end); | 78 | BUG_ON(addr >= end); |
79 | pgd = pgd_offset_k(addr); | 79 | pgd = pgd_offset_k(addr); |
80 | flush_cache_vunmap(addr, end); | ||
81 | do { | 80 | do { |
82 | next = pgd_addr_end(addr, end); | 81 | next = pgd_addr_end(addr, end); |
83 | if (pgd_none_or_clear_bad(pgd)) | 82 | if (pgd_none_or_clear_bad(pgd)) |
@@ -543,9 +542,10 @@ static void purge_vmap_area_lazy(void) | |||
543 | } | 542 | } |
544 | 543 | ||
545 | /* | 544 | /* |
546 | * Free and unmap a vmap area | 545 | * Free and unmap a vmap area, caller ensuring flush_cache_vunmap had been |
546 | * called for the correct range previously. | ||
547 | */ | 547 | */ |
548 | static void free_unmap_vmap_area(struct vmap_area *va) | 548 | static void free_unmap_vmap_area_noflush(struct vmap_area *va) |
549 | { | 549 | { |
550 | va->flags |= VM_LAZY_FREE; | 550 | va->flags |= VM_LAZY_FREE; |
551 | atomic_add((va->va_end - va->va_start) >> PAGE_SHIFT, &vmap_lazy_nr); | 551 | atomic_add((va->va_end - va->va_start) >> PAGE_SHIFT, &vmap_lazy_nr); |
@@ -553,6 +553,15 @@ static void free_unmap_vmap_area(struct vmap_area *va) | |||
553 | try_purge_vmap_area_lazy(); | 553 | try_purge_vmap_area_lazy(); |
554 | } | 554 | } |
555 | 555 | ||
556 | /* | ||
557 | * Free and unmap a vmap area | ||
558 | */ | ||
559 | static void free_unmap_vmap_area(struct vmap_area *va) | ||
560 | { | ||
561 | flush_cache_vunmap(va->va_start, va->va_end); | ||
562 | free_unmap_vmap_area_noflush(va); | ||
563 | } | ||
564 | |||
556 | static struct vmap_area *find_vmap_area(unsigned long addr) | 565 | static struct vmap_area *find_vmap_area(unsigned long addr) |
557 | { | 566 | { |
558 | struct vmap_area *va; | 567 | struct vmap_area *va; |
@@ -734,7 +743,7 @@ static void free_vmap_block(struct vmap_block *vb) | |||
734 | spin_unlock(&vmap_block_tree_lock); | 743 | spin_unlock(&vmap_block_tree_lock); |
735 | BUG_ON(tmp != vb); | 744 | BUG_ON(tmp != vb); |
736 | 745 | ||
737 | free_unmap_vmap_area(vb->va); | 746 | free_unmap_vmap_area_noflush(vb->va); |
738 | call_rcu(&vb->rcu_head, rcu_free_vb); | 747 | call_rcu(&vb->rcu_head, rcu_free_vb); |
739 | } | 748 | } |
740 | 749 | ||
@@ -796,6 +805,9 @@ static void vb_free(const void *addr, unsigned long size) | |||
796 | 805 | ||
797 | BUG_ON(size & ~PAGE_MASK); | 806 | BUG_ON(size & ~PAGE_MASK); |
798 | BUG_ON(size > PAGE_SIZE*VMAP_MAX_ALLOC); | 807 | BUG_ON(size > PAGE_SIZE*VMAP_MAX_ALLOC); |
808 | |||
809 | flush_cache_vunmap((unsigned long)addr, (unsigned long)addr + size); | ||
810 | |||
799 | order = get_order(size); | 811 | order = get_order(size); |
800 | 812 | ||
801 | offset = (unsigned long)addr & (VMAP_BLOCK_SIZE - 1); | 813 | offset = (unsigned long)addr & (VMAP_BLOCK_SIZE - 1); |
@@ -1705,7 +1717,7 @@ static int s_show(struct seq_file *m, void *p) | |||
1705 | v->addr, v->addr + v->size, v->size); | 1717 | v->addr, v->addr + v->size, v->size); |
1706 | 1718 | ||
1707 | if (v->caller) { | 1719 | if (v->caller) { |
1708 | char buff[2 * KSYM_NAME_LEN]; | 1720 | char buff[KSYM_SYMBOL_LEN]; |
1709 | 1721 | ||
1710 | seq_putc(m, ' '); | 1722 | seq_putc(m, ' '); |
1711 | sprint_symbol(buff, (unsigned long)v->caller); | 1723 | sprint_symbol(buff, (unsigned long)v->caller); |
diff --git a/mm/vmscan.c b/mm/vmscan.c index 7ea1440b53db..62e7f62fb559 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c | |||
@@ -1248,6 +1248,7 @@ static void shrink_active_list(unsigned long nr_pages, struct zone *zone, | |||
1248 | list_add(&page->lru, &l_inactive); | 1248 | list_add(&page->lru, &l_inactive); |
1249 | } | 1249 | } |
1250 | 1250 | ||
1251 | spin_lock_irq(&zone->lru_lock); | ||
1251 | /* | 1252 | /* |
1252 | * Count referenced pages from currently used mappings as | 1253 | * Count referenced pages from currently used mappings as |
1253 | * rotated, even though they are moved to the inactive list. | 1254 | * rotated, even though they are moved to the inactive list. |
@@ -1263,7 +1264,6 @@ static void shrink_active_list(unsigned long nr_pages, struct zone *zone, | |||
1263 | 1264 | ||
1264 | pgmoved = 0; | 1265 | pgmoved = 0; |
1265 | lru = LRU_BASE + file * LRU_FILE; | 1266 | lru = LRU_BASE + file * LRU_FILE; |
1266 | spin_lock_irq(&zone->lru_lock); | ||
1267 | while (!list_empty(&l_inactive)) { | 1267 | while (!list_empty(&l_inactive)) { |
1268 | page = lru_to_page(&l_inactive); | 1268 | page = lru_to_page(&l_inactive); |
1269 | prefetchw_prev_lru_page(page, &l_inactive, flags); | 1269 | prefetchw_prev_lru_page(page, &l_inactive, flags); |