Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'akpm' (Fixes from Andrew)

Merge misc fixes from Andrew Morton:
"Seven fixes, some of them fingers-crossed :("

* emailed patches from Andrew Morton <akpm@linux-foundation.org>: (7 patches)
drivers/rtc/rtc-tps65910.c: fix invalid pointer access on _remove()
mm: soft offline: split thp at the beginning of soft_offline_page()
mm: avoid waking kswapd for THP allocations when compaction is deferred or contended
revert "Revert "mm: remove __GFP_NO_KSWAPD""
mm: vmscan: fix endless loop in kswapd balancing
mm/vmemmap: fix wrong use of virt_to_page
mm: compaction: fix return value of capture_free_page()

+68 -43
+2 -4
drivers/mtd/mtdcore.c
··· 1077 1077 * until the request succeeds or until the allocation size falls below 1078 1078 * the system page size. This attempts to make sure it does not adversely 1079 1079 * impact system performance, so when allocating more than one page, we 1080 - * ask the memory allocator to avoid re-trying, swapping, writing back 1081 - * or performing I/O. 1080 + * ask the memory allocator to avoid re-trying. 1082 1081 * 1083 1082 * Note, this function also makes sure that the allocated buffer is aligned to 1084 1083 * the MTD device's min. I/O unit, i.e. the "mtd->writesize" value. ··· 1091 1092 */ 1092 1093 void *mtd_kmalloc_up_to(const struct mtd_info *mtd, size_t *size) 1093 1094 { 1094 - gfp_t flags = __GFP_NOWARN | __GFP_WAIT | 1095 - __GFP_NORETRY | __GFP_NO_KSWAPD; 1095 + gfp_t flags = __GFP_NOWARN | __GFP_WAIT | __GFP_NORETRY; 1096 1096 size_t min_alloc = max_t(size_t, mtd->writesize, PAGE_SIZE); 1097 1097 void *kbuf; 1098 1098
+3 -3
drivers/rtc/rtc-tps65910.c
··· 288 288 static int __devexit tps65910_rtc_remove(struct platform_device *pdev) 289 289 { 290 290 /* leave rtc running, but disable irqs */ 291 - struct rtc_device *rtc = platform_get_drvdata(pdev); 291 + struct tps65910_rtc *tps_rtc = platform_get_drvdata(pdev); 292 292 293 - tps65910_rtc_alarm_irq_enable(&rtc->dev, 0); 293 + tps65910_rtc_alarm_irq_enable(&pdev->dev, 0); 294 294 295 - rtc_device_unregister(rtc); 295 + rtc_device_unregister(tps_rtc->rtc); 296 296 return 0; 297 297 } 298 298
+5 -8
include/linux/gfp.h
··· 30 30 #define ___GFP_HARDWALL 0x20000u 31 31 #define ___GFP_THISNODE 0x40000u 32 32 #define ___GFP_RECLAIMABLE 0x80000u 33 - #define ___GFP_NOTRACK 0x200000u 34 - #define ___GFP_NO_KSWAPD 0x400000u 35 - #define ___GFP_OTHER_NODE 0x800000u 36 - #define ___GFP_WRITE 0x1000000u 33 + #define ___GFP_NOTRACK 0x100000u 34 + #define ___GFP_OTHER_NODE 0x200000u 35 + #define ___GFP_WRITE 0x400000u 37 36 38 37 /* 39 38 * GFP bitmasks.. ··· 85 86 #define __GFP_RECLAIMABLE ((__force gfp_t)___GFP_RECLAIMABLE) /* Page is reclaimable */ 86 87 #define __GFP_NOTRACK ((__force gfp_t)___GFP_NOTRACK) /* Don't track with kmemcheck */ 87 88 88 - #define __GFP_NO_KSWAPD ((__force gfp_t)___GFP_NO_KSWAPD) 89 89 #define __GFP_OTHER_NODE ((__force gfp_t)___GFP_OTHER_NODE) /* On behalf of other node */ 90 90 #define __GFP_WRITE ((__force gfp_t)___GFP_WRITE) /* Allocator intends to dirty page */ 91 91 ··· 94 96 */ 95 97 #define __GFP_NOTRACK_FALSE_POSITIVE (__GFP_NOTRACK) 96 98 97 - #define __GFP_BITS_SHIFT 25 /* Room for N __GFP_FOO bits */ 99 + #define __GFP_BITS_SHIFT 23 /* Room for N __GFP_FOO bits */ 98 100 #define __GFP_BITS_MASK ((__force gfp_t)((1 << __GFP_BITS_SHIFT) - 1)) 99 101 100 102 /* This equals 0, but use constants in case they ever change */ ··· 114 116 __GFP_MOVABLE) 115 117 #define GFP_IOFS (__GFP_IO | __GFP_FS) 116 118 #define GFP_TRANSHUGE (GFP_HIGHUSER_MOVABLE | __GFP_COMP | \ 117 - __GFP_NOMEMALLOC | __GFP_NORETRY | __GFP_NOWARN | \ 118 - __GFP_NO_KSWAPD) 119 + __GFP_NOMEMALLOC | __GFP_NORETRY | __GFP_NOWARN) 119 120 120 121 #ifdef CONFIG_NUMA 121 122 #define GFP_THISNODE (__GFP_THISNODE | __GFP_NOWARN | __GFP_NORETRY)
-1
include/trace/events/gfpflags.h
··· 36 36 {(unsigned long)__GFP_RECLAIMABLE, "GFP_RECLAIMABLE"}, \ 37 37 {(unsigned long)__GFP_MOVABLE, "GFP_MOVABLE"}, \ 38 38 {(unsigned long)__GFP_NOTRACK, "GFP_NOTRACK"}, \ 39 - {(unsigned long)__GFP_NO_KSWAPD, "GFP_NO_KSWAPD"}, \ 40 39 {(unsigned long)__GFP_OTHER_NODE, "GFP_OTHER_NODE"} \ 41 40 ) : "GFP_NOWAIT" 42 41
+8
mm/memory-failure.c
··· 1476 1476 { 1477 1477 int ret; 1478 1478 unsigned long pfn = page_to_pfn(page); 1479 + struct page *hpage = compound_trans_head(page); 1479 1480 1480 1481 if (PageHuge(page)) 1481 1482 return soft_offline_huge_page(page, flags); 1483 + if (PageTransHuge(hpage)) { 1484 + if (PageAnon(hpage) && unlikely(split_huge_page(hpage))) { 1485 + pr_info("soft offline: %#lx: failed to split THP\n", 1486 + pfn); 1487 + return -EBUSY; 1488 + } 1489 + } 1482 1490 1483 1491 ret = get_any_page(page, pfn, flags); 1484 1492 if (ret < 0)
+28 -12
mm/page_alloc.c
··· 1422 1422 } 1423 1423 } 1424 1424 1425 - return 1UL << order; 1425 + return 1UL << alloc_order; 1426 1426 } 1427 1427 1428 1428 /* ··· 2378 2378 return !!(gfp_to_alloc_flags(gfp_mask) & ALLOC_NO_WATERMARKS); 2379 2379 } 2380 2380 2381 + /* Returns true if the allocation is likely for THP */ 2382 + static bool is_thp_alloc(gfp_t gfp_mask, unsigned int order) 2383 + { 2384 + if (order == pageblock_order && 2385 + (gfp_mask & (__GFP_MOVABLE|__GFP_REPEAT)) == __GFP_MOVABLE) 2386 + return true; 2387 + return false; 2388 + } 2389 + 2381 2390 static inline struct page * 2382 2391 __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order, 2383 2392 struct zonelist *zonelist, enum zone_type high_zoneidx, ··· 2425 2416 goto nopage; 2426 2417 2427 2418 restart: 2428 - if (!(gfp_mask & __GFP_NO_KSWAPD)) 2419 + /* The decision whether to wake kswapd for THP is made later */ 2420 + if (!is_thp_alloc(gfp_mask, order)) 2429 2421 wake_all_kswapd(order, zonelist, high_zoneidx, 2430 - zone_idx(preferred_zone)); 2422 + zone_idx(preferred_zone)); 2431 2423 2432 2424 /* 2433 2425 * OK, we're below the kswapd watermark and have kicked background ··· 2498 2488 goto got_pg; 2499 2489 sync_migration = true; 2500 2490 2501 - /* 2502 - * If compaction is deferred for high-order allocations, it is because 2503 - * sync compaction recently failed. In this is the case and the caller 2504 - * requested a movable allocation that does not heavily disrupt the 2505 - * system then fail the allocation instead of entering direct reclaim. 2506 - */ 2507 - if ((deferred_compaction || contended_compaction) && 2508 - (gfp_mask & __GFP_NO_KSWAPD)) 2509 - goto nopage; 2491 + if (is_thp_alloc(gfp_mask, order)) { 2492 + /* 2493 + * If compaction is deferred for high-order allocations, it is 2494 + * because sync compaction recently failed. If this is the case 2495 + * and the caller requested a movable allocation that does not 2496 + * heavily disrupt the system then fail the allocation instead 2497 + * of entering direct reclaim. 2498 + */ 2499 + if (deferred_compaction || contended_compaction) 2500 + goto nopage; 2501 + 2502 + /* If process is willing to reclaim/compact then wake kswapd */ 2503 + wake_all_kswapd(order, zonelist, high_zoneidx, 2504 + zone_idx(preferred_zone)); 2505 + } 2510 2506 2511 2507 /* Try direct reclaim and then allocating */ 2512 2508 page = __alloc_pages_direct_reclaim(gfp_mask, order,
+4 -6
mm/sparse.c
··· 617 617 { 618 618 return; /* XXX: Not implemented yet */ 619 619 } 620 - static void free_map_bootmem(struct page *page, unsigned long nr_pages) 620 + static void free_map_bootmem(struct page *memmap, unsigned long nr_pages) 621 621 { 622 622 } 623 623 #else ··· 658 658 get_order(sizeof(struct page) * nr_pages)); 659 659 } 660 660 661 - static void free_map_bootmem(struct page *page, unsigned long nr_pages) 661 + static void free_map_bootmem(struct page *memmap, unsigned long nr_pages) 662 662 { 663 663 unsigned long maps_section_nr, removing_section_nr, i; 664 664 unsigned long magic; 665 + struct page *page = virt_to_page(memmap); 665 666 666 667 for (i = 0; i < nr_pages; i++, page++) { 667 668 magic = (unsigned long) page->lru.next; ··· 711 710 */ 712 711 713 712 if (memmap) { 714 - struct page *memmap_page; 715 - memmap_page = virt_to_page(memmap); 716 - 717 713 nr_pages = PAGE_ALIGN(PAGES_PER_SECTION * sizeof(struct page)) 718 714 >> PAGE_SHIFT; 719 715 720 - free_map_bootmem(memmap_page, nr_pages); 716 + free_map_bootmem(memmap, nr_pages); 721 717 } 722 718 } 723 719
+18 -9
mm/vmscan.c
··· 2414 2414 } while (memcg); 2415 2415 } 2416 2416 2417 + static bool zone_balanced(struct zone *zone, int order, 2418 + unsigned long balance_gap, int classzone_idx) 2419 + { 2420 + if (!zone_watermark_ok_safe(zone, order, high_wmark_pages(zone) + 2421 + balance_gap, classzone_idx, 0)) 2422 + return false; 2423 + 2424 + if (COMPACTION_BUILD && order && !compaction_suitable(zone, order)) 2425 + return false; 2426 + 2427 + return true; 2428 + } 2429 + 2417 2430 /* 2418 2431 * pgdat_balanced is used when checking if a node is balanced for high-order 2419 2432 * allocations. Only zones that meet watermarks and are in a zone allowed ··· 2505 2492 continue; 2506 2493 } 2507 2494 2508 - if (!zone_watermark_ok_safe(zone, order, high_wmark_pages(zone), 2509 - i, 0)) 2495 + if (!zone_balanced(zone, order, 0, i)) 2510 2496 all_zones_ok = false; 2511 2497 else 2512 2498 balanced += zone->present_pages; ··· 2614 2602 break; 2615 2603 } 2616 2604 2617 - if (!zone_watermark_ok_safe(zone, order, 2618 - high_wmark_pages(zone), 0, 0)) { 2605 + if (!zone_balanced(zone, order, 0, 0)) { 2619 2606 end_zone = i; 2620 2607 break; 2621 2608 } else { ··· 2690 2679 testorder = 0; 2691 2680 2692 2681 if ((buffer_heads_over_limit && is_highmem_idx(i)) || 2693 - !zone_watermark_ok_safe(zone, testorder, 2694 - high_wmark_pages(zone) + balance_gap, 2695 - end_zone, 0)) { 2682 + !zone_balanced(zone, testorder, 2683 + balance_gap, end_zone)) { 2696 2684 shrink_zone(zone, &sc); 2697 2685 2698 2686 reclaim_state->reclaimed_slab = 0; ··· 2718 2708 continue; 2719 2709 } 2720 2710 2721 - if (!zone_watermark_ok_safe(zone, testorder, 2722 - high_wmark_pages(zone), end_zone, 0)) { 2711 + if (!zone_balanced(zone, testorder, 0, end_zone)) { 2723 2712 all_zones_ok = 0; 2724 2713 /* 2725 2714 * We are still under min water mark. This