Commit 1b2614f1 authored by Linus Torvalds's avatar Linus Torvalds

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.
parents ea25c431 e6618692
...@@ -517,7 +517,8 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s ...@@ -517,7 +517,8 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s
# define __compiletime_error_fallback(condition) do { } while (0) # define __compiletime_error_fallback(condition) do { } while (0)
#endif #endif
#define __compiletime_assert(condition, msg, prefix, suffix) \ #ifdef __OPTIMIZE__
# define __compiletime_assert(condition, msg, prefix, suffix) \
do { \ do { \
bool __cond = !(condition); \ bool __cond = !(condition); \
extern void prefix ## suffix(void) __compiletime_error(msg); \ 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,6 +526,9 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s
prefix ## suffix(); \ prefix ## suffix(); \
__compiletime_error_fallback(__cond); \ __compiletime_error_fallback(__cond); \
} while (0) } while (0)
#else
# define __compiletime_assert(condition, msg, prefix, suffix) do { } while (0)
#endif
#define _compiletime_assert(condition, msg, prefix, suffix) \ #define _compiletime_assert(condition, msg, prefix, suffix) \
__compiletime_assert(condition, msg, prefix, suffix) __compiletime_assert(condition, msg, prefix, suffix)
......
...@@ -1262,8 +1262,6 @@ void uprobe_end_dup_mmap(void) ...@@ -1262,8 +1262,6 @@ void uprobe_end_dup_mmap(void)
void uprobe_dup_mmap(struct mm_struct *oldmm, struct mm_struct *newmm) void uprobe_dup_mmap(struct mm_struct *oldmm, struct mm_struct *newmm)
{ {
newmm->uprobes_state.xol_area = NULL;
if (test_bit(MMF_HAS_UPROBES, &oldmm->flags)) { if (test_bit(MMF_HAS_UPROBES, &oldmm->flags)) {
set_bit(MMF_HAS_UPROBES, &newmm->flags); set_bit(MMF_HAS_UPROBES, &newmm->flags);
/* unconditionally, dup_mmap() skips VM_DONTCOPY vmas */ /* unconditionally, dup_mmap() skips VM_DONTCOPY vmas */
......
...@@ -785,6 +785,13 @@ static void mm_init_owner(struct mm_struct *mm, struct task_struct *p) ...@@ -785,6 +785,13 @@ static void mm_init_owner(struct mm_struct *mm, struct task_struct *p)
#endif #endif
} }
static void mm_init_uprobes_state(struct mm_struct *mm)
{
#ifdef CONFIG_UPROBES
mm->uprobes_state.xol_area = NULL;
#endif
}
static struct mm_struct *mm_init(struct mm_struct *mm, struct task_struct *p, static struct mm_struct *mm_init(struct mm_struct *mm, struct task_struct *p,
struct user_namespace *user_ns) struct user_namespace *user_ns)
{ {
...@@ -812,6 +819,7 @@ static struct mm_struct *mm_init(struct mm_struct *mm, struct task_struct *p, ...@@ -812,6 +819,7 @@ static struct mm_struct *mm_init(struct mm_struct *mm, struct task_struct *p,
#if defined(CONFIG_TRANSPARENT_HUGEPAGE) && !USE_SPLIT_PMD_PTLOCKS #if defined(CONFIG_TRANSPARENT_HUGEPAGE) && !USE_SPLIT_PMD_PTLOCKS
mm->pmd_huge_pte = NULL; mm->pmd_huge_pte = NULL;
#endif #endif
mm_init_uprobes_state(mm);
if (current->mm) { if (current->mm) {
mm->flags = current->mm->flags & MMF_INIT_MASK; mm->flags = current->mm->flags & MMF_INIT_MASK;
......
...@@ -637,6 +637,7 @@ int kthread_worker_fn(void *worker_ptr) ...@@ -637,6 +637,7 @@ int kthread_worker_fn(void *worker_ptr)
schedule(); schedule();
try_to_freeze(); try_to_freeze();
cond_resched();
goto repeat; goto repeat;
} }
EXPORT_SYMBOL_GPL(kthread_worker_fn); EXPORT_SYMBOL_GPL(kthread_worker_fn);
......
...@@ -613,6 +613,7 @@ static int madvise_inject_error(int behavior, ...@@ -613,6 +613,7 @@ static int madvise_inject_error(int behavior,
unsigned long start, unsigned long end) unsigned long start, unsigned long end)
{ {
struct page *page; struct page *page;
struct zone *zone;
if (!capable(CAP_SYS_ADMIN)) if (!capable(CAP_SYS_ADMIN))
return -EPERM; return -EPERM;
...@@ -646,6 +647,11 @@ static int madvise_inject_error(int behavior, ...@@ -646,6 +647,11 @@ static int madvise_inject_error(int behavior,
if (ret) if (ret)
return ret; return ret;
} }
/* Ensure that all poisoned pages are removed from per-cpu lists */
for_each_populated_zone(zone)
drain_all_pages(zone);
return 0; return 0;
} }
#endif #endif
......
...@@ -3291,9 +3291,12 @@ __alloc_pages_may_oom(gfp_t gfp_mask, unsigned int order, ...@@ -3291,9 +3291,12 @@ __alloc_pages_may_oom(gfp_t gfp_mask, unsigned int order,
/* /*
* Go through the zonelist yet one more time, keep very high watermark * Go through the zonelist yet one more time, keep very high watermark
* here, this is only to catch a parallel oom killing, we must fail if * here, this is only to catch a parallel oom killing, we must fail if
* we're still under heavy pressure. * we're still under heavy pressure. But make sure that this reclaim
* attempt shall not depend on __GFP_DIRECT_RECLAIM && !__GFP_NORETRY
* allocation which will never fail due to oom_lock already held.
*/ */
page = get_page_from_freelist(gfp_mask | __GFP_HARDWALL, order, page = get_page_from_freelist((gfp_mask | __GFP_HARDWALL) &
~__GFP_DIRECT_RECLAIM, order,
ALLOC_WMARK_HIGH|ALLOC_CPUSET, ac); ALLOC_WMARK_HIGH|ALLOC_CPUSET, ac);
if (page) if (page)
goto out; goto out;
......
...@@ -873,7 +873,7 @@ static void check_simple_bus_reg(struct check *c, struct dt_info *dti, struct no ...@@ -873,7 +873,7 @@ static void check_simple_bus_reg(struct check *c, struct dt_info *dti, struct no
while (size--) while (size--)
reg = (reg << 32) | fdt32_to_cpu(*(cells++)); reg = (reg << 32) | fdt32_to_cpu(*(cells++));
snprintf(unit_addr, sizeof(unit_addr), "%zx", reg); snprintf(unit_addr, sizeof(unit_addr), "%llx", (unsigned long long)reg);
if (!streq(unitname, unit_addr)) if (!streq(unitname, unit_addr))
FAIL(c, dti, "Node %s simple-bus unit address format error, expected \"%s\"", FAIL(c, dti, "Node %s simple-bus unit address format error, expected \"%s\"",
node->fullpath, unit_addr); node->fullpath, unit_addr);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment