Skip to contentSkip to conversation

mm/demotion: Make toptier_distance inclusive upper bound of toptiers

PATCH In review Aneesh Kumar K.V 2 participants 2 messages Aug 30, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mm/demotion: Make toptier_distance inclusive upper bound of toptiers

Based on suggestion from Wei Xu <[email protected]>, having an inclusive upper bound is found simpler.

Fixes mm/demotion: Update node_is_toptier to work with memory tiers
---
 mm/memory-tiers.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
mm/memory-tiers.c +3 -2
index c4bd6d052a33..c82eb0111383 100644
@@ -179,7 +179,7 @@ bool node_is_toptier(int node)
 		toptier = true;
 		goto out;
 	}
-	if (memtier->adistance_start < top_tier_adistance)
+	if (memtier->adistance_start <= top_tier_adistance)
 		toptier = true;
 	else
 		toptier = false;
@@ -361,7 +361,8 @@ static void establish_demotion_targets(void)
 			 * abstract distance below the max value of this memtier
 			 * is considered toptier.
 			 */
-			top_tier_adistance = memtier->adistance_start + MEMTIER_CHUNK_SIZE;
+			top_tier_adistance = memtier->adistance_start +
+						MEMTIER_CHUNK_SIZE - 1;
 			break;
 		}
 	}
Signature · 1 line
2.37.2
#1 lore raw
Quoted 24 lines · Aneesh Kumar K.V

Based on suggestion from Wei Xu <[email protected]>, having an inclusive upper bound is found simpler.

Fixes mm/demotion: Update node_is_toptier to work with memory tiers
---
 mm/memory-tiers.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
mm/memory-tiers.c +1 -1
index c4bd6d052a33..c82eb0111383 100644
@@ -179,7 +179,7 @@ bool node_is_toptier(int node)
                toptier = true;
                goto out;
        }
-       if (memtier->adistance_start < top_tier_adistance)
+       if (memtier->adistance_start <= top_tier_adistance)
                toptier = true;
        else
                toptier = false;

mm/memory-tiers.c static void establish_demotion_targets(void) · line 361

Quoted 1 line
mm/memory-tiers.c +0 -0
@@ -361,7 +361,8 @@ static void establish_demotion_targets(void)
                         * abstract distance below the max value of this memtier

below -> up to ? Looks good to me otherwise.

Wei

Quoted 11 lines
mm/memory-tiers.c +2 -2
                         * is considered toptier.
                         */
-                       top_tier_adistance = memtier->adistance_start + MEMTIER_CHUNK_SIZE;
+                       top_tier_adistance = memtier->adistance_start +
+                                               MEMTIER_CHUNK_SIZE - 1;
                        break;
                }
        }
--

2.37.2