projects
/
powerpc.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus
[powerpc.git]
/
mm
/
mempolicy.c
diff --git
a/mm/mempolicy.c
b/mm/mempolicy.c
index
3d6ac95
..
568152a
100644
(file)
--- a/
mm/mempolicy.c
+++ b/
mm/mempolicy.c
@@
-72,7
+72,6
@@
#include <linux/hugetlb.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/hugetlb.h>
#include <linux/kernel.h>
#include <linux/sched.h>
-#include <linux/mm.h>
#include <linux/nodemask.h>
#include <linux/cpuset.h>
#include <linux/gfp.h>
#include <linux/nodemask.h>
#include <linux/cpuset.h>
#include <linux/gfp.h>
@@
-82,13
+81,13
@@
#include <linux/interrupt.h>
#include <linux/init.h>
#include <linux/compat.h>
#include <linux/interrupt.h>
#include <linux/init.h>
#include <linux/compat.h>
-#include <linux/mempolicy.h>
#include <linux/swap.h>
#include <linux/seq_file.h>
#include <linux/proc_fs.h>
#include <linux/migrate.h>
#include <linux/rmap.h>
#include <linux/security.h>
#include <linux/swap.h>
#include <linux/seq_file.h>
#include <linux/proc_fs.h>
#include <linux/migrate.h>
#include <linux/rmap.h>
#include <linux/security.h>
+#include <linux/syscalls.h>
#include <asm/tlbflush.h>
#include <asm/uaccess.h>
#include <asm/tlbflush.h>
#include <asm/uaccess.h>
@@
-110,6
+109,9
@@
struct mempolicy default_policy = {
.policy = MPOL_DEFAULT,
};
.policy = MPOL_DEFAULT,
};
+static void mpol_rebind_policy(struct mempolicy *pol,
+ const nodemask_t *newmask);
+
/* Do sanity checking on a policy */
static int mpol_check_policy(int mode, nodemask_t *nodes)
{
/* Do sanity checking on a policy */
static int mpol_check_policy(int mode, nodemask_t *nodes)
{
@@
-128,7
+130,7
@@
static int mpol_check_policy(int mode, nodemask_t *nodes)
return -EINVAL;
break;
}
return -EINVAL;
break;
}
- return nodes_subset(*nodes, node_
online_map
) ? 0 : -EINVAL;
+ return nodes_subset(*nodes, node_
states[N_HIGH_MEMORY]
) ? 0 : -EINVAL;
}
/* Generate a custom zonelist for the BIND policy. */
}
/* Generate a custom zonelist for the BIND policy. */
@@
-185,7
+187,9
@@
static struct mempolicy *mpol_new(int mode, nodemask_t *nodes)
switch (mode) {
case MPOL_INTERLEAVE:
policy->v.nodes = *nodes;
switch (mode) {
case MPOL_INTERLEAVE:
policy->v.nodes = *nodes;
- if (nodes_weight(*nodes) == 0) {
+ nodes_and(policy->v.nodes, policy->v.nodes,
+ node_states[N_HIGH_MEMORY]);
+ if (nodes_weight(policy->v.nodes) == 0) {
kmem_cache_free(policy_cache, policy);
return ERR_PTR(-EINVAL);
}
kmem_cache_free(policy_cache, policy);
return ERR_PTR(-EINVAL);
}
@@
-459,7
+463,7
@@
static void mpol_set_task_struct_flag(void)
}
/* Set the process memory policy */
}
/* Set the process memory policy */
-long do_set_mempolicy(int mode, nodemask_t *nodes)
+
static
long do_set_mempolicy(int mode, nodemask_t *nodes)
{
struct mempolicy *new;
{
struct mempolicy *new;
@@
-494,9
+498,9
@@
static void get_zonemask(struct mempolicy *p, nodemask_t *nodes)
*nodes = p->v.nodes;
break;
case MPOL_PREFERRED:
*nodes = p->v.nodes;
break;
case MPOL_PREFERRED:
- /* or use current node instead of
online
map? */
+ /* or use current node instead of
memory_
map? */
if (p->v.preferred_node < 0)
if (p->v.preferred_node < 0)
- *nodes = node_
online_map
;
+ *nodes = node_
states[N_HIGH_MEMORY]
;
else
node_set(p->v.preferred_node, *nodes);
break;
else
node_set(p->v.preferred_node, *nodes);
break;
@@
-519,8
+523,8
@@
static int lookup_node(struct mm_struct *mm, unsigned long addr)
}
/* Retrieve NUMA policy */
}
/* Retrieve NUMA policy */
-long do_get_mempolicy(int *policy, nodemask_t *nmask,
- unsigned long addr, unsigned long flags)
+
static
long do_get_mempolicy(int *policy, nodemask_t *nmask,
+
unsigned long addr, unsigned long flags)
{
int err;
struct mm_struct *mm = current->mm;
{
int err;
struct mm_struct *mm = current->mm;
@@
-528,8
+532,18
@@
long do_get_mempolicy(int *policy, nodemask_t *nmask,
struct mempolicy *pol = current->mempolicy;
cpuset_update_task_memory_state();
struct mempolicy *pol = current->mempolicy;
cpuset_update_task_memory_state();
- if (flags & ~(unsigned long)(MPOL_F_NODE|MPOL_F_ADDR))
+ if (flags &
+ ~(unsigned long)(MPOL_F_NODE|MPOL_F_ADDR|MPOL_F_MEMS_ALLOWED))
return -EINVAL;
return -EINVAL;
+
+ if (flags & MPOL_F_MEMS_ALLOWED) {
+ if (flags & (MPOL_F_NODE|MPOL_F_ADDR))
+ return -EINVAL;
+ *policy = 0; /* just so it's initialized */
+ *nmask = cpuset_current_mems_allowed;
+ return 0;
+ }
+
if (flags & MPOL_F_ADDR) {
down_read(&mm->mmap_sem);
vma = find_vma_intersection(mm, addr, addr+1);
if (flags & MPOL_F_ADDR) {
down_read(&mm->mmap_sem);
vma = find_vma_intersection(mm, addr, addr+1);
@@
-601,7
+615,8
@@
static struct page *new_node_page(struct page *page, unsigned long node, int **x
* Migrate pages from one node to a target node.
* Returns error or the number of pages not migrated.
*/
* Migrate pages from one node to a target node.
* Returns error or the number of pages not migrated.
*/
-int migrate_to_node(struct mm_struct *mm, int source, int dest, int flags)
+static int migrate_to_node(struct mm_struct *mm, int source, int dest,
+ int flags)
{
nodemask_t nmask;
LIST_HEAD(pagelist);
{
nodemask_t nmask;
LIST_HEAD(pagelist);
@@
-732,8
+747,9
@@
static struct page *new_vma_page(struct page *page, unsigned long private, int *
}
#endif
}
#endif
-long do_mbind(unsigned long start, unsigned long len,
- unsigned long mode, nodemask_t *nmask, unsigned long flags)
+static long do_mbind(unsigned long start, unsigned long len,
+ unsigned long mode, nodemask_t *nmask,
+ unsigned long flags)
{
struct vm_area_struct *vma;
struct mm_struct *mm = current->mm;
{
struct vm_area_struct *vma;
struct mm_struct *mm = current->mm;
@@
-955,7
+971,7
@@
asmlinkage long sys_migrate_pages(pid_t pid, unsigned long maxnode,
goto out;
}
goto out;
}
- if (!nodes_subset(new, node_
online_map
)) {
+ if (!nodes_subset(new, node_
states[N_HIGH_MEMORY]
)) {
err = -EINVAL;
goto out;
}
err = -EINVAL;
goto out;
}
@@
-978,7
+994,8
@@
asmlinkage long sys_get_mempolicy(int __user *policy,
unsigned long maxnode,
unsigned long addr, unsigned long flags)
{
unsigned long maxnode,
unsigned long addr, unsigned long flags)
{
- int err, pval;
+ int err;
+ int uninitialized_var(pval);
nodemask_t nodes;
if (nmask != NULL && maxnode < MAX_NUMNODES)
nodemask_t nodes;
if (nmask != NULL && maxnode < MAX_NUMNODES)
@@
-1527,8
+1544,8
@@
static void sp_delete(struct shared_policy *sp, struct sp_node *n)
kmem_cache_free(sn_cache, n);
}
kmem_cache_free(sn_cache, n);
}
-st
ruct sp_node *
-
sp_alloc(unsigned long start, unsigned long end,
struct mempolicy *pol)
+st
atic struct sp_node *sp_alloc(unsigned long start, unsigned long end,
+
struct mempolicy *pol)
{
struct sp_node *n = kmem_cache_alloc(sn_cache, GFP_KERNEL);
{
struct sp_node *n = kmem_cache_alloc(sn_cache, GFP_KERNEL);
@@
-1677,7
+1694,7
@@
void __init numa_policy_init(void)
* fall back to the largest node if they're all smaller.
*/
nodes_clear(interleave_nodes);
* fall back to the largest node if they're all smaller.
*/
nodes_clear(interleave_nodes);
- for_each_
online_node(nid
) {
+ for_each_
node_state(nid, N_HIGH_MEMORY
) {
unsigned long total_pages = node_present_pages(nid);
/* Preserve the largest node */
unsigned long total_pages = node_present_pages(nid);
/* Preserve the largest node */
@@
-1706,7
+1723,8
@@
void numa_default_policy(void)
}
/* Migrate a policy to a different set of nodes */
}
/* Migrate a policy to a different set of nodes */
-void mpol_rebind_policy(struct mempolicy *pol, const nodemask_t *newmask)
+static void mpol_rebind_policy(struct mempolicy *pol,
+ const nodemask_t *newmask)
{
nodemask_t *mpolmask;
nodemask_t tmp;
{
nodemask_t *mpolmask;
nodemask_t tmp;
@@
-1963,7
+1981,7
@@
int show_numa_map(struct seq_file *m, void *v)
seq_printf(m, " huge");
} else {
check_pgd_range(vma, vma->vm_start, vma->vm_end,
seq_printf(m, " huge");
} else {
check_pgd_range(vma, vma->vm_start, vma->vm_end,
-
&node_online_map
, MPOL_MF_STATS, md);
+
&node_states[N_HIGH_MEMORY]
, MPOL_MF_STATS, md);
}
if (!md->pages)
}
if (!md->pages)
@@
-1990,7
+2008,7
@@
int show_numa_map(struct seq_file *m, void *v)
if (md->writeback)
seq_printf(m," writeback=%lu", md->writeback);
if (md->writeback)
seq_printf(m," writeback=%lu", md->writeback);
- for_each_
online_node(n
)
+ for_each_
node_state(n, N_HIGH_MEMORY
)
if (md->node[n])
seq_printf(m, " N%d=%lu", n, md->node[n]);
out:
if (md->node[n])
seq_printf(m, " N%d=%lu", n, md->node[n]);
out: