History

Merge branch 'akpm' (patches from Andrew)

Merge fixes from Andrew Morton: "20 fixes" * emailed patches from Andrew Morton <akpm@linux-foundation.org>: Documentation/sysctl/vm.txt: update numa_zonelist_order description lib/stackdepot.c: allow the stack trace hash to be zero rapidio: fix potential NULL pointer dereference mm/memory-failure: fix race with compound page split/merge ocfs2/dlm: return zero if deref_done message is successfully handled Ananth has moved kcov: don't profile branches in kcov kcov: don't trace the code coverage code mm: wake kcompactd before kswapd's short sleep .mailmap: add Frank Rowand mm/hwpoison: fix wrong num_poisoned_pages accounting mm: call swap_slot_free_notify() with page lock held mm: vmscan: reclaim highmem zone if buffer_heads is over limit numa: fix /proc/<pid>/numa_maps for THP mm/huge_memory: replace VM_NO_THP VM_BUG_ON with actual VMA check mailmap: fix Krzysztof Kozlowski's misspelled name thp: keep huge zero page pinned until tlb flush mm: exclude HugeTLB pages from THP page_mapped() logic kexec: export OFFSET(page.compound_head) to find out compound tail page kexec: update VMCOREINFO for compound_order/dtor

Linus Torvalds committed 10 years ago

Commit 1d003af2 parents 92c19ea 7c88a2918 files · +151 −47Browse files

Unified · Split

18 files
  1. .mailmap +4 −0
  2. Documentation/sysctl/vm.txt +10 −9
  3. MAINTAINERS +1 −1
  4. drivers/rapidio/devices/rio_mport_cdev.c +2 −2
  5. fs/ocfs2/dlm/dlmmaster.c +2 −0
  6. fs/proc/task_mmu.c +30 −3
  7. include/linux/huge_mm.h +5 −0
  8. include/linux/mm.h +4 −0
  9. kernel/kcov.c +2 −1
  10. kernel/kexec_core.c +5 −2
  11. lib/stackdepot.c +0 −4
  12. mm/huge_memory.c +5 −7
  13. mm/memory-failure.c +9 −1
  14. mm/memory.c +40 −0
  15. mm/migrate.c +7 −1
  16. mm/page_io.c +5 −1
  17. mm/swap.c +5 −0
  18. mm/vmscan.c +15 −15
.mailmap+4−0
@@ -48,6 +48,9 @@ Felix Kuhling <fxkuehl@gmx.de> · 47 unmodified lines
4848 Felix Moeller <felix@derklecks.de>
4949 Filipe Lautert <filipe@icewall.org>
5050 Franck Bui-Huu <vagabon.xyz@gmail.com>
51+Frank Rowand <frowand.list@gmail.com> <frowand@mvista.com>
52+Frank Rowand <frowand.list@gmail.com> <frank.rowand@am.sony.com>
53+Frank Rowand <frowand.list@gmail.com> <frank.rowand@sonymobile.com>
5154 Frank Zago <fzago@systemfabricworks.com>
5255 Greg Kroah-Hartman <greg@echidna.(none)>
5356 Greg Kroah-Hartman <gregkh@suse.de>
@@ -79,6 +82,7 @@ Kay Sievers <kay.sievers@vrfy.org> · 25 unmodified lines
7982 Kenneth W Chen <kenneth.w.chen@intel.com>
8083 Konstantin Khlebnikov <koct9i@gmail.com> <k.khlebnikov@samsung.com>
8184 Koushik <raghavendra.koushik@neterion.com>
85+Krzysztof Kozlowski <krzk@kernel.org> <k.kozlowski.k@gmail.com>
8286 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
8387 Leonid I Ananiev <leonid.i.ananiev@intel.com>
8488 Linas Vepstas <linas@austin.ibm.com>
Documentation/sysctl/vm.txt+10−9
@@ -581,15 +581,16 @@ Specify "[Nn]ode" for node order · 580 unmodified lines
581581 "Zone Order" orders the zonelists by zone type, then by node within each
582582 zone. Specify "[Zz]one" for zone order.
583583
584−Specify "[Dd]efault" to request automatic configuration. Autoconfiguration
585−will select "node" order in following case.
586−(1) if the DMA zone does not exist or
587−(2) if the DMA zone comprises greater than 50% of the available memory or
588−(3) if any node's DMA zone comprises greater than 70% of its local memory and
589− the amount of local memory is big enough.
590−
591−Otherwise, "zone" order will be selected. Default order is recommended unless
592−this is causing problems for your system/application.
584+Specify "[Dd]efault" to request automatic configuration.
585+
586+On 32-bit, the Normal zone needs to be preserved for allocations accessible
587+by the kernel, so "zone" order will be selected.
588+
589+On 64-bit, devices that require DMA32/DMA are relatively rare, so "node"
590+order will be selected.
591+
592+Default order is recommended unless this is causing problems for your
593+system/application.
593594
594595 ==============================================================
595596
MAINTAINERS+1−1
@@ -6400,7 +6400,7 @@ F: mm/kmemleak.c · 6399 unmodified lines
64006400 F: mm/kmemleak-test.c
64016401
64026402 KPROBES
6403−M: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
6403+M: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>
64046404 M: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
64056405 M: "David S. Miller" <davem@davemloft.net>
64066406 M: Masami Hiramatsu <mhiramat@kernel.org>
drivers/rapidio/devices/rio_mport_cdev.c+2−2
@@ -2669,9 +2669,9 @@ static int __init mport_init(void) · 2668 unmodified lines
26692669
26702670 /* Create device class needed by udev */
26712671 dev_class = class_create(THIS_MODULE, DRV_NAME);
2672− if (!dev_class) {
2672+ if (IS_ERR(dev_class)) {
26732673 rmcd_error("Unable to create " DRV_NAME " class");
2674− return -EINVAL;
2674+ return PTR_ERR(dev_class);
26752675 }
26762676
26772677 ret = alloc_chrdev_region(&dev_number, 0, RIO_MAX_MPORTS, DRV_NAME);
fs/ocfs2/dlm/dlmmaster.c+2−0
@@ -2455,6 +2455,8 @@ int dlm_deref_lockres_done_handler(struct o2net_msg *msg, u32 len, void *data, · 2454 unmodified lines
24552455
24562456 spin_unlock(&dlm->spinlock);
24572457
2458+ ret = 0;
2459+
24582460 done:
24592461 dlm_put(dlm);
24602462 return ret;
fs/proc/task_mmu.c+30−3
@@ -1518,6 +1518,32 @@ static struct page *can_gather_numa_stats(pte_t pte, struct vm_area_struct *vma, · 1517 unmodified lines
15181518 return page;
15191519 }
15201520
1521+#ifdef CONFIG_TRANSPARENT_HUGEPAGE
1522+static struct page *can_gather_numa_stats_pmd(pmd_t pmd,
1523+ struct vm_area_struct *vma,
1524+ unsigned long addr)
1525+{
1526+ struct page *page;
1527+ int nid;
1528+
1529+ if (!pmd_present(pmd))
1530+ return NULL;
1531+
1532+ page = vm_normal_page_pmd(vma, addr, pmd);
1533+ if (!page)
1534+ return NULL;
1535+
1536+ if (PageReserved(page))
1537+ return NULL;
1538+
1539+ nid = page_to_nid(page);
1540+ if (!node_isset(nid, node_states[N_MEMORY]))
1541+ return NULL;
1542+
1543+ return page;
1544+}
1545+#endif
1546+
15211547 static int gather_pte_stats(pmd_t *pmd, unsigned long addr,
15221548 unsigned long end, struct mm_walk *walk)
15231549 {
@@ -1527,14 +1553,14 @@ static int gather_pte_stats(pmd_t *pmd, unsigned long addr, · 3 unmodified lines
15271553 pte_t *orig_pte;
15281554 pte_t *pte;
15291555
1556+#ifdef CONFIG_TRANSPARENT_HUGEPAGE
15301557 ptl = pmd_trans_huge_lock(pmd, vma);
15311558 if (ptl) {
1532− pte_t huge_pte = *(pte_t *)pmd;
15331559 struct page *page;
15341560
1535− page = can_gather_numa_stats(huge_pte, vma, addr);
1561+ page = can_gather_numa_stats_pmd(*pmd, vma, addr);
15361562 if (page)
1537− gather_stats(page, md, pte_dirty(huge_pte),
1563+ gather_stats(page, md, pmd_dirty(*pmd),
15381564 HPAGE_PMD_SIZE/PAGE_SIZE);
15391565 spin_unlock(ptl);
15401566 return 0;
@@ -1542,6 +1568,7 @@ static int gather_pte_stats(pmd_t *pmd, unsigned long addr, · 1 unmodified line
15421568
15431569 if (pmd_trans_unstable(pmd))
15441570 return 0;
1571+#endif
15451572 orig_pte = pte = pte_offset_map_lock(walk->mm, pmd, addr, &ptl);
15461573 do {
15471574 struct page *page = can_gather_numa_stats(*pte, vma, addr);
include/linux/huge_mm.h+5−0
@@ -152,6 +152,7 @@ static inline bool is_huge_zero_pmd(pmd_t pmd) · 151 unmodified lines
152152 }
153153
154154 struct page *get_huge_zero_page(void);
155+void put_huge_zero_page(void);
155156
156157 #else /* CONFIG_TRANSPARENT_HUGEPAGE */
157158 #define HPAGE_PMD_SHIFT ({ BUILD_BUG(); 0; })
@@ -208,6 +209,10 @@ static inline bool is_huge_zero_page(struct page *page) · 50 unmodified lines
208209 return false;
209210 }
210211
212+static inline void put_huge_zero_page(void)
213+{
214+ BUILD_BUG();
215+}
211216
212217 static inline struct page *follow_devmap_pmd(struct vm_area_struct *vma,
213218 unsigned long addr, pmd_t *pmd, int flags)
include/linux/mm.h+4−0
@@ -1031,6 +1031,8 @@ static inline bool page_mapped(struct page *page) · 1030 unmodified lines
10311031 page = compound_head(page);
10321032 if (atomic_read(compound_mapcount_ptr(page)) >= 0)
10331033 return true;
1034+ if (PageHuge(page))
1035+ return false;
10341036 for (i = 0; i < hpage_nr_pages(page); i++) {
10351037 if (atomic_read(&page[i]._mapcount) >= 0)
10361038 return true;
@@ -1138,6 +1140,8 @@ struct zap_details { · 101 unmodified lines
11381140
11391141 struct page *vm_normal_page(struct vm_area_struct *vma, unsigned long addr,
11401142 pte_t pte);
1143+struct page *vm_normal_page_pmd(struct vm_area_struct *vma, unsigned long addr,
1144+ pmd_t pmd);
11411145
11421146 int zap_vma_ptes(struct vm_area_struct *vma, unsigned long address,
11431147 unsigned long size);
kernel/kcov.c+2−1
@@ -1,5 +1,6 @@
11 #define pr_fmt(fmt) "kcov: " fmt
22
3+#define DISABLE_BRANCH_PROFILING
34 #include <linux/compiler.h>
45 #include <linux/types.h>
56 #include <linux/file.h>
@@ -43,7 +44,7 @@ struct kcov { · 37 unmodified lines
4344 * Entry point from instrumented code.
4445 * This is called once per basic-block/edge.
4546 */
46−void __sanitizer_cov_trace_pc(void)
47+void notrace __sanitizer_cov_trace_pc(void)
4748 {
4849 struct task_struct *t;
4950 enum kcov_mode mode;
kernel/kexec_core.c+5−2
@@ -1415,6 +1415,9 @@ static int __init crash_save_vmcoreinfo_init(void) · 1414 unmodified lines
14151415 VMCOREINFO_OFFSET(page, lru);
14161416 VMCOREINFO_OFFSET(page, _mapcount);
14171417 VMCOREINFO_OFFSET(page, private);
1418+ VMCOREINFO_OFFSET(page, compound_dtor);
1419+ VMCOREINFO_OFFSET(page, compound_order);
1420+ VMCOREINFO_OFFSET(page, compound_head);
14181421 VMCOREINFO_OFFSET(pglist_data, node_zones);
14191422 VMCOREINFO_OFFSET(pglist_data, nr_zones);
14201423 #ifdef CONFIG_FLAT_NODE_MEM_MAP
@@ -1447,8 +1450,8 @@ static int __init crash_save_vmcoreinfo_init(void) · 26 unmodified lines
14471450 #ifdef CONFIG_X86
14481451 VMCOREINFO_NUMBER(KERNEL_IMAGE_SIZE);
14491452 #endif
1450−#ifdef CONFIG_HUGETLBFS
1451− VMCOREINFO_SYMBOL(free_huge_page);
1453+#ifdef CONFIG_HUGETLB_PAGE
1454+ VMCOREINFO_NUMBER(HUGETLB_PAGE_DTOR);
14521455 #endif
14531456
14541457 arch_crash_save_vmcoreinfo();
lib/stackdepot.c+0−4
@@ -210,10 +210,6 @@ depot_stack_handle_t depot_save_stack(struct stack_trace *trace, · 209 unmodified lines
210210 goto fast_exit;
211211
212212 hash = hash_stack(trace->entries, trace->nr_entries);
213− /* Bad luck, we won't store this stack. */
214− if (hash == 0)
215− goto exit;
216−
217213 bucket = &stack_table[hash & STACK_HASH_MASK];
218214
219215 /*
mm/huge_memory.c+5−7
@@ -232,7 +232,7 @@ retry: · 231 unmodified lines
232232 return READ_ONCE(huge_zero_page);
233233 }
234234
235−static void put_huge_zero_page(void)
235+void put_huge_zero_page(void)
236236 {
237237 /*
238238 * Counter should never go to zero here. Only shrinker can put
@@ -1684,12 +1684,12 @@ int zap_huge_pmd(struct mmu_gather *tlb, struct vm_area_struct *vma, · 1445 unmodified lines
16841684 if (vma_is_dax(vma)) {
16851685 spin_unlock(ptl);
16861686 if (is_huge_zero_pmd(orig_pmd))
1687− put_huge_zero_page();
1687+ tlb_remove_page(tlb, pmd_page(orig_pmd));
16881688 } else if (is_huge_zero_pmd(orig_pmd)) {
16891689 pte_free(tlb->mm, pgtable_trans_huge_withdraw(tlb->mm, pmd));
16901690 atomic_long_dec(&tlb->mm->nr_ptes);
16911691 spin_unlock(ptl);
1692− put_huge_zero_page();
1692+ tlb_remove_page(tlb, pmd_page(orig_pmd));
16931693 } else {
16941694 struct page *page = pmd_page(orig_pmd);
16951695 page_remove_rmap(page, true);
@@ -1960,10 +1960,9 @@ int khugepaged_enter_vma_merge(struct vm_area_struct *vma, · 264 unmodified lines
19601960 * page fault if needed.
19611961 */
19621962 return 0;
1963− if (vma->vm_ops)
1963+ if (vma->vm_ops || (vm_flags & VM_NO_THP))
19641964 /* khugepaged not yet working on file or special mappings */
19651965 return 0;
1966− VM_BUG_ON_VMA(vm_flags & VM_NO_THP, vma);
19671966 hstart = (vma->vm_start + ~HPAGE_PMD_MASK) & HPAGE_PMD_MASK;
19681967 hend = vma->vm_end & HPAGE_PMD_MASK;
19691968 if (hstart < hend)
@@ -2352,8 +2351,7 @@ static bool hugepage_vma_check(struct vm_area_struct *vma) · 382 unmodified lines
23522351 return false;
23532352 if (is_vma_temporary_stack(vma))
23542353 return false;
2355− VM_BUG_ON_VMA(vma->vm_flags & VM_NO_THP, vma);
2356− return true;
2354+ return !(vma->vm_flags & VM_NO_THP);
23572355 }
23582356
23592357 static void collapse_huge_page(struct mm_struct *mm,
mm/memory-failure.c+9−1
@@ -888,7 +888,15 @@ int get_hwpoison_page(struct page *page) · 887 unmodified lines
888888 }
889889 }
890890
891− return get_page_unless_zero(head);
891+ if (get_page_unless_zero(head)) {
892+ if (head == compound_head(page))
893+ return 1;
894+
895+ pr_info("MCE: %#lx cannot catch tail\n", page_to_pfn(page));
896+ put_page(head);
897+ }
898+
899+ return 0;
892900 }
893901 EXPORT_SYMBOL_GPL(get_hwpoison_page);
894902
mm/memory.c+40−0
@@ -789,6 +789,46 @@ out: · 788 unmodified lines
789789 return pfn_to_page(pfn);
790790 }
791791
792+#ifdef CONFIG_TRANSPARENT_HUGEPAGE
793+struct page *vm_normal_page_pmd(struct vm_area_struct *vma, unsigned long addr,
794+ pmd_t pmd)
795+{
796+ unsigned long pfn = pmd_pfn(pmd);
797+
798+ /*
799+ * There is no pmd_special() but there may be special pmds, e.g.
800+ * in a direct-access (dax) mapping, so let's just replicate the
801+ * !HAVE_PTE_SPECIAL case from vm_normal_page() here.
802+ */
803+ if (unlikely(vma->vm_flags & (VM_PFNMAP|VM_MIXEDMAP))) {
804+ if (vma->vm_flags & VM_MIXEDMAP) {
805+ if (!pfn_valid(pfn))
806+ return NULL;
807+ goto out;
808+ } else {
809+ unsigned long off;
810+ off = (addr - vma->vm_start) >> PAGE_SHIFT;
811+ if (pfn == vma->vm_pgoff + off)
812+ return NULL;
813+ if (!is_cow_mapping(vma->vm_flags))
814+ return NULL;
815+ }
816+ }
817+
818+ if (is_zero_pfn(pfn))
819+ return NULL;
820+ if (unlikely(pfn > highest_memmap_pfn))
821+ return NULL;
822+
823+ /*
824+ * NOTE! We still have PageReserved() pages in the page tables.
825+ * eg. VDSO mappings can cause them to exist.
826+ */
827+out:
828+ return pfn_to_page(pfn);
829+}
830+#endif
831+
792832 /*
793833 * copy one vm_area from one task to the other. Assumes the page tables
794834 * already present in the new task to be cleared in the whole range
mm/migrate.c+7−1
@@ -975,7 +975,13 @@ out: · 974 unmodified lines
975975 dec_zone_page_state(page, NR_ISOLATED_ANON +
976976 page_is_file_cache(page));
977977 /* Soft-offlined page shouldn't go through lru cache list */
978− if (reason == MR_MEMORY_FAILURE) {
978+ if (reason == MR_MEMORY_FAILURE && rc == MIGRATEPAGE_SUCCESS) {
979+ /*
980+ * With this release, we free successfully migrated
981+ * page and set PG_HWPoison on just freed page
982+ * intentionally. Although it's rather weird, it's how
983+ * HWPoison flag works at the moment.
984+ */
979985 put_page(page);
980986 if (!test_set_page_hwpoison(page))
981987 num_poisoned_pages_inc();
mm/page_io.c+5−1
@@ -353,7 +353,11 @@ int swap_readpage(struct page *page) · 352 unmodified lines
353353
354354 ret = bdev_read_page(sis->bdev, swap_page_sector(page), page);
355355 if (!ret) {
356− swap_slot_free_notify(page);
356+ if (trylock_page(page)) {
357+ swap_slot_free_notify(page);
358+ unlock_page(page);
359+ }
360+
357361 count_vm_event(PSWPIN);
358362 return 0;
359363 }
mm/swap.c+5−0
@@ -728,6 +728,11 @@ void release_pages(struct page **pages, int nr, bool cold) · 727 unmodified lines
728728 zone = NULL;
729729 }
730730
731+ if (is_huge_zero_page(page)) {
732+ put_huge_zero_page();
733+ continue;
734+ }
735+
731736 page = compound_head(page);
732737 if (!put_page_testzero(page))
733738 continue;
mm/vmscan.c+15−15
@@ -2553,7 +2553,7 @@ static bool shrink_zones(struct zonelist *zonelist, struct scan_control *sc) · 2552 unmodified lines
25532553 sc->gfp_mask |= __GFP_HIGHMEM;
25542554
25552555 for_each_zone_zonelist_nodemask(zone, z, zonelist,
2556− requested_highidx, sc->nodemask) {
2556+ gfp_zone(sc->gfp_mask), sc->nodemask) {
25572557 enum zone_type classzone_idx;
25582558
25592559 if (!populated_zone(zone))
@@ -3318,6 +3318,20 @@ static void kswapd_try_to_sleep(pg_data_t *pgdat, int order, · 758 unmodified lines
33183318 /* Try to sleep for a short interval */
33193319 if (prepare_kswapd_sleep(pgdat, order, remaining,
33203320 balanced_classzone_idx)) {
3321+ /*
3322+ * Compaction records what page blocks it recently failed to
3323+ * isolate pages from and skips them in the future scanning.
3324+ * When kswapd is going to sleep, it is reasonable to assume
3325+ * that pages and compaction may succeed so reset the cache.
3326+ */
3327+ reset_isolation_suitable(pgdat);
3328+
3329+ /*
3330+ * We have freed the memory, now we should compact it to make
3331+ * allocation of the requested order possible.
3332+ */
3333+ wakeup_kcompactd(pgdat, order, classzone_idx);
3334+
33213335 remaining = schedule_timeout(HZ/10);
33223336 finish_wait(&pgdat->kswapd_wait, &wait);
33233337 prepare_to_wait(&pgdat->kswapd_wait, &wait, TASK_INTERRUPTIBLE);
@@ -3341,20 +3355,6 @@ static void kswapd_try_to_sleep(pg_data_t *pgdat, int order, · 17 unmodified lines
33413355 */
33423356 set_pgdat_percpu_threshold(pgdat, calculate_normal_threshold);
33433357
3344− /*
3345− * Compaction records what page blocks it recently failed to
3346− * isolate pages from and skips them in the future scanning.
3347− * When kswapd is going to sleep, it is reasonable to assume
3348− * that pages and compaction may succeed so reset the cache.
3349− */
3350− reset_isolation_suitable(pgdat);
3351−
3352− /*
3353− * We have freed the memory, now we should compact it to make
3354− * allocation of the requested order possible.
3355− */
3356− wakeup_kcompactd(pgdat, order, classzone_idx);
3357−
33583358 if (!kthread_should_stop())
33593359 schedule();
33603360

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t