LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: David Rientjes <rientjes@google.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Paul Jackson <pj@sgi.com>, Christoph Lameter <clameter@sgi.com>,
Lee Schermerhorn <Lee.Schermerhorn@hp.com>,
Andi Kleen <ak@suse.de>,
linux-kernel@vger.kernel.org
Subject: [patch -mm 2/2] mempolicy: use default_policy mode instead of MPOL_DEFAULT
Date: Fri, 7 Mar 2008 17:24:15 -0800 (PST) [thread overview]
Message-ID: <alpine.DEB.1.00.0803071722170.4611@chino.kir.corp.google.com> (raw)
In-Reply-To: <alpine.DEB.1.00.0803071720460.4611@chino.kir.corp.google.com>
default_policy is defined in mm/mempolicy.c as the default system policy:
struct mempolicy default_policy = {
.refcnt = ATOMIC_INIT(1),
.policy = MPOL_DEFAULT,
};
So instead of checking for comparisons against a mempolicy's mode to
MPOL_DEFAULT or falling back stricly to MPOL_DEFAULT throughout the code,
we should use the mode that is defined in this struct.
Cc: Paul Jackson <pj@sgi.com>
Cc: Christoph Lameter <clameter@sgi.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
Cc: Andi Kleen <ak@suse.de>
Signed-off-by: David Rientjes <rientjes@google.com>
---
mm/mempolicy.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -185,7 +185,7 @@ static struct mempolicy *mpol_new(unsigned short mode, unsigned short flags,
return ERR_PTR(-EINVAL);
} else if (nodes && nodes_empty(*nodes))
return ERR_PTR(-EINVAL);
- if (mode == MPOL_DEFAULT)
+ if (mode == default_policy.policy)
return NULL;
policy = kmem_cache_alloc(policy_cache, GFP_KERNEL);
if (!policy)
@@ -1232,7 +1232,7 @@ static struct mempolicy * get_vma_policy(struct task_struct *task,
pol = vma->vm_ops->get_policy(vma, addr);
shared_pol = 1; /* if pol non-NULL, add ref below */
} else if (vma->vm_policy &&
- vma->vm_policy->policy != MPOL_DEFAULT)
+ vma->vm_policy->policy != default_policy.policy)
pol = vma->vm_policy;
}
if (!pol)
@@ -1588,7 +1588,7 @@ void __mpol_free(struct mempolicy *p)
{
if (!atomic_dec_and_test(&p->refcnt))
return;
- p->policy = MPOL_DEFAULT;
+ p->policy = default_policy.policy;
kmem_cache_free(policy_cache, p);
}
@@ -1752,10 +1752,10 @@ void mpol_shared_policy_init(struct shared_policy *info, unsigned short policy,
info->root = RB_ROOT;
spin_lock_init(&info->lock);
- if (policy != MPOL_DEFAULT) {
+ if (policy != default_policy.policy) {
struct mempolicy *newpol;
- /* Falls back to MPOL_DEFAULT on any error */
+ /* Falls back to default_policy on any error */
newpol = mpol_new(policy, flags, policy_nodes);
if (!IS_ERR(newpol)) {
/* Create pseudo-vma that contains just the policy */
@@ -1860,7 +1860,7 @@ void __init numa_policy_init(void)
/* Reset policy of current process to default */
void numa_default_policy(void)
{
- do_set_mempolicy(MPOL_DEFAULT, 0, NULL);
+ do_set_mempolicy(default_policy.policy, 0, NULL);
}
/*
next prev parent reply other threads:[~2008-03-08 1:25 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-08 1:24 [patch -mm 1/2] mempolicy: disallow static or relative flags for local preferred mode David Rientjes
2008-03-08 1:24 ` David Rientjes [this message]
2008-03-08 1:28 ` [patch -mm 2/2] mempolicy: use default_policy mode instead of MPOL_DEFAULT Paul Jackson
2008-03-08 1:33 ` David Rientjes
2008-03-08 1:35 ` Paul Jackson
2008-03-08 1:59 ` Christoph Lameter
2008-03-08 2:14 ` David Rientjes
2008-03-08 19:13 ` Lee Schermerhorn
2008-03-08 22:20 ` David Rientjes
2008-03-08 23:19 ` Andi Kleen
2008-03-10 13:48 ` Lee Schermerhorn
2008-03-10 19:09 ` [patch -mm 1/2] mempolicy: disallow static or relative flags for local preferred mode Andrew Morton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.DEB.1.00.0803071722170.4611@chino.kir.corp.google.com \
--to=rientjes@google.com \
--cc=Lee.Schermerhorn@hp.com \
--cc=ak@suse.de \
--cc=akpm@linux-foundation.org \
--cc=clameter@sgi.com \
--cc=linux-kernel@vger.kernel.org \
--cc=pj@sgi.com \
--subject='Re: [patch -mm 2/2] mempolicy: use default_policy mode instead of MPOL_DEFAULT' \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).