valmiki
valmiki

Reputation: 721

what is default memory policy flag for malloc?

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 ?

Upvotes: 0

Views: 215

Answers (1)

valmiki
valmiki

Reputation: 721

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.

Upvotes: 1

Related Questions