diff mbox series

[v2,1/3] powerpc/mm/drconf: Use NUMA_NO_NODE on failures instead of node 0

Message ID 20190701143626.17628-1-aneesh.kumar@linux.ibm.com (mailing list archive)
State Accepted
Commit ea9f5b702fe0215188fba2eda117419e4ae90a67
Headers show
Series [v2,1/3] powerpc/mm/drconf: Use NUMA_NO_NODE on failures instead of node 0 | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch success Successfully applied on branch next (c7d64b560ce80d8c44f082eee8352f0778a73195)
snowpatch_ozlabs/checkpatch success total: 0 errors, 0 warnings, 0 checks, 23 lines checked

Commit Message

Aneesh Kumar K V July 1, 2019, 2:36 p.m. UTC
If we fail to parse the associativity array we should default to
NUMA_NO_NODE instead of NODE 0. Rest of the code fallback to the
right default if we find the numa node value NUMA_NO_NODE.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
---
 arch/powerpc/mm/numa.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

Comments

Michael Ellerman July 8, 2019, 1:19 a.m. UTC | #1
On Mon, 2019-07-01 at 14:36:24 UTC, "Aneesh Kumar K.V" wrote:
> If we fail to parse the associativity array we should default to
> NUMA_NO_NODE instead of NODE 0. Rest of the code fallback to the
> right default if we find the numa node value NUMA_NO_NODE.
> 
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>

Series applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/ea9f5b702fe0215188fba2eda117419e4ae90a67

cheers
diff mbox series

Patch

diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index 917904d2fe97..aee718509085 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -416,17 +416,19 @@  static int of_get_assoc_arrays(struct assoc_arrays *aa)
 static int of_drconf_to_nid_single(struct drmem_lmb *lmb)
 {
 	struct assoc_arrays aa = { .arrays = NULL };
-	int default_nid = 0;
+	int default_nid = NUMA_NO_NODE;
 	int nid = default_nid;
 	int rc, index;
 
+	if (min_common_depth < 0)
+		return default_nid;
+
 	rc = of_get_assoc_arrays(&aa);
 	if (rc)
 		return default_nid;
 
-	if (min_common_depth > 0 && min_common_depth <= aa.array_sz &&
-	    !(lmb->flags & DRCONF_MEM_AI_INVALID) &&
-	    lmb->aa_index < aa.n_arrays) {
+	if (min_common_depth <= aa.array_sz &&
+	    !(lmb->flags & DRCONF_MEM_AI_INVALID) && lmb->aa_index < aa.n_arrays) {
 		index = lmb->aa_index * aa.array_sz + min_common_depth - 1;
 		nid = of_read_number(&aa.arrays[index], 1);