Merge "Revert "mm: make cma the first choice for movable request""
diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index b565d2c..dde2ee6 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -1171,8 +1171,35 @@
mutex_unlock(&oom_lock);
}
+/* Call this function with task_lock being held as we're accessing ->mm */
+void dump_killed_info(struct task_struct *selected)
+{
+ int selected_tasksize = get_mm_rss(selected->mm);
+
+ pr_info_ratelimited("Killing '%s' (%d), adj %hd,\n"
+ " to free %ldkB on behalf of '%s' (%d)\n"
+ " Free CMA is %ldkB\n"
+ " Total reserve is %ldkB\n"
+ " Total free pages is %ldkB\n"
+ " Total file cache is %ldkB\n",
+ selected->comm, selected->pid,
+ selected->signal->oom_score_adj,
+ selected_tasksize * (long)(PAGE_SIZE / 1024),
+ current->comm, current->pid,
+ global_zone_page_state(NR_FREE_CMA_PAGES) *
+ (long)(PAGE_SIZE / 1024),
+ totalreserve_pages * (long)(PAGE_SIZE / 1024),
+ global_zone_page_state(NR_FREE_PAGES) *
+ (long)(PAGE_SIZE / 1024),
+ global_node_page_state(NR_FILE_PAGES) *
+ (long)(PAGE_SIZE / 1024));
+}
+
void add_to_oom_reaper(struct task_struct *p)
{
+ static DEFINE_RATELIMIT_STATE(reaper_rs, DEFAULT_RATELIMIT_INTERVAL,
+ DEFAULT_RATELIMIT_BURST);
+
if (!sysctl_reap_mem_on_sigkill)
return;
@@ -1185,6 +1212,16 @@
__mark_oom_victim(p);
wake_oom_reaper(p);
}
+
+ dump_killed_info(p);
task_unlock(p);
+
+ if (__ratelimit(&reaper_rs) && p->signal->oom_score_adj == 0) {
+ show_mem(SHOW_MEM_FILTER_NODES, NULL);
+ show_mem_call_notifiers();
+ if (sysctl_oom_dump_tasks)
+ dump_tasks(NULL, NULL);
+ }
+
put_task_struct(p);
}
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 2159e74..cc6754d 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -2451,14 +2451,14 @@
static __always_inline struct page *
__rmqueue(struct zone *zone, unsigned int order, int migratetype)
{
- struct page *page = NULL;
+ struct page *page;
retry:
- if (migratetype == MIGRATE_MOVABLE)
- page = __rmqueue_cma_fallback(zone, order);
+ page = __rmqueue_smallest(zone, order, migratetype);
+ if (unlikely(!page)) {
+ if (migratetype == MIGRATE_MOVABLE)
+ page = __rmqueue_cma_fallback(zone, order);
- if (!page) {
- page = __rmqueue_smallest(zone, order, migratetype);
if (!page && __rmqueue_fallback(zone, order, migratetype))
goto retry;
}