linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Hillf Danton" <dhillf@sina.com>
To: Rik van Riel <riel@redhat.com>
Cc: Mel Gorman <mgorman@suse.de>,
	Andrea Arcangeli <aarcange@redhat.com>,
	linux-mm <linux-mm@kvack.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Hillf Danton <dhillf@gmail.com>
Subject: Re: [RFC PATCH] ANB(Automatic NUMA Balancing): erase mm footprint of migrated page
Date: Fri, 13 Sep 2013 14:52:48 +0800	[thread overview]
Message-ID: <20130913065248.7FB62428001@webmail.sinamail.sina.com.cn> (raw)

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)
--

             reply	other threads:[~2013-09-13  6:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-13  6:52 Hillf Danton [this message]
  -- strict thread matches above, loose matches on Subject: below --
2013-09-13  0:45 Hillf Danton
2013-09-13  1:41 ` Rik van Riel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130913065248.7FB62428001@webmail.sinamail.sina.com.cn \
    --to=dhillf@sina.com \
    --cc=aarcange@redhat.com \
    --cc=dhillf@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@suse.de \
    --cc=riel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox