From: Yinghai Lu <yinghai@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: "H. Peter Anvin" <hpa@zytor.com>, Toshi Kani <toshi.kani@hp.com>,
Thomas Gleixner <tglx@linutronix.de>,
Andrew Morton <akpm@linux-foundation.org>,
David Rientjes <rientjes@google.com>,
linux-kernel@vger.kernel.org, Yinghai Lu <yinghai@kernel.org>
Subject: [PATCH v2] x86, mm: Avoid duplicated pxm_to_node() calling.
Date: Sun, 26 Jan 2014 13:01:42 -0800 [thread overview]
Message-ID: <1390770102-4007-1-git-send-email-yinghai@kernel.org> (raw)
In-Reply-To: <20140126084604.GA30853@gmail.com>
In slit init code, more pxm_to_node() calling are added.
We can store from_node/to_node instead of keep calling pxm_to_node().
After this patch: pxm_to_node() is called n*(1+n)
Before this patch: pxm_to_node() is called n*(1+n*3)
for 8 socket, it will be 72 instead of 200.
for 32 socket, it will be 1056 instead of 3104.
-v2: update title and change log according to Ingo.
move from_node/to_node in loop and change to const according to
David Rientjes.
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
arch/x86/mm/srat.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
Index: linux-2.6/arch/x86/mm/srat.c
===================================================================
--- linux-2.6.orig/arch/x86/mm/srat.c
+++ linux-2.6/arch/x86/mm/srat.c
@@ -52,12 +52,18 @@ void __init acpi_numa_slit_init(struct a
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]);
}
}
next prev parent reply other threads:[~2014-01-26 21:01 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 ` Yinghai Lu [this message]
2014-01-26 21:08 ` [PATCH v2] x86, mm: Avoid duplicated pxm_to_node() calling 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:x86/mm] x86/mm: Avoid duplicated pxm_to_node() calls tip-bot for Yinghai Lu
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=1390770102-4007-1-git-send-email-yinghai@kernel.org \
--to=yinghai@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=rientjes@google.com \
--cc=tglx@linutronix.de \
--cc=toshi.kani@hp.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