linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH] ANB(Automatic NUMA Balancing): erase mm footprint of migrated page
@ 2013-09-13  0:45 Hillf Danton
  2013-09-13  1:41 ` Rik van Riel
  0 siblings, 1 reply; 3+ messages in thread
From: Hillf Danton @ 2013-09-13  0:45 UTC (permalink / raw)
  To: Mel Gorman
  Cc: Rik van Riel, Andrea Arcangeli, linux-mm, linux-kernel,
	Hillf Danton

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@gmail.com>
---

--- a/kernel/sched/fair.c	Wed Sep 11 18:33:00 2013
+++ b/kernel/sched/fair.c	Fri Sep 13 08:24:24 2013
@@ -1560,6 +1560,20 @@ 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 (p->numa_faults_buffer[idx] >= pages)
+		    p->numa_faults_buffer[idx] -= pages;
+		else if (p->numa_faults_buffer[idx])
+			 p->numa_faults_buffer[idx] = 0;
+	}
 }
 
 static void reset_ptenuma_scan(struct task_struct *p)
--

^ permalink raw reply	[flat|nested] 3+ messages in thread
* Re: [RFC PATCH] ANB(Automatic NUMA Balancing): erase mm footprint of migrated page
@ 2013-09-13  6:52 Hillf Danton
  0 siblings, 0 replies; 3+ messages in thread
From: Hillf Danton @ 2013-09-13  6:52 UTC (permalink / raw)
  To: Rik van Riel
  Cc: Mel Gorman, Andrea Arcangeli, linux-mm, linux-kernel,
	Hillf Danton

Hello Rik

On Fri, Sep 13, 2013 at 9:41 AM, Rik van Riel <riel@redhat.com> 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@gmail.com>
>
> 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)
--

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-09-13  6:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-13  0:45 [RFC PATCH] ANB(Automatic NUMA Balancing): erase mm footprint of migrated page Hillf Danton
2013-09-13  1:41 ` Rik van Riel
  -- strict thread matches above, loose matches on Subject: below --
2013-09-13  6:52 Hillf Danton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).