diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-08-31 20:56:56 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-08-31 20:56:56 -0400 |
commit | 1b2614f1dd687d79d413cf34f69b003bbe385709 (patch) | |
tree | ee8235dffc263a9e1113d9935f5bbe920f5a82ec | |
parent | ea25c43179462e342d4a0e66c3f6a5f53514da05 (diff) | |
parent | e66186920bff278b18ebe460c710c7b0e0cfdf6e (diff) |
Merge branch 'akpm' (patches from Andrew)
Merge more fixes from Andrew Morton:
"6 fixes"
* emailed patches from Andrew Morton <akpm@linux-foundation.org>:
scripts/dtc: fix '%zx' warning
include/linux/compiler.h: don't perform compiletime_assert with -O0
mm, madvise: ensure poisoned pages are removed from per-cpu lists
mm, uprobes: fix multiple free of ->uprobes_state.xol_area
kernel/kthread.c: kthread_worker: don't hog the cpu
mm,page_alloc: don't call __node_reclaim() with oom_lock held.
-rw-r--r-- | include/linux/compiler.h | 6 | ||||
-rw-r--r-- | kernel/events/uprobes.c | 2 | ||||
-rw-r--r-- | kernel/fork.c | 8 | ||||
-rw-r--r-- | kernel/kthread.c | 1 | ||||
-rw-r--r-- | mm/madvise.c | 6 | ||||
-rw-r--r-- | mm/page_alloc.c | 9 | ||||
-rw-r--r-- | scripts/dtc/checks.c | 2 |
7 files changed, 27 insertions, 7 deletions
diff --git a/include/linux/compiler.h b/include/linux/compiler.h index eca8ad75e28b..043b60de041e 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h | |||
@@ -517,7 +517,8 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s | |||
517 | # define __compiletime_error_fallback(condition) do { } while (0) | 517 | # define __compiletime_error_fallback(condition) do { } while (0) |
518 | #endif | 518 | #endif |
519 | 519 | ||
520 | #define __compiletime_assert(condition, msg, prefix, suffix) \ | 520 | #ifdef __OPTIMIZE__ |
521 | # define __compiletime_assert(condition, msg, prefix, suffix) \ | ||
521 | do { \ | 522 | do { \ |
522 | bool __cond = !(condition); \ | 523 | bool __cond = !(condition); \ |
523 | extern void prefix ## suffix(void) __compiletime_error(msg); \ | 524 | extern void prefix ## suffix(void) __compiletime_error(msg); \ |
@@ -525,6 +526,9 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s | |||
525 | prefix ## suffix(); \ | 526 | prefix ## suffix(); \ |
526 | __compiletime_error_fallback(__cond); \ | 527 | __compiletime_error_fallback(__cond); \ |
527 | } while (0) | 528 | } while (0) |
529 | #else | ||
530 | # define __compiletime_assert(condition, msg, prefix, suffix) do { } while (0) | ||
531 | #endif | ||
528 | 532 | ||
529 | #define _compiletime_assert(condition, msg, prefix, suffix) \ | 533 | #define _compiletime_assert(condition, msg, prefix, suffix) \ |
530 | __compiletime_assert(condition, msg, prefix, suffix) | 534 | __compiletime_assert(condition, msg, prefix, suffix) |
diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c index 0e137f98a50c..267f6ef91d97 100644 --- a/kernel/events/uprobes.c +++ b/kernel/events/uprobes.c | |||
@@ -1262,8 +1262,6 @@ void uprobe_end_dup_mmap(void) | |||
1262 | 1262 | ||
1263 | void uprobe_dup_mmap(struct mm_struct *oldmm, struct mm_struct *newmm) | 1263 | void uprobe_dup_mmap(struct mm_struct *oldmm, struct mm_struct *newmm) |
1264 | { | 1264 | { |
1265 | newmm->uprobes_state.xol_area = NULL; | ||
1266 | |||
1267 | if (test_bit(MMF_HAS_UPROBES, &oldmm->flags)) { | 1265 | if (test_bit(MMF_HAS_UPROBES, &oldmm->flags)) { |
1268 | set_bit(MMF_HAS_UPROBES, &newmm->flags); | 1266 | set_bit(MMF_HAS_UPROBES, &newmm->flags); |
1269 | /* unconditionally, dup_mmap() skips VM_DONTCOPY vmas */ | 1267 | /* unconditionally, dup_mmap() skips VM_DONTCOPY vmas */ |
diff --git a/kernel/fork.c b/kernel/fork.c index cbbea277b3fb..b7e9e57b71ea 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
@@ -785,6 +785,13 @@ static void mm_init_owner(struct mm_struct *mm, struct task_struct *p) | |||
785 | #endif | 785 | #endif |
786 | } | 786 | } |
787 | 787 | ||
788 | static void mm_init_uprobes_state(struct mm_struct *mm) | ||
789 | { | ||
790 | #ifdef CONFIG_UPROBES | ||
791 | mm->uprobes_state.xol_area = NULL; | ||
792 | #endif | ||
793 | } | ||
794 | |||
788 | static struct mm_struct *mm_init(struct mm_struct *mm, struct task_struct *p, | 795 | static struct mm_struct *mm_init(struct mm_struct *mm, struct task_struct *p, |
789 | struct user_namespace *user_ns) | 796 | struct user_namespace *user_ns) |
790 | { | 797 | { |
@@ -812,6 +819,7 @@ static struct mm_struct *mm_init(struct mm_struct *mm, struct task_struct *p, | |||
812 | #if defined(CONFIG_TRANSPARENT_HUGEPAGE) && !USE_SPLIT_PMD_PTLOCKS | 819 | #if defined(CONFIG_TRANSPARENT_HUGEPAGE) && !USE_SPLIT_PMD_PTLOCKS |
813 | mm->pmd_huge_pte = NULL; | 820 | mm->pmd_huge_pte = NULL; |
814 | #endif | 821 | #endif |
822 | mm_init_uprobes_state(mm); | ||
815 | 823 | ||
816 | if (current->mm) { | 824 | if (current->mm) { |
817 | mm->flags = current->mm->flags & MMF_INIT_MASK; | 825 | mm->flags = current->mm->flags & MMF_INIT_MASK; |
diff --git a/kernel/kthread.c b/kernel/kthread.c index 26db528c1d88..1c19edf82427 100644 --- a/kernel/kthread.c +++ b/kernel/kthread.c | |||
@@ -637,6 +637,7 @@ repeat: | |||
637 | schedule(); | 637 | schedule(); |
638 | 638 | ||
639 | try_to_freeze(); | 639 | try_to_freeze(); |
640 | cond_resched(); | ||
640 | goto repeat; | 641 | goto repeat; |
641 | } | 642 | } |
642 | EXPORT_SYMBOL_GPL(kthread_worker_fn); | 643 | EXPORT_SYMBOL_GPL(kthread_worker_fn); |
diff --git a/mm/madvise.c b/mm/madvise.c index 23ed525bc2bc..4d7d1e5ddba9 100644 --- a/mm/madvise.c +++ b/mm/madvise.c | |||
@@ -613,6 +613,7 @@ static int madvise_inject_error(int behavior, | |||
613 | unsigned long start, unsigned long end) | 613 | unsigned long start, unsigned long end) |
614 | { | 614 | { |
615 | struct page *page; | 615 | struct page *page; |
616 | struct zone *zone; | ||
616 | 617 | ||
617 | if (!capable(CAP_SYS_ADMIN)) | 618 | if (!capable(CAP_SYS_ADMIN)) |
618 | return -EPERM; | 619 | return -EPERM; |
@@ -646,6 +647,11 @@ static int madvise_inject_error(int behavior, | |||
646 | if (ret) | 647 | if (ret) |
647 | return ret; | 648 | return ret; |
648 | } | 649 | } |
650 | |||
651 | /* Ensure that all poisoned pages are removed from per-cpu lists */ | ||
652 | for_each_populated_zone(zone) | ||
653 | drain_all_pages(zone); | ||
654 | |||
649 | return 0; | 655 | return 0; |
650 | } | 656 | } |
651 | #endif | 657 | #endif |
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 7a58eb5757e3..1423da8dd16f 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -3291,10 +3291,13 @@ __alloc_pages_may_oom(gfp_t gfp_mask, unsigned int order, | |||
3291 | /* | 3291 | /* |
3292 | * Go through the zonelist yet one more time, keep very high watermark | 3292 | * Go through the zonelist yet one more time, keep very high watermark |
3293 | * here, this is only to catch a parallel oom killing, we must fail if | 3293 | * here, this is only to catch a parallel oom killing, we must fail if |
3294 | * we're still under heavy pressure. | 3294 | * we're still under heavy pressure. But make sure that this reclaim |
3295 | * attempt shall not depend on __GFP_DIRECT_RECLAIM && !__GFP_NORETRY | ||
3296 | * allocation which will never fail due to oom_lock already held. | ||
3295 | */ | 3297 | */ |
3296 | page = get_page_from_freelist(gfp_mask | __GFP_HARDWALL, order, | 3298 | page = get_page_from_freelist((gfp_mask | __GFP_HARDWALL) & |
3297 | ALLOC_WMARK_HIGH|ALLOC_CPUSET, ac); | 3299 | ~__GFP_DIRECT_RECLAIM, order, |
3300 | ALLOC_WMARK_HIGH|ALLOC_CPUSET, ac); | ||
3298 | if (page) | 3301 | if (page) |
3299 | goto out; | 3302 | goto out; |
3300 | 3303 | ||
diff --git a/scripts/dtc/checks.c b/scripts/dtc/checks.c index 4b72b530c84f..62ea8f83d4a0 100644 --- a/scripts/dtc/checks.c +++ b/scripts/dtc/checks.c | |||
@@ -873,7 +873,7 @@ static void check_simple_bus_reg(struct check *c, struct dt_info *dti, struct no | |||
873 | while (size--) | 873 | while (size--) |
874 | reg = (reg << 32) | fdt32_to_cpu(*(cells++)); | 874 | reg = (reg << 32) | fdt32_to_cpu(*(cells++)); |
875 | 875 | ||
876 | snprintf(unit_addr, sizeof(unit_addr), "%zx", reg); | 876 | snprintf(unit_addr, sizeof(unit_addr), "%llx", (unsigned long long)reg); |
877 | if (!streq(unitname, unit_addr)) | 877 | if (!streq(unitname, unit_addr)) |
878 | FAIL(c, dti, "Node %s simple-bus unit address format error, expected \"%s\"", | 878 | FAIL(c, dti, "Node %s simple-bus unit address format error, expected \"%s\"", |
879 | node->fullpath, unit_addr); | 879 | node->fullpath, unit_addr); |