Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 94039
b: refs/heads/master
c: 53f2556
h: refs/heads/master
i:
  94037: 757b620
  94035: 0068826
  94031: 57ee047
v: v3
  • Loading branch information
Lee Schermerhorn authored and Linus Torvalds committed Apr 28, 2008
1 parent f5573b4 commit 46da9c6
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: bea904d54d6faa92400f10c8ea3d3828b8e1eb93
refs/heads/master: 53f2556b6792ed99fde965f5e061749edd455623
28 changes: 18 additions & 10 deletions trunk/mm/mempolicy.c
Original file line number Diff line number Diff line change
Expand Up @@ -645,11 +645,9 @@ static void get_policy_nodemask(struct mempolicy *p, nodemask_t *nodes)
*nodes = p->v.nodes;
break;
case MPOL_PREFERRED:
/* or use current node instead of memory_map? */
if (p->v.preferred_node < 0)
*nodes = node_states[N_HIGH_MEMORY];
else
if (p->v.preferred_node >= 0)
node_set(p->v.preferred_node, *nodes);
/* else return empty node mask for local allocation */
break;
default:
BUG();
Expand Down Expand Up @@ -804,7 +802,7 @@ int do_migrate_pages(struct mm_struct *mm,
int err = 0;
nodemask_t tmp;

down_read(&mm->mmap_sem);
down_read(&mm->mmap_sem);

err = migrate_vmas(mm, from_nodes, to_nodes, flags);
if (err)
Expand Down Expand Up @@ -1948,10 +1946,12 @@ void numa_default_policy(void)
}

/*
* Display pages allocated per node and memory policy via /proc.
* "local" is pseudo-policy: MPOL_PREFERRED with preferred_node == -1
* Used only for mpol_to_str()
*/
#define MPOL_LOCAL (MPOL_INTERLEAVE + 1)
static const char * const policy_types[] =
{ "default", "prefer", "bind", "interleave" };
{ "default", "prefer", "bind", "interleave", "local" };

/*
* Convert a mempolicy into a string.
Expand All @@ -1962,6 +1962,7 @@ static inline int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol)
{
char *p = buffer;
int l;
int nid;
nodemask_t nodes;
unsigned short mode;
unsigned short flags = pol ? pol->flags : 0;
Expand All @@ -1978,7 +1979,11 @@ static inline int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol)

case MPOL_PREFERRED:
nodes_clear(nodes);
node_set(pol->v.preferred_node, nodes);
nid = pol->v.preferred_node;
if (nid < 0)
mode = MPOL_LOCAL; /* pseudo-policy */
else
node_set(nid, nodes);
break;

case MPOL_BIND:
Expand All @@ -1993,8 +1998,8 @@ static inline int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol)
}

l = strlen(policy_types[mode]);
if (buffer + maxlen < p + l + 1)
return -ENOSPC;
if (buffer + maxlen < p + l + 1)
return -ENOSPC;

strcpy(p, policy_types[mode]);
p += l;
Expand Down Expand Up @@ -2093,6 +2098,9 @@ static inline void check_huge_range(struct vm_area_struct *vma,
}
#endif

/*
* Display pages allocated per node and memory policy via /proc.
*/
int show_numa_map(struct seq_file *m, void *v)
{
struct proc_maps_private *priv = m->private;
Expand Down

0 comments on commit 46da9c6

Please sign in to comment.