@@ -15,6 +15,7 @@
#define TNF_FAULT_LOCAL 0x08
#define TNF_MIGRATE_FAIL 0x10
#define TNF_YOUNG 0x20
+#define TNF_WRITE 0x40
#ifdef CONFIG_NUMA_BALANCING
extern void task_numa_fault(int last_node, int node, int pages, int flags);
@@ -1513,6 +1513,8 @@ bool should_numa_migrate_memory(struct task_struct *p, struct page * page,
return false;
th = msecs_to_jiffies(sysctl_numa_balancing_hot_threshold);
+ if (flags & TNF_WRITE)
+ th *= 2;
latency = numa_hint_fault_latency(p, addr);
if (latency > th)
return false;
@@ -3829,6 +3829,9 @@ static vm_fault_t do_numa_page(struct vm_fault *vmf)
if (pte_young(old_pte))
flags |= TNF_YOUNG;
+ if (vmf->flags & FAULT_FLAG_WRITE)
+ flags |= TNF_WRITE;
+
page = vm_normal_page(vma, vmf->address, pte);
if (!page)
goto unmap_out;