Re: [PATCH v14 01/10] mm/demotion: Add support for explicit memory tiers

From: huang ying
Date: Tue Aug 16 2022 - 05:50:52 EST


On Fri, Aug 12, 2022 at 1:58 PM Aneesh Kumar K.V
<aneesh.kumar@xxxxxxxxxxxxx> wrote:

[snip]

> diff --git a/include/linux/memory-tiers.h b/include/linux/memory-tiers.h
> new file mode 100644
> index 000000000000..bc7c1b799bef
> --- /dev/null
> +++ b/include/linux/memory-tiers.h
> @@ -0,0 +1,15 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +#ifndef _LINUX_MEMORY_TIERS_H
> +#define _LINUX_MEMORY_TIERS_H
> +
> +/*
> + * Each tier cover a abstrace distance chunk size of 128
> + */
> +#define MEMTIER_CHUNK_BITS 7
> +#define MEMTIER_CHUNK_SIZE (1 << MEMTIER_CHUNK_BITS)
> +/*
> + * Smaller abstract distance value imply faster(higher) memory tiers.
> + */
> +#define MEMTIER_ADISTANCE_DRAM (4 * MEMTIER_CHUNK_SIZE)

This will make the abstract distance of DRAM the start of its memory
tier. So that any memory type that is slightly slower than DRAM will
be put in a lower memory tier. So I think it's better to put the DRAM
at the middle of its memory tier by default. For example,

4 * MEMTIER_CHUNK_SIZE + MEMTIER_CHUNK_SIZE / 2

> +
> +#endif /* _LINUX_MEMORY_TIERS_H */

[snip]

Best Regards,
Huang, Ying