diff mbox series

[mm-unstable] mm/demotion: Make toptier_distance inclusive upper bound of toptiers

Message ID 20220830081457.118960-1-aneesh.kumar@linux.ibm.com (mailing list archive)
State New
Headers show
Series [mm-unstable] mm/demotion: Make toptier_distance inclusive upper bound of toptiers | expand

Commit Message

Aneesh Kumar K.V Aug. 30, 2022, 8:14 a.m. UTC
Based on suggestion from Wei Xu <weixugc@google.com>, having an
inclusive upper bound is found simpler.

Fixes: mm/demotion: Update node_is_toptier to work with memory tiers
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
---
 mm/memory-tiers.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Wei Xu Aug. 30, 2022, 3:48 p.m. UTC | #1
On Tue, Aug 30, 2022 at 1:15 AM Aneesh Kumar K.V
<aneesh.kumar@linux.ibm.com> wrote:
>
> Based on suggestion from Wei Xu <weixugc@google.com>, having an
> inclusive upper bound is found simpler.
>
> Fixes: mm/demotion: Update node_is_toptier to work with memory tiers
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
> ---
>  mm/memory-tiers.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/mm/memory-tiers.c b/mm/memory-tiers.c
> index c4bd6d052a33..c82eb0111383 100644
> --- a/mm/memory-tiers.c
> +++ b/mm/memory-tiers.c
> @@ -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

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

Wei

>                          * 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
>
diff mbox series

Patch

diff --git a/mm/memory-tiers.c b/mm/memory-tiers.c
index c4bd6d052a33..c82eb0111383 100644
--- a/mm/memory-tiers.c
+++ b/mm/memory-tiers.c
@@ -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;
 		}
 	}