@@ -1146,6 +1146,7 @@ extern void pagefault_out_of_memory(void);
* various contexts.
*/
#define SHOW_MEM_FILTER_NODES (0x0001u) /* disallowed nodes */
+#define SHOW_COMPACTION_STATS (0x0002u)
extern void show_free_areas(unsigned int flags);
extern bool skip_free_areas_node(unsigned int flags, int nid);
@@ -8,6 +8,7 @@
#include <linux/mm.h>
#include <linux/quicklist.h>
#include <linux/cma.h>
+#include <linux/vm_event_item.h>
void show_mem(unsigned int filter)
{
@@ -17,6 +18,19 @@ void show_mem(unsigned int filter)
printk("Mem-Info:\n");
show_free_areas(filter);
+#ifdef CONFIG_COMPACTION
+ if (filter & SHOW_COMPACTION_STATS) {
+ printk("compaction_stall:%lu compaction_fail:%lu "
+ "compact_migrate_scanned:%lu compact_free_scanned:%lu "
+ "compact_isolated:%lu "
+ "pgmigrate_success:%lu pgmigrate_fail:%lu\n",
+ global_page_state(COMPACTSTALL), global_page_state(COMPACTFAIL),
+ global_page_state(COMPACTMIGRATE_SCANNED), global_page_state(COMPACTFAIL),
+ global_page_state(COMPACTISOLATED),
+ global_page_state(PGMIGRATE_SUCCESS), global_page_state(PGMIGRATE_FAIL));
+ }
+#endif
+
for_each_online_pgdat(pgdat) {
unsigned long flags;
int zoneid;
@@ -419,7 +419,7 @@ static void dump_header(struct oom_control *oc, struct task_struct *p)
if (oc->memcg)
mem_cgroup_print_oom_info(oc->memcg, p);
else
- show_mem(SHOW_MEM_FILTER_NODES);
+ show_mem(SHOW_MEM_FILTER_NODES | (oc->order)?SHOW_COMPACTION_STATS:0);
if (sysctl_oom_dump_tasks)
dump_tasks(oc->memcg, oc->nodemask);
}
@@ -2999,6 +2999,8 @@ void warn_alloc_failed(gfp_t gfp_mask, unsigned int order, const char *fmt, ...)
pr_warn("%s: page allocation failure: order:%u, mode:%#x(%pGg)\n",
current->comm, order, gfp_mask, &gfp_mask);
dump_stack();
+ if (order)
+ filter |= SHOW_COMPACTION_STATS;
if (!should_suppress_show_mem())
show_mem(filter);
}