Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 16906
b: refs/heads/master
c: 909d75a
h: refs/heads/master
v: v3
  • Loading branch information
Paul Jackson authored and Linus Torvalds committed Jan 9, 2006
1 parent 0dc7998 commit 4aa02c4
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 8 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: cf2a473c4089aa41c26f653200673f5a4cc25047
refs/heads/master: 909d75a3b77bdd8baa9429bad3b69a654d2954ce
8 changes: 7 additions & 1 deletion trunk/include/linux/cpuset.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ extern int cpuset_init(void);
extern void cpuset_init_smp(void);
extern void cpuset_fork(struct task_struct *p);
extern void cpuset_exit(struct task_struct *p);
extern cpumask_t cpuset_cpus_allowed(const struct task_struct *p);
extern cpumask_t cpuset_cpus_allowed(struct task_struct *p);
extern nodemask_t cpuset_mems_allowed(struct task_struct *p);
void cpuset_init_current_mems_allowed(void);
void cpuset_update_task_memory_state(void);
#define cpuset_nodes_subset_current_mems_allowed(nodes) \
Expand Down Expand Up @@ -50,6 +51,11 @@ static inline cpumask_t cpuset_cpus_allowed(struct task_struct *p)
return cpu_possible_map;
}

static inline nodemask_t cpuset_mems_allowed(struct task_struct *p)
{
return node_possible_map;
}

static inline void cpuset_init_current_mems_allowed(void) {}
static inline void cpuset_update_task_memory_state(void) {}
#define cpuset_nodes_subset_current_mems_allowed(nodes) (1)
Expand Down
29 changes: 26 additions & 3 deletions trunk/kernel/cpuset.c
Original file line number Diff line number Diff line change
Expand Up @@ -1871,14 +1871,14 @@ void cpuset_exit(struct task_struct *tsk)
* tasks cpuset.
**/

cpumask_t cpuset_cpus_allowed(const struct task_struct *tsk)
cpumask_t cpuset_cpus_allowed(struct task_struct *tsk)
{
cpumask_t mask;

down(&callback_sem);
task_lock((struct task_struct *)tsk);
task_lock(tsk);
guarantee_online_cpus(tsk->cpuset, &mask);
task_unlock((struct task_struct *)tsk);
task_unlock(tsk);
up(&callback_sem);

return mask;
Expand All @@ -1889,6 +1889,29 @@ void cpuset_init_current_mems_allowed(void)
current->mems_allowed = NODE_MASK_ALL;
}

/**
* cpuset_mems_allowed - return mems_allowed mask from a tasks cpuset.
* @tsk: pointer to task_struct from which to obtain cpuset->mems_allowed.
*
* Description: Returns the nodemask_t mems_allowed of the cpuset
* attached to the specified @tsk. Guaranteed to return some non-empty
* subset of node_online_map, even if this means going outside the
* tasks cpuset.
**/

nodemask_t cpuset_mems_allowed(struct task_struct *tsk)
{
nodemask_t mask;

down(&callback_sem);
task_lock(tsk);
guarantee_online_mems(tsk->cpuset, &mask);
task_unlock(tsk);
up(&callback_sem);

return mask;
}

/**
* cpuset_zonelist_valid_mems_allowed - check zonelist vs. curremt mems_allowed
* @zl: the zonelist to be checked
Expand Down
3 changes: 0 additions & 3 deletions trunk/mm/mempolicy.c
Original file line number Diff line number Diff line change
Expand Up @@ -772,9 +772,6 @@ asmlinkage long sys_set_mempolicy(int mode, unsigned long __user *nmask,
return do_set_mempolicy(mode, &nodes);
}

/* Macro needed until Paul implements this function in kernel/cpusets.c */
#define cpuset_mems_allowed(task) node_online_map

asmlinkage long sys_migrate_pages(pid_t pid, unsigned long maxnode,
const unsigned long __user *old_nodes,
const unsigned long __user *new_nodes)
Expand Down

0 comments on commit 4aa02c4

Please sign in to comment.