All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: riel@redhat.com
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	chegu_vinod@hp.com, mgorman@suse.de, mingo@redhat.com
Subject: Re: [PATCH 3/7] numa,sched: build per numa_group active node mask from faults_from statistics
Date: Mon, 20 Jan 2014 17:55:23 +0100	[thread overview]
Message-ID: <20140120165523.GK31570@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <1389993129-28180-4-git-send-email-riel@redhat.com>

On Fri, Jan 17, 2014 at 04:12:05PM -0500, riel@redhat.com wrote:
>  /*
> + * Iterate over the nodes from which NUMA hinting faults were triggered, in
> + * other words where the CPUs that incurred NUMA hinting faults are. The
> + * bitmask is used to limit NUMA page migrations, and spread out memory
> + * between the actively used nodes. To prevent flip-flopping, and excessive
> + * page migrations, nodes are added when they cause over 40% of the maximum
> + * number of faults, but only removed when they drop below 20%.
> + */

Maybe break the above into two paragraphs for added readability.

Also, I think this might be a good spot to explain why you need the
second fault metric -- that is, why can't we create the interleave mask
from the existing memory location faults.

> +static void update_numa_active_node_mask(struct task_struct *p)
> +{
> +	unsigned long faults, max_faults = 0;
> +	struct numa_group *numa_group = p->numa_group;
> +	int nid;
> +
> +	for_each_online_node(nid) {
> +		faults = numa_group->faults_from[task_faults_idx(nid, 0)] +
> +			 numa_group->faults_from[task_faults_idx(nid, 1)];
> +		if (faults > max_faults)
> +			max_faults = faults;
> +	}
> +
> +	for_each_online_node(nid) {
> +		faults = numa_group->faults_from[task_faults_idx(nid, 0)] +
> +			 numa_group->faults_from[task_faults_idx(nid, 1)];
> +		if (!node_isset(nid, numa_group->active_nodes)) {
> +			if (faults > max_faults * 4 / 10)
> +				node_set(nid, numa_group->active_nodes);
> +		} else if (faults < max_faults * 2 / 10)
> +			node_clear(nid, numa_group->active_nodes);
> +	}
> +}

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

WARNING: multiple messages have this Message-ID (diff)
From: Peter Zijlstra <peterz@infradead.org>
To: riel@redhat.com
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	chegu_vinod@hp.com, mgorman@suse.de, mingo@redhat.com
Subject: Re: [PATCH 3/7] numa,sched: build per numa_group active node mask from faults_from statistics
Date: Mon, 20 Jan 2014 17:55:23 +0100	[thread overview]
Message-ID: <20140120165523.GK31570@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <1389993129-28180-4-git-send-email-riel@redhat.com>

On Fri, Jan 17, 2014 at 04:12:05PM -0500, riel@redhat.com wrote:
>  /*
> + * Iterate over the nodes from which NUMA hinting faults were triggered, in
> + * other words where the CPUs that incurred NUMA hinting faults are. The
> + * bitmask is used to limit NUMA page migrations, and spread out memory
> + * between the actively used nodes. To prevent flip-flopping, and excessive
> + * page migrations, nodes are added when they cause over 40% of the maximum
> + * number of faults, but only removed when they drop below 20%.
> + */

Maybe break the above into two paragraphs for added readability.

Also, I think this might be a good spot to explain why you need the
second fault metric -- that is, why can't we create the interleave mask
from the existing memory location faults.

> +static void update_numa_active_node_mask(struct task_struct *p)
> +{
> +	unsigned long faults, max_faults = 0;
> +	struct numa_group *numa_group = p->numa_group;
> +	int nid;
> +
> +	for_each_online_node(nid) {
> +		faults = numa_group->faults_from[task_faults_idx(nid, 0)] +
> +			 numa_group->faults_from[task_faults_idx(nid, 1)];
> +		if (faults > max_faults)
> +			max_faults = faults;
> +	}
> +
> +	for_each_online_node(nid) {
> +		faults = numa_group->faults_from[task_faults_idx(nid, 0)] +
> +			 numa_group->faults_from[task_faults_idx(nid, 1)];
> +		if (!node_isset(nid, numa_group->active_nodes)) {
> +			if (faults > max_faults * 4 / 10)
> +				node_set(nid, numa_group->active_nodes);
> +		} else if (faults < max_faults * 2 / 10)
> +			node_clear(nid, numa_group->active_nodes);
> +	}
> +}

  parent reply	other threads:[~2014-01-20 16:55 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-17 21:12 [PATCH v2 0/7] pseudo-interleaving for automatic NUMA balancing riel
2014-01-17 21:12 ` riel
2014-01-17 21:12 ` [PATCH 1/7] numa,sched,mm: remove p->numa_migrate_deferred riel
2014-01-17 21:12   ` riel
2014-01-17 21:12 ` [PATCH 2/7] numa,sched: track from which nodes NUMA faults are triggered riel
2014-01-17 21:12   ` riel
2014-01-17 21:12 ` [PATCH 3/7] numa,sched: build per numa_group active node mask from faults_from statistics riel
2014-01-17 21:12   ` riel
2014-01-20 16:31   ` Peter Zijlstra
2014-01-20 16:31     ` Peter Zijlstra
2014-01-20 18:55     ` Rik van Riel
2014-01-20 18:55       ` Rik van Riel
2014-01-20 16:55   ` Peter Zijlstra [this message]
2014-01-20 16:55     ` Peter Zijlstra
2014-01-17 21:12 ` [PATCH 4/7] numa,sched: tracepoints for NUMA balancing active nodemask changes riel
2014-01-17 21:12   ` riel
2014-01-20 16:52   ` Peter Zijlstra
2014-01-20 16:52     ` Peter Zijlstra
2014-01-20 18:51     ` Rik van Riel
2014-01-20 18:51       ` Rik van Riel
2014-01-20 19:05     ` Steven Rostedt
2014-01-20 19:05       ` Steven Rostedt
2014-01-17 21:12 ` [PATCH 5/7] numa,sched,mm: use active_nodes nodemask to limit numa migrations riel
2014-01-17 21:12   ` riel
2014-01-17 21:12 ` [PATCH 6/7] numa,sched: normalize faults_from stats and weigh by CPU use riel
2014-01-17 21:12   ` riel
2014-01-20 16:57   ` Peter Zijlstra
2014-01-20 16:57     ` Peter Zijlstra
2014-01-20 19:02     ` Rik van Riel
2014-01-20 19:02       ` Rik van Riel
2014-01-20 19:10       ` Peter Zijlstra
2014-01-20 19:10         ` Peter Zijlstra
2014-01-17 21:12 ` [PATCH 7/7] numa,sched: do statistics calculation using local variables only riel
2014-01-17 21:12   ` riel
2014-01-18  3:31   ` Rik van Riel
2014-01-18  3:31     ` Rik van Riel
2014-01-18 22:05 ` [PATCH v2 0/7] pseudo-interleaving for automatic NUMA balancing Chegu Vinod
2014-01-18 22:05   ` Chegu Vinod

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=20140120165523.GK31570@twins.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=chegu_vinod@hp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.