Re: [RFC PATCH] ANB(Automatic NUMA Balancing): erase mm footprint of migrated page

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Rik

On Fri, Sep 13, 2013 at 9:41 AM, Rik van Riel <riel@xxxxxxxxxx> wrote:
> On 09/12/2013 08:45 PM, Hillf Danton wrote:
>> If a page monitored by ANB is migrated, its footprint should be erased from
>> numa-hint-fault account, because it is no longer used. Or two pages, the
>> migrated page and its target page, are used in the view of task placement.
>>
>>
>> Signed-off-by: Hillf Danton <dhillf@xxxxxxxxx>
>
> NAK
>
> The numa faults buffer contains the number of pages on each
> node that the task recently faulted on.
>
> If the page got migrated, it is only counted on the new node,
> not on the old one. That means there is no need to subtract
> it on the old node.
>
Yes, I cut at wrong place.

Since old node is valid,  the footprint of migrated page already
deposits in ->numa_faults, and cut should go there.

Thanks
Hillf


--- a/kernel/sched/fair.c	Wed Sep 11 18:33:00 2013
+++ b/kernel/sched/fair.c	Fri Sep 13 14:10:34 2013
@@ -1560,6 +1560,23 @@ void task_numa_fault(int last_cpupid, in
 		p->numa_pages_migrated += pages;
 
 	p->numa_faults_buffer[task_faults_idx(node, priv)] += pages;
+
+	if (migrated && last_cpupid != (-1 & LAST_CPUPID_MASK)) {
+		/* Erase footprint of migrated page */
+		int idx;
+
+		idx = cpupid_to_cpu(last_cpupid);
+		idx = cpu_to_node(idx);
+		idx = task_faults_idx(idx, priv);
+
+		if (pages > 1)
+			pages >>= 1;
+
+		if (p->numa_faults[idx] >= pages)
+		    p->numa_faults[idx] -= pages;
+		else if (p->numa_faults[idx])
+			 p->numa_faults[idx] = 0;
+	}
 }
 
 static void reset_ptenuma_scan(struct task_struct *p)
--?韬{.n?壏?檩jg??a旃??迻)钋?韰骅w+h櫒璀?y/i?⒏?婃⒎?湼Щ烚m???)钋?痂燐^櫒?觥櫒ザ?v夗﨣趓O璁?f?i?⒏?




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]