mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: tip-bot for Yinghai Lu <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@kernel.org,
	yinghai@kernel.org, tglx@linutronix.de, rientjes@google.com,
	toshi.kani@hp.com
Subject: [tip:x86/mm] x86/mm: Avoid duplicated pxm_to_node() calls
Date: Mon, 10 Feb 2014 05:32:21 -0800	[thread overview]
Message-ID: <tip-ba6a328f7dfc95b20df5e0eb33c698187e997190@git.kernel.org> (raw)
In-Reply-To: <1390770102-4007-1-git-send-email-yinghai@kernel.org>

Commit-ID:  ba6a328f7dfc95b20df5e0eb33c698187e997190
Gitweb:     http://git.kernel.org/tip/ba6a328f7dfc95b20df5e0eb33c698187e997190
Author:     Yinghai Lu <yinghai@kernel.org>
AuthorDate: Sun, 26 Jan 2014 13:01:42 -0800
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Sun, 9 Feb 2014 15:32:31 +0100

x86/mm: Avoid duplicated pxm_to_node() calls

In slit init code, too many pxm_to_node() function calls are done.

We can store from_node/to_node instead of keep calling
pxm_to_node().

  - Before this patch: pxm_to_node() is called n*(1+n*3) times.
  - After  this patch: pxm_to_node() is called n*(1+n) times.

for  8 sockets, it will be   72 instead of  200.
for 32 sockets, it will be 1056 instead of 3104.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Cc: Toshi Kani <toshi.kani@hp.com>
Cc: David Rientjes <rientjes@google.com>
Link: http://lkml.kernel.org/r/1390770102-4007-1-git-send-email-yinghai@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/mm/srat.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/arch/x86/mm/srat.c b/arch/x86/mm/srat.c
index 1953e9c..66338a6 100644
--- a/arch/x86/mm/srat.c
+++ b/arch/x86/mm/srat.c
@@ -52,12 +52,18 @@ void __init acpi_numa_slit_init(struct acpi_table_slit *slit)
 	int i, j;
 
 	for (i = 0; i < slit->locality_count; i++) {
-		if (pxm_to_node(i) == NUMA_NO_NODE)
+		const int from_node = pxm_to_node(i);
+
+		if (from_node == NUMA_NO_NODE)
 			continue;
+
 		for (j = 0; j < slit->locality_count; j++) {
-			if (pxm_to_node(j) == NUMA_NO_NODE)
+			const int to_node = pxm_to_node(j);
+
+			if (to_node == NUMA_NO_NODE)
 				continue;
-			numa_set_distance(pxm_to_node(i), pxm_to_node(j),
+
+			numa_set_distance(from_node, to_node,
 				slit->entry[slit->locality_count * i + j]);
 		}
 	}

  parent reply	other threads:[~2014-02-10 13:32 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-25 14:25 [tip:x86/urgent] arch/x86/mm/srat: Skip NUMA_NO_NODE while parsing SLIT tip-bot for Toshi Kani
2014-01-26  8:43 ` Yinghai Lu
2014-01-26  8:46   ` Ingo Molnar
2014-01-26  9:10     ` [PATCH] x86, mm: Avoid extra pxm_to_node() Yinghai Lu
2014-01-26  9:10       ` Ingo Molnar
2014-01-26  9:28       ` David Rientjes
2014-01-26 21:01     ` [PATCH v2] x86, mm: Avoid duplicated pxm_to_node() calling Yinghai Lu
2014-01-26 21:08       ` David Rientjes
2014-01-27 14:49       ` Toshi Kani
2014-01-27 19:08         ` Yinghai Lu
2014-01-27 19:05           ` Toshi Kani
2014-02-10 13:32       ` tip-bot for Yinghai Lu [this message]
2014-01-27 14:45   ` [tip:x86/urgent] arch/x86/mm/srat: Skip NUMA_NO_NODE while parsing SLIT Toshi Kani

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=tip-ba6a328f7dfc95b20df5e0eb33c698187e997190@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=rientjes@google.com \
    --cc=tglx@linutronix.de \
    --cc=toshi.kani@hp.com \
    --cc=yinghai@kernel.org \
    /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

Powered by JetHome