默认的内存策略标志是什么用于malloc?

huangapple go评论74阅读模式
英文:

what is default memory policy flag for malloc?

问题

在NUMA系统中,当调用malloc而没有使用set_mempolicy时,内核用于此分配的默认内存策略标志是MPOL_DEFAULT还是MPOL_INTERLEAVED?

英文:

In a numa system when malloc is called without using set_mempolicy, what is the default mempolicy flag being used in kernel for this allocation? Is it MPOL_DEFAULT or MPOL_INTERLEAVED ?

答案1

得分: 1

在 mm/mempolicy.c 文件中:

/*

  • 运行时系统范围的默认策略 => 本地分配
    */

static struct mempolicy default_policy = {
.refcnt = ATOMIC_INIT(1), /* 永不释放 */
.mode = MPOL_PREFERRED,
.flags = MPOL_F_LOCAL,
};

因此,默认的内存策略是 MPOL_PREFERRED。

英文:

In mm/mempolicy.c

/*

  • run-time system-wide default policy => local allocation
    */

    static struct mempolicy default_policy = {
    .refcnt = ATOMIC_INIT(1), /* never free it */
    .mode = MPOL_PREFERRED,
    .flags = MPOL_F_LOCAL,
    };

So default mempolicy is MPOL_PREFERRED.

huangapple
  • 本文由 发表于 2020年1月6日 14:42:09
  • 转载请务必保留本文链接:https://go.coder-hub.com/59607742.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定