Lines Matching +full:cs +full:- +full:0

7  *  Copyright (C) 2004-2007 Silicon Graphics, Inc.
11 * sysfs is Copyright (c) 2001-3 Patrick Mochel
13 * 2003-10-10 Written by Simon Derr.
14 * 2003-10-22 Updates by Stephen Hemminger.
15 * 2004 May-July Rework by Paul Jackson.
24 #include "cgroup-internal.h"
25 #include "cpuset-internal.h"
50 * node binding, add this key to provide a quick low-cost judgment
68 * Exclusive CPUs distributed out to sub-partitions of top_cpuset
89 * - update_partition_sd_lb()
90 * - remote_partition_check()
91 * - update_cpumasks_hier()
92 * - cpuset_update_flag()
93 * - cpuset_hotplug_update_tasks()
94 * - cpuset_handle_hotplug()
98 * Note that update_relax_domain_level() in cpuset-v1.c can still call
106 * 0 - member (not a partition root)
107 * 1 - partition root
108 * 2 - partition root without load balancing (isolated)
109 * -1 - invalid partition root
110 * -2 - invalid isolated partition root
112 * There are 2 types of partitions - local or remote. Local partitions are
123 #define PRS_MEMBER 0
126 #define PRS_INVALID_ROOT -1
127 #define PRS_INVALID_ISOLATED -2
131 return prs_state < 0; in is_prs_invalid()
145 struct cpuset *cs = task_cs(p); in inc_dl_tasks_cs() local
147 cs->nr_deadline_tasks++; in inc_dl_tasks_cs()
152 struct cpuset *cs = task_cs(p); in dec_dl_tasks_cs() local
154 cs->nr_deadline_tasks--; in dec_dl_tasks_cs()
157 static inline int is_partition_valid(const struct cpuset *cs) in is_partition_valid() argument
159 return cs->partition_root_state > 0; in is_partition_valid()
162 static inline int is_partition_invalid(const struct cpuset *cs) in is_partition_invalid() argument
164 return cs->partition_root_state < 0; in is_partition_invalid()
170 static inline void make_partition_invalid(struct cpuset *cs) in make_partition_invalid() argument
172 if (cs->partition_root_state > 0) in make_partition_invalid()
173 cs->partition_root_state = -cs->partition_root_state; in make_partition_invalid()
179 static inline void notify_partition_change(struct cpuset *cs, int old_prs) in notify_partition_change() argument
181 if (old_prs == cs->partition_root_state) in notify_partition_change()
183 cgroup_file_notify(&cs->partition_file); in notify_partition_change()
186 if (is_partition_valid(cs)) in notify_partition_change()
187 WRITE_ONCE(cs->prs_err, PERR_NONE); in notify_partition_change()
194 .relax_domain_level = -1,
199 * There are two global locks guarding cpuset structures - cpuset_mutex and
203 * paths that rely on priority inheritance (e.g. scheduler - on RT) for
220 * If a task is only holding callback_lock, then it has read-only
228 * small pieces of code, such as when reading out possibly multi-word
272 * decrease cs->attach_in_progress.
273 * wake_up cpuset_attach_wq if cs->attach_in_progress==0.
275 static inline void dec_attach_in_progress_locked(struct cpuset *cs) in dec_attach_in_progress_locked() argument
279 cs->attach_in_progress--; in dec_attach_in_progress_locked()
280 if (!cs->attach_in_progress) in dec_attach_in_progress_locked()
284 static inline void dec_attach_in_progress(struct cpuset *cs) in dec_attach_in_progress() argument
287 dec_attach_in_progress_locked(cs); in dec_attach_in_progress()
308 (cpuset_cgrp_subsys.root->flags & CGRP_ROOT_CPUSET_V2_MODE); in is_in_v2_mode()
312 * partition_is_populated - check if partition has tasks
313 * @cs: partition root to be checked
317 * It is assumed that @cs is a valid partition root. @excluded_child should
318 * be non-NULL when this cpuset is going to become a partition itself.
320 static inline bool partition_is_populated(struct cpuset *cs, in partition_is_populated() argument
326 if (cs->css.cgroup->nr_populated_csets) in partition_is_populated()
328 if (!excluded_child && !cs->nr_subparts) in partition_is_populated()
329 return cgroup_is_populated(cs->css.cgroup); in partition_is_populated()
332 cpuset_for_each_child(child, css, cs) { in partition_is_populated()
337 if (cgroup_is_populated(child->css.cgroup)) { in partition_is_populated()
352 * One way or another, we guarantee to return some non-empty subset
361 struct cpuset *cs; in guarantee_online_cpus() local
367 cs = task_cs(tsk); in guarantee_online_cpus()
369 while (!cpumask_intersects(cs->effective_cpus, pmask)) in guarantee_online_cpus()
370 cs = parent_cs(cs); in guarantee_online_cpus()
372 cpumask_and(pmask, pmask, cs->effective_cpus); in guarantee_online_cpus()
382 * One way or another, we guarantee to return some non-empty subset
387 static void guarantee_online_mems(struct cpuset *cs, nodemask_t *pmask) in guarantee_online_mems() argument
389 while (!nodes_intersects(cs->effective_mems, node_states[N_MEMORY])) in guarantee_online_mems()
390 cs = parent_cs(cs); in guarantee_online_mems()
391 nodes_and(*pmask, cs->effective_mems, node_states[N_MEMORY]); in guarantee_online_mems()
395 * alloc_cpumasks - allocate three cpumasks for cpuset
396 * @cs: the cpuset that have cpumasks to be allocated.
398 * Return: 0 if successful, -ENOMEM otherwise.
400 * Only one of the two input arguments should be non-NULL.
402 static inline int alloc_cpumasks(struct cpuset *cs, struct tmpmasks *tmp) in alloc_cpumasks() argument
406 if (cs) { in alloc_cpumasks()
407 pmask1 = &cs->cpus_allowed; in alloc_cpumasks()
408 pmask2 = &cs->effective_cpus; in alloc_cpumasks()
409 pmask3 = &cs->effective_xcpus; in alloc_cpumasks()
410 pmask4 = &cs->exclusive_cpus; in alloc_cpumasks()
412 pmask1 = &tmp->new_cpus; in alloc_cpumasks()
413 pmask2 = &tmp->addmask; in alloc_cpumasks()
414 pmask3 = &tmp->delmask; in alloc_cpumasks()
419 return -ENOMEM; in alloc_cpumasks()
431 return 0; in alloc_cpumasks()
439 return -ENOMEM; in alloc_cpumasks()
443 * free_cpumasks - free cpumasks in a tmpmasks structure
444 * @cs: the cpuset that have cpumasks to be free.
447 static inline void free_cpumasks(struct cpuset *cs, struct tmpmasks *tmp) in free_cpumasks() argument
449 if (cs) { in free_cpumasks()
450 free_cpumask_var(cs->cpus_allowed); in free_cpumasks()
451 free_cpumask_var(cs->effective_cpus); in free_cpumasks()
452 free_cpumask_var(cs->effective_xcpus); in free_cpumasks()
453 free_cpumask_var(cs->exclusive_cpus); in free_cpumasks()
456 free_cpumask_var(tmp->new_cpus); in free_cpumasks()
457 free_cpumask_var(tmp->addmask); in free_cpumasks()
458 free_cpumask_var(tmp->delmask); in free_cpumasks()
463 * alloc_trial_cpuset - allocate a trial cpuset
464 * @cs: the cpuset that the trial cpuset duplicates
466 static struct cpuset *alloc_trial_cpuset(struct cpuset *cs) in alloc_trial_cpuset() argument
470 trial = kmemdup(cs, sizeof(*cs), GFP_KERNEL); in alloc_trial_cpuset()
479 cpumask_copy(trial->cpus_allowed, cs->cpus_allowed); in alloc_trial_cpuset()
480 cpumask_copy(trial->effective_cpus, cs->effective_cpus); in alloc_trial_cpuset()
481 cpumask_copy(trial->effective_xcpus, cs->effective_xcpus); in alloc_trial_cpuset()
482 cpumask_copy(trial->exclusive_cpus, cs->exclusive_cpus); in alloc_trial_cpuset()
487 * free_cpuset - free the cpuset
488 * @cs: the cpuset to be freed
490 static inline void free_cpuset(struct cpuset *cs) in free_cpuset() argument
492 free_cpumasks(cs, NULL); in free_cpuset()
493 kfree(cs); in free_cpuset()
497 static inline struct cpumask *user_xcpus(struct cpuset *cs) in user_xcpus() argument
499 return cpumask_empty(cs->exclusive_cpus) ? cs->cpus_allowed in user_xcpus()
500 : cs->exclusive_cpus; in user_xcpus()
503 static inline bool xcpus_empty(struct cpuset *cs) in xcpus_empty() argument
505 return cpumask_empty(cs->cpus_allowed) && in xcpus_empty()
506 cpumask_empty(cs->exclusive_cpus); in xcpus_empty()
510 * cpusets_are_exclusive() - check if two cpusets are exclusive
525 * validate_change() - Used to validate that any proposed cpuset change
533 * 'cur' is the address of an actual, in-use cpuset. Operations
541 * Return 0 if valid, -errno if not.
548 int ret = 0; in validate_change()
564 * Cpusets with tasks - existing or newly being attached - can't in validate_change()
567 ret = -ENOSPC; in validate_change()
568 if ((cgroup_is_populated(cur->css.cgroup) || cur->attach_in_progress)) { in validate_change()
569 if (!cpumask_empty(cur->cpus_allowed) && in validate_change()
570 cpumask_empty(trial->cpus_allowed)) in validate_change()
572 if (!nodes_empty(cur->mems_allowed) && in validate_change()
573 nodes_empty(trial->mems_allowed)) in validate_change()
586 * for non-isolated partition root. At this point, the target in validate_change()
594 ret = -EBUSY; in validate_change()
596 !cpuset_cpumask_can_shrink(cur->effective_cpus, user_xcpus(trial))) in validate_change()
603 ret = -EINVAL; in validate_change()
610 txset = !cpumask_empty(trial->exclusive_cpus); in validate_change()
611 cxset = !cpumask_empty(c->exclusive_cpus); in validate_change()
626 xcpus = trial->exclusive_cpus; in validate_change()
627 acpus = c->cpus_allowed; in validate_change()
629 xcpus = c->exclusive_cpus; in validate_change()
630 acpus = trial->cpus_allowed; in validate_change()
636 nodes_intersects(trial->mems_allowed, c->mems_allowed)) in validate_change()
640 ret = 0; in validate_change()
653 return cpumask_intersects(a->effective_cpus, b->effective_cpus); in cpusets_overlap()
659 if (dattr->relax_domain_level < c->relax_domain_level) in update_domain_attr()
660 dattr->relax_domain_level = c->relax_domain_level; in update_domain_attr()
673 if (cpumask_empty(cp->cpus_allowed)) { in update_domain_attr_tree()
687 /* jump label reference count + the top-level cpuset */ in nr_cpusets()
695 * A 'partial partition' is a set of non-overlapping subsets whose
702 * See "What is sched_load_balance" in Documentation/admin-guide/cgroup-v1/cpusets.rst
713 * cp - cpuset pointer, used (together with pos_css) to perform a
714 * top-down scan of all cpusets. For our purposes, rebuilding
717 * csa - (for CpuSet Array) Array of pointers to all the cpusets
724 * doms - Conversion of 'csa' to an array of cpumasks, for passing to
734 * and merging them using a union-find algorithm.
744 struct cpuset *cp; /* top-down scan of cpusets */ in generate_sched_domains()
750 int ndoms = 0; /* number of sched domains in result */ in generate_sched_domains()
774 cpumask_and(doms[0], top_cpuset.effective_cpus, in generate_sched_domains()
783 csn = 0; in generate_sched_domains()
804 if (!cpumask_empty(cp->cpus_allowed) && in generate_sched_domains()
806 cpumask_intersects(cp->cpus_allowed, in generate_sched_domains()
811 !cpumask_empty(cp->effective_cpus)) in generate_sched_domains()
821 * non-empty effective_cpus will be saved into csn[]. in generate_sched_domains()
823 if ((cp->partition_root_state == PRS_ROOT) && in generate_sched_domains()
824 !cpumask_empty(cp->effective_cpus)) in generate_sched_domains()
831 if (!is_partition_valid(cp) && cpumask_empty(cp->exclusive_cpus)) in generate_sched_domains()
843 for (i = 0; i < csn; i++) in generate_sched_domains()
844 uf_node_init(&csa[i]->node); in generate_sched_domains()
847 for (i = 0; i < csn; i++) { in generate_sched_domains()
855 uf_union(&csa[i]->node, &csa[j]->node); in generate_sched_domains()
861 for (i = 0; i < csn; i++) { in generate_sched_domains()
862 if (uf_find(&csa[i]->node) == &csa[i]->node) in generate_sched_domains()
883 * to SD_ATTR_INIT. Also non-isolating partition root CPUs are a in generate_sched_domains()
887 for (i = 0; i < ndoms; i++) { in generate_sched_domains()
893 cpumask_and(doms[i], csa[i]->effective_cpus, in generate_sched_domains()
896 cpumask_copy(doms[i], csa[i]->effective_cpus); in generate_sched_domains()
903 for (nslot = 0, i = 0; i < csn; i++) { in generate_sched_domains()
904 nslot_update = 0; in generate_sched_domains()
906 if (uf_find(&csa[j]->node) == &csa[i]->node) { in generate_sched_domains()
915 cpumask_or(dp, dp, csa[j]->effective_cpus); in generate_sched_domains()
941 static void dl_update_tasks_root_domain(struct cpuset *cs) in dl_update_tasks_root_domain() argument
946 if (cs->nr_deadline_tasks == 0) in dl_update_tasks_root_domain()
949 css_task_iter_start(&cs->css, 0, &it); in dl_update_tasks_root_domain()
959 struct cpuset *cs = NULL; in dl_rebuild_rd_accounting() local
974 cpuset_for_each_descendant_pre(cs, pos_css, &top_cpuset) { in dl_rebuild_rd_accounting()
976 if (cpumask_empty(cs->effective_cpus)) { in dl_rebuild_rd_accounting()
981 css_get(&cs->css); in dl_rebuild_rd_accounting()
985 dl_update_tasks_root_domain(cs); in dl_rebuild_rd_accounting()
988 css_put(&cs->css); in dl_rebuild_rd_accounting()
1006 * If the flag 'sched_load_balance' of any cpuset with non-empty
1008 * which has that flag enabled, or if any cpuset with a non-empty
1019 struct cpuset *cs; in rebuild_sched_domains_locked() local
1046 cpuset_for_each_descendant_pre(cs, pos_css, &top_cpuset) { in rebuild_sched_domains_locked()
1047 if (!is_partition_valid(cs)) { in rebuild_sched_domains_locked()
1051 if (!cpumask_subset(cs->effective_cpus, in rebuild_sched_domains_locked()
1087 * cpuset_update_tasks_cpumask - Update the cpumasks of tasks in the cpuset.
1088 * @cs: the cpuset in which each task's cpus_allowed mask needs to be changed
1091 * Iterate through each task of @cs updating its cpus_allowed to the
1097 void cpuset_update_tasks_cpumask(struct cpuset *cs, struct cpumask *new_cpus) in cpuset_update_tasks_cpumask() argument
1101 bool top_cs = cs == &top_cpuset; in cpuset_update_tasks_cpumask()
1103 css_task_iter_start(&cs->css, 0, &it); in cpuset_update_tasks_cpumask()
1115 cpumask_and(new_cpus, possible_mask, cs->effective_cpus); in cpuset_update_tasks_cpumask()
1123 * compute_effective_cpumask - Compute the effective cpumask of the cpuset
1125 * @cs: the cpuset the need to recompute the new effective_cpus mask
1131 struct cpuset *cs, struct cpuset *parent) in compute_effective_cpumask() argument
1133 cpumask_and(new_cpus, cs->cpus_allowed, parent->effective_cpus); in compute_effective_cpumask()
1147 static void update_sibling_cpumasks(struct cpuset *parent, struct cpuset *cs,
1153 * Return: 0 if successful, an error code otherwise
1155 static int update_partition_exclusive(struct cpuset *cs, int new_prs) in update_partition_exclusive() argument
1159 if (exclusive && !is_cpu_exclusive(cs)) { in update_partition_exclusive()
1160 if (cpuset_update_flag(CS_CPU_EXCLUSIVE, cs, 1)) in update_partition_exclusive()
1162 } else if (!exclusive && is_cpu_exclusive(cs)) { in update_partition_exclusive()
1164 cpuset_update_flag(CS_CPU_EXCLUSIVE, cs, 0); in update_partition_exclusive()
1166 return 0; in update_partition_exclusive()
1176 static void update_partition_sd_lb(struct cpuset *cs, int old_prs) in update_partition_sd_lb() argument
1178 int new_prs = cs->partition_root_state; in update_partition_sd_lb()
1179 bool rebuild_domains = (new_prs > 0) || (old_prs > 0); in update_partition_sd_lb()
1183 * If cs is not a valid partition root, the load balance state in update_partition_sd_lb()
1186 if (new_prs > 0) { in update_partition_sd_lb()
1189 new_lb = is_sched_load_balance(parent_cs(cs)); in update_partition_sd_lb()
1191 if (new_lb != !!is_sched_load_balance(cs)) { in update_partition_sd_lb()
1194 set_bit(CS_SCHED_LOAD_BALANCE, &cs->flags); in update_partition_sd_lb()
1196 clear_bit(CS_SCHED_LOAD_BALANCE, &cs->flags); in update_partition_sd_lb()
1204 * tasks_nocpu_error - Return true if tasks will have no effective_cpus
1206 static bool tasks_nocpu_error(struct cpuset *parent, struct cpuset *cs, in tasks_nocpu_error() argument
1210 * A populated partition (cs or parent) can't have empty effective_cpus in tasks_nocpu_error()
1212 return (cpumask_subset(parent->effective_cpus, xcpus) && in tasks_nocpu_error()
1213 partition_is_populated(parent, cs)) || in tasks_nocpu_error()
1215 partition_is_populated(cs, NULL)); in tasks_nocpu_error()
1218 static void reset_partition_data(struct cpuset *cs) in reset_partition_data() argument
1220 struct cpuset *parent = parent_cs(cs); in reset_partition_data()
1227 cs->nr_subparts = 0; in reset_partition_data()
1228 if (cpumask_empty(cs->exclusive_cpus)) { in reset_partition_data()
1229 cpumask_clear(cs->effective_xcpus); in reset_partition_data()
1230 if (is_cpu_exclusive(cs)) in reset_partition_data()
1231 clear_bit(CS_CPU_EXCLUSIVE, &cs->flags); in reset_partition_data()
1233 if (!cpumask_and(cs->effective_cpus, parent->effective_cpus, cs->cpus_allowed)) in reset_partition_data()
1234 cpumask_copy(cs->effective_cpus, parent->effective_cpus); in reset_partition_data()
1238 * partition_xcpus_newstate - Exclusive CPUs state change
1253 * partition_xcpus_add - Add new exclusive CPUs to partition
1266 WARN_ON_ONCE(new_prs < 0); in partition_xcpus_add()
1275 isolcpus_updated = (new_prs != parent->partition_root_state); in partition_xcpus_add()
1277 partition_xcpus_newstate(parent->partition_root_state, new_prs, in partition_xcpus_add()
1280 cpumask_andnot(parent->effective_cpus, parent->effective_cpus, xcpus); in partition_xcpus_add()
1285 * partition_xcpus_del - Remove exclusive CPUs from partition
1298 WARN_ON_ONCE(old_prs < 0); in partition_xcpus_del()
1306 isolcpus_updated = (old_prs != parent->partition_root_state); in partition_xcpus_del()
1308 partition_xcpus_newstate(old_prs, parent->partition_root_state, in partition_xcpus_del()
1312 cpumask_or(parent->effective_cpus, parent->effective_cpus, xcpus); in partition_xcpus_del()
1326 WARN_ON_ONCE(ret < 0); in update_unbound_workqueue_cpumask()
1330 * cpuset_cpu_is_isolated - Check if the given CPU is isolated
1341 * compute_effective_exclusive_cpumask - compute effective exclusive CPUs
1342 * @cs: cpuset
1349 static bool compute_effective_exclusive_cpumask(struct cpuset *cs, in compute_effective_exclusive_cpumask() argument
1352 struct cpuset *parent = parent_cs(cs); in compute_effective_exclusive_cpumask()
1355 xcpus = cs->effective_xcpus; in compute_effective_exclusive_cpumask()
1357 return cpumask_and(xcpus, user_xcpus(cs), parent->effective_xcpus); in compute_effective_exclusive_cpumask()
1360 static inline bool is_remote_partition(struct cpuset *cs) in is_remote_partition() argument
1362 return !list_empty(&cs->remote_sibling); in is_remote_partition()
1365 static inline bool is_local_partition(struct cpuset *cs) in is_local_partition() argument
1367 return is_partition_valid(cs) && !is_remote_partition(cs); in is_local_partition()
1371 * remote_partition_enable - Enable current cpuset as a remote partition root
1372 * @cs: the cpuset to update
1375 * Return: 0 if successful, errcode if error
1380 static int remote_partition_enable(struct cpuset *cs, int new_prs, in remote_partition_enable() argument
1399 compute_effective_exclusive_cpumask(cs, tmp->new_cpus); in remote_partition_enable()
1400 if (cpumask_empty(tmp->new_cpus) || in remote_partition_enable()
1401 cpumask_intersects(tmp->new_cpus, subpartitions_cpus) || in remote_partition_enable()
1402 cpumask_subset(top_cpuset.effective_cpus, tmp->new_cpus)) in remote_partition_enable()
1406 isolcpus_updated = partition_xcpus_add(new_prs, NULL, tmp->new_cpus); in remote_partition_enable()
1407 list_add(&cs->remote_sibling, &remote_children); in remote_partition_enable()
1414 cpuset_update_tasks_cpumask(&top_cpuset, tmp->new_cpus); in remote_partition_enable()
1416 return 0; in remote_partition_enable()
1420 * remote_partition_disable - Remove current cpuset from remote partition list
1421 * @cs: the cpuset to update
1428 static void remote_partition_disable(struct cpuset *cs, struct tmpmasks *tmp) in remote_partition_disable() argument
1432 compute_effective_exclusive_cpumask(cs, tmp->new_cpus); in remote_partition_disable()
1433 WARN_ON_ONCE(!is_remote_partition(cs)); in remote_partition_disable()
1434 WARN_ON_ONCE(!cpumask_subset(tmp->new_cpus, subpartitions_cpus)); in remote_partition_disable()
1437 list_del_init(&cs->remote_sibling); in remote_partition_disable()
1438 isolcpus_updated = partition_xcpus_del(cs->partition_root_state, in remote_partition_disable()
1439 NULL, tmp->new_cpus); in remote_partition_disable()
1440 cs->partition_root_state = -cs->partition_root_state; in remote_partition_disable()
1441 if (!cs->prs_err) in remote_partition_disable()
1442 cs->prs_err = PERR_INVCPUS; in remote_partition_disable()
1443 reset_partition_data(cs); in remote_partition_disable()
1450 cpuset_update_tasks_cpumask(&top_cpuset, tmp->new_cpus); in remote_partition_disable()
1455 * remote_cpus_update - cpus_exclusive change of remote partition
1456 * @cs: the cpuset to be updated
1463 static void remote_cpus_update(struct cpuset *cs, struct cpumask *newmask, in remote_cpus_update() argument
1467 int prs = cs->partition_root_state; in remote_cpus_update()
1468 int isolcpus_updated = 0; in remote_cpus_update()
1470 if (WARN_ON_ONCE(!is_remote_partition(cs))) in remote_cpus_update()
1473 WARN_ON_ONCE(!cpumask_subset(cs->effective_xcpus, subpartitions_cpus)); in remote_cpus_update()
1478 adding = cpumask_andnot(tmp->addmask, newmask, cs->effective_xcpus); in remote_cpus_update()
1479 deleting = cpumask_andnot(tmp->delmask, cs->effective_xcpus, newmask); in remote_cpus_update()
1487 cpumask_intersects(tmp->addmask, subpartitions_cpus) || in remote_cpus_update()
1488 cpumask_subset(top_cpuset.effective_cpus, tmp->addmask))) in remote_cpus_update()
1493 isolcpus_updated += partition_xcpus_add(prs, NULL, tmp->addmask); in remote_cpus_update()
1495 isolcpus_updated += partition_xcpus_del(prs, NULL, tmp->delmask); in remote_cpus_update()
1502 cpuset_update_tasks_cpumask(&top_cpuset, tmp->new_cpus); in remote_cpus_update()
1507 remote_partition_disable(cs, tmp); in remote_cpus_update()
1511 * remote_partition_check - check if a child remote partition needs update
1512 * @cs: the cpuset to be updated
1517 * This should be called before the given cs has updated its cpus_allowed
1520 static void remote_partition_check(struct cpuset *cs, struct cpumask *newmask, in remote_partition_check() argument
1524 int disable_cnt = 0; in remote_partition_check()
1529 if (!cpumask_andnot(delmask, cs->effective_xcpus, newmask) || in remote_partition_check()
1543 if (cpumask_intersects(child->effective_cpus, delmask)) { in remote_partition_check()
1552 * prstate_housekeeping_conflict - check for partition & housekeeping conflicts
1572 * update_parent_effective_cpumask - update effective_cpus mask of parent cpuset
1573 * @cs: The cpuset that requests change in partition root state
1577 * Return: 0 or a partition root state error code
1579 * For partcmd_enable*, the cpuset is being transformed from a non-partition
1582 * parent's effective_cpus. The function will return 0 if all the CPUs listed
1586 * root back to a non-partition root. Any CPUs in effective_xcpus will be
1587 * given back to parent's effective_cpus. 0 will always be returned.
1608 static int update_parent_effective_cpumask(struct cpuset *cs, int cmd, in update_parent_effective_cpumask() argument
1612 struct cpuset *parent = parent_cs(cs); in update_parent_effective_cpumask()
1617 int subparts_delta = 0; in update_parent_effective_cpumask()
1618 struct cpumask *xcpus; /* cs effective_xcpus */ in update_parent_effective_cpumask()
1619 int isolcpus_updated = 0; in update_parent_effective_cpumask()
1629 old_prs = new_prs = cs->partition_root_state; in update_parent_effective_cpumask()
1630 xcpus = user_xcpus(cs); in update_parent_effective_cpumask()
1634 return 0; in update_parent_effective_cpumask()
1640 adding = cpumask_and(tmp->addmask, in update_parent_effective_cpumask()
1641 xcpus, parent->effective_xcpus); in update_parent_effective_cpumask()
1642 if (old_prs > 0) { in update_parent_effective_cpumask()
1643 new_prs = -old_prs; in update_parent_effective_cpumask()
1644 subparts_delta--; in update_parent_effective_cpumask()
1658 if (!newmask && xcpus_empty(cs)) in update_parent_effective_cpumask()
1661 nocpu = tasks_nocpu_error(parent, cs, xcpus); in update_parent_effective_cpumask()
1670 !cpumask_intersects(xcpus, parent->effective_xcpus)) in update_parent_effective_cpumask()
1683 cpumask_copy(tmp->delmask, xcpus); in update_parent_effective_cpumask()
1693 cpumask_and(tmp->addmask, xcpus, parent->effective_xcpus); in update_parent_effective_cpumask()
1695 subparts_delta--; in update_parent_effective_cpumask()
1705 /* Check newmask again, whether cpus are available for parent/cs */ in update_parent_effective_cpumask()
1706 nocpu |= tasks_nocpu_error(parent, cs, newmask); in update_parent_effective_cpumask()
1715 * & parent->effective_xcpus in update_parent_effective_cpumask()
1717 * & parent->effective_xcpus in update_parent_effective_cpumask()
1720 * delmask = newmask & parent->effective_xcpus in update_parent_effective_cpumask()
1724 deleting = cpumask_and(tmp->delmask, in update_parent_effective_cpumask()
1725 newmask, parent->effective_xcpus); in update_parent_effective_cpumask()
1727 cpumask_andnot(tmp->addmask, xcpus, newmask); in update_parent_effective_cpumask()
1728 adding = cpumask_and(tmp->addmask, tmp->addmask, in update_parent_effective_cpumask()
1729 parent->effective_xcpus); in update_parent_effective_cpumask()
1731 cpumask_andnot(tmp->delmask, newmask, xcpus); in update_parent_effective_cpumask()
1732 deleting = cpumask_and(tmp->delmask, tmp->delmask, in update_parent_effective_cpumask()
1733 parent->effective_xcpus); in update_parent_effective_cpumask()
1740 !cpumask_intersects(tmp->addmask, cpu_active_mask))) { in update_parent_effective_cpumask()
1743 adding = cpumask_and(tmp->addmask, in update_parent_effective_cpumask()
1744 xcpus, parent->effective_xcpus); in update_parent_effective_cpumask()
1750 * delmask = effective_xcpus & parent->effective_cpus in update_parent_effective_cpumask()
1765 if (is_partition_valid(cs)) in update_parent_effective_cpumask()
1766 adding = cpumask_and(tmp->addmask, in update_parent_effective_cpumask()
1767 xcpus, parent->effective_xcpus); in update_parent_effective_cpumask()
1768 } else if (is_partition_invalid(cs) && in update_parent_effective_cpumask()
1769 cpumask_subset(xcpus, parent->effective_xcpus)) { in update_parent_effective_cpumask()
1780 if (child == cs) in update_parent_effective_cpumask()
1782 if (!cpusets_are_exclusive(cs, child)) { in update_parent_effective_cpumask()
1789 deleting = cpumask_and(tmp->delmask, in update_parent_effective_cpumask()
1790 xcpus, parent->effective_cpus); in update_parent_effective_cpumask()
1798 WRITE_ONCE(cs->prs_err, part_error); in update_parent_effective_cpumask()
1805 switch (cs->partition_root_state) { in update_parent_effective_cpumask()
1809 new_prs = -old_prs; in update_parent_effective_cpumask()
1810 subparts_delta--; in update_parent_effective_cpumask()
1816 new_prs = -old_prs; in update_parent_effective_cpumask()
1824 return 0; in update_parent_effective_cpumask()
1830 * CPU lists in cs haven't been updated yet. So defer it to later. in update_parent_effective_cpumask()
1833 int err = update_partition_exclusive(cs, new_prs); in update_parent_effective_cpumask()
1848 cs->partition_root_state = new_prs; in update_parent_effective_cpumask()
1849 if (new_prs <= 0) in update_parent_effective_cpumask()
1850 cs->nr_subparts = 0; in update_parent_effective_cpumask()
1853 * Adding to parent's effective_cpus means deletion CPUs from cs in update_parent_effective_cpumask()
1858 tmp->addmask); in update_parent_effective_cpumask()
1861 tmp->delmask); in update_parent_effective_cpumask()
1864 parent->nr_subparts += subparts_delta; in update_parent_effective_cpumask()
1865 WARN_ON_ONCE(parent->nr_subparts < 0); in update_parent_effective_cpumask()
1871 update_partition_exclusive(cs, new_prs); in update_parent_effective_cpumask()
1874 cpuset_update_tasks_cpumask(parent, tmp->addmask); in update_parent_effective_cpumask()
1875 update_sibling_cpumasks(parent, cs, tmp); in update_parent_effective_cpumask()
1884 update_partition_sd_lb(cs, old_prs); in update_parent_effective_cpumask()
1886 notify_partition_change(cs, old_prs); in update_parent_effective_cpumask()
1887 return 0; in update_parent_effective_cpumask()
1891 * compute_partition_effective_cpumask - compute effective_cpus for partition
1892 * @cs: partition root cpuset
1906 static void compute_partition_effective_cpumask(struct cpuset *cs, in compute_partition_effective_cpumask() argument
1911 bool populated = partition_is_populated(cs, NULL); in compute_partition_effective_cpumask()
1921 compute_effective_exclusive_cpumask(cs, new_ecpus); in compute_partition_effective_cpumask()
1925 cpuset_for_each_child(child, css, cs) { in compute_partition_effective_cpumask()
1929 child->prs_err = 0; in compute_partition_effective_cpumask()
1930 if (!cpumask_subset(child->effective_xcpus, in compute_partition_effective_cpumask()
1931 cs->effective_xcpus)) in compute_partition_effective_cpumask()
1932 child->prs_err = PERR_INVCPUS; in compute_partition_effective_cpumask()
1934 cpumask_subset(new_ecpus, child->effective_xcpus)) in compute_partition_effective_cpumask()
1935 child->prs_err = PERR_NOCPUS; in compute_partition_effective_cpumask()
1937 if (child->prs_err) { in compute_partition_effective_cpumask()
1938 int old_prs = child->partition_root_state; in compute_partition_effective_cpumask()
1945 cs->nr_subparts--; in compute_partition_effective_cpumask()
1946 child->nr_subparts = 0; in compute_partition_effective_cpumask()
1952 child->effective_xcpus); in compute_partition_effective_cpumask()
1958 * update_cpumasks_hier - Update effective cpumasks and tasks in the subtree
1959 * @cs: the cpuset to consider
1970 static void update_cpumasks_hier(struct cpuset *cs, struct tmpmasks *tmp, in update_cpumasks_hier() argument
1979 cpuset_for_each_descendant_pre(cp, pos_css, cs) { in update_cpumasks_hier()
1986 * directly from top cpuset unless it is cs. in update_cpumasks_hier()
1988 if (remote && (cp != cs)) { in update_cpumasks_hier()
1997 if (!cpumask_empty(cp->exclusive_cpus) && (cp != cs)) { in update_cpumasks_hier()
2003 old_prs = new_prs = cp->partition_root_state; in update_cpumasks_hier()
2006 compute_partition_effective_cpumask(cp, tmp->new_cpus); in update_cpumasks_hier()
2008 compute_effective_cpumask(tmp->new_cpus, cp, parent); in update_cpumasks_hier()
2015 if (is_partition_valid(cp) && cpumask_empty(tmp->new_cpus)) { in update_cpumasks_hier()
2026 if (is_in_v2_mode() && !remote && cpumask_empty(tmp->new_cpus)) in update_cpumasks_hier()
2027 cpumask_copy(tmp->new_cpus, parent->effective_cpus); in update_cpumasks_hier()
2039 if (!cp->partition_root_state && !force && in update_cpumasks_hier()
2040 cpumask_equal(tmp->new_cpus, cp->effective_cpus) && in update_cpumasks_hier()
2050 * for cs already in update_cpumask(). We should also call in update_cpumasks_hier()
2054 if ((cp != cs) && old_prs) { in update_cpumasks_hier()
2055 switch (parent->partition_root_state) { in update_cpumasks_hier()
2068 new_prs = -cp->partition_root_state; in update_cpumasks_hier()
2069 WRITE_ONCE(cp->prs_err, in update_cpumasks_hier()
2076 if (!css_tryget_online(&cp->css)) in update_cpumasks_hier()
2086 new_prs = cp->partition_root_state; in update_cpumasks_hier()
2090 cpumask_copy(cp->effective_cpus, tmp->new_cpus); in update_cpumasks_hier()
2091 cp->partition_root_state = new_prs; in update_cpumasks_hier()
2096 if ((new_prs > 0) && cpumask_empty(cp->exclusive_cpus)) in update_cpumasks_hier()
2097 cpumask_and(cp->effective_xcpus, in update_cpumasks_hier()
2098 cp->cpus_allowed, parent->effective_xcpus); in update_cpumasks_hier()
2099 else if (new_prs < 0) in update_cpumasks_hier()
2106 !cpumask_equal(cp->cpus_allowed, cp->effective_cpus)); in update_cpumasks_hier()
2108 cpuset_update_tasks_cpumask(cp, cp->effective_cpus); in update_cpumasks_hier()
2118 set_bit(CS_SCHED_LOAD_BALANCE, &cp->flags); in update_cpumasks_hier()
2120 clear_bit(CS_SCHED_LOAD_BALANCE, &cp->flags); in update_cpumasks_hier()
2124 * On legacy hierarchy, if the effective cpumask of any non- in update_cpumasks_hier()
2129 if (!cpumask_empty(cp->cpus_allowed) && in update_cpumasks_hier()
2135 css_put(&cp->css); in update_cpumasks_hier()
2144 * update_sibling_cpumasks - Update siblings cpumasks
2146 * @cs: Current cpuset
2149 static void update_sibling_cpumasks(struct cpuset *parent, struct cpuset *cs, in update_sibling_cpumasks() argument
2171 if (sibling == cs) in update_sibling_cpumasks()
2174 compute_effective_cpumask(tmp->new_cpus, sibling, in update_sibling_cpumasks()
2176 if (cpumask_equal(tmp->new_cpus, sibling->effective_cpus)) in update_sibling_cpumasks()
2179 if (!css_tryget_online(&sibling->css)) in update_sibling_cpumasks()
2185 css_put(&sibling->css); in update_sibling_cpumasks()
2191 * update_cpumask - update the cpus_allowed mask of a cpuset and all tasks in it
2192 * @cs: the cpuset to consider
2196 static int update_cpumask(struct cpuset *cs, struct cpuset *trialcs, in update_cpumask() argument
2201 struct cpuset *parent = parent_cs(cs); in update_cpumask()
2204 int old_prs = cs->partition_root_state; in update_cpumask()
2206 /* top_cpuset.cpus_allowed tracks cpu_online_mask; it's read-only */ in update_cpumask()
2207 if (cs == &top_cpuset) in update_cpumask()
2208 return -EACCES; in update_cpumask()
2217 cpumask_clear(trialcs->cpus_allowed); in update_cpumask()
2218 if (cpumask_empty(trialcs->exclusive_cpus)) in update_cpumask()
2219 cpumask_clear(trialcs->effective_xcpus); in update_cpumask()
2221 retval = cpulist_parse(buf, trialcs->cpus_allowed); in update_cpumask()
2222 if (retval < 0) in update_cpumask()
2225 if (!cpumask_subset(trialcs->cpus_allowed, in update_cpumask()
2227 return -EINVAL; in update_cpumask()
2232 * trialcs->effective_xcpus is used as a temporary cpumask in update_cpumask()
2235 if (!cpumask_empty(trialcs->exclusive_cpus) || is_partition_valid(cs)) in update_cpumask()
2240 if (cpumask_equal(cs->cpus_allowed, trialcs->cpus_allowed)) in update_cpumask()
2241 return 0; in update_cpumask()
2244 return -ENOMEM; in update_cpumask()
2247 if (is_partition_valid(cs) && in update_cpumask()
2248 cpumask_empty(trialcs->effective_xcpus)) { in update_cpumask()
2250 cs->prs_err = PERR_INVCPUS; in update_cpumask()
2251 } else if (prstate_housekeeping_conflict(old_prs, trialcs->effective_xcpus)) { in update_cpumask()
2253 cs->prs_err = PERR_HKEEPING; in update_cpumask()
2254 } else if (tasks_nocpu_error(parent, cs, trialcs->effective_xcpus)) { in update_cpumask()
2256 cs->prs_err = PERR_NOCPUS; in update_cpumask()
2264 force = !cpumask_equal(cs->effective_xcpus, trialcs->effective_xcpus); in update_cpumask()
2266 retval = validate_change(cs, trialcs); in update_cpumask()
2268 if ((retval == -EINVAL) && cpuset_v2()) { in update_cpumask()
2273 * The -EINVAL error code indicates that partition sibling in update_cpumask()
2285 cpumask_intersects(xcpus, cp->effective_xcpus)) { in update_cpumask()
2292 retval = 0; in update_cpumask()
2295 if (retval < 0) in update_cpumask()
2298 if (is_partition_valid(cs) || in update_cpumask()
2299 (is_partition_invalid(cs) && !invalidate)) { in update_cpumask()
2300 struct cpumask *xcpus = trialcs->effective_xcpus; in update_cpumask()
2302 if (cpumask_empty(xcpus) && is_partition_invalid(cs)) in update_cpumask()
2303 xcpus = trialcs->cpus_allowed; in update_cpumask()
2308 if (is_remote_partition(cs)) in update_cpumask()
2309 remote_cpus_update(cs, xcpus, &tmp); in update_cpumask()
2311 update_parent_effective_cpumask(cs, partcmd_invalidate, in update_cpumask()
2314 update_parent_effective_cpumask(cs, partcmd_update, in update_cpumask()
2316 } else if (!cpumask_empty(cs->exclusive_cpus)) { in update_cpumask()
2318 * Use trialcs->effective_cpus as a temp cpumask in update_cpumask()
2320 remote_partition_check(cs, trialcs->effective_xcpus, in update_cpumask()
2321 trialcs->effective_cpus, &tmp); in update_cpumask()
2325 cpumask_copy(cs->cpus_allowed, trialcs->cpus_allowed); in update_cpumask()
2326 cpumask_copy(cs->effective_xcpus, trialcs->effective_xcpus); in update_cpumask()
2327 if ((old_prs > 0) && !is_partition_valid(cs)) in update_cpumask()
2328 reset_partition_data(cs); in update_cpumask()
2332 update_cpumasks_hier(cs, &tmp, force); in update_cpumask()
2335 if (cs->partition_root_state) in update_cpumask()
2336 update_partition_sd_lb(cs, old_prs); in update_cpumask()
2343 * update_exclusive_cpumask - update the exclusive_cpus mask of a cpuset
2344 * @cs: the cpuset to consider
2348 * The tasks' cpumask will be updated if cs is a valid partition root.
2350 static int update_exclusive_cpumask(struct cpuset *cs, struct cpuset *trialcs, in update_exclusive_cpumask() argument
2355 struct cpuset *parent = parent_cs(cs); in update_exclusive_cpumask()
2358 int old_prs = cs->partition_root_state; in update_exclusive_cpumask()
2361 cpumask_clear(trialcs->exclusive_cpus); in update_exclusive_cpumask()
2362 cpumask_clear(trialcs->effective_xcpus); in update_exclusive_cpumask()
2364 retval = cpulist_parse(buf, trialcs->exclusive_cpus); in update_exclusive_cpumask()
2365 if (retval < 0) in update_exclusive_cpumask()
2370 if (cpumask_equal(cs->exclusive_cpus, trialcs->exclusive_cpus)) in update_exclusive_cpumask()
2371 return 0; in update_exclusive_cpumask()
2380 force = !cpumask_equal(cs->effective_xcpus, trialcs->effective_xcpus); in update_exclusive_cpumask()
2382 retval = validate_change(cs, trialcs); in update_exclusive_cpumask()
2387 return -ENOMEM; in update_exclusive_cpumask()
2390 if (cpumask_empty(trialcs->effective_xcpus)) { in update_exclusive_cpumask()
2392 cs->prs_err = PERR_INVCPUS; in update_exclusive_cpumask()
2393 } else if (prstate_housekeeping_conflict(old_prs, trialcs->effective_xcpus)) { in update_exclusive_cpumask()
2395 cs->prs_err = PERR_HKEEPING; in update_exclusive_cpumask()
2396 } else if (tasks_nocpu_error(parent, cs, trialcs->effective_xcpus)) { in update_exclusive_cpumask()
2398 cs->prs_err = PERR_NOCPUS; in update_exclusive_cpumask()
2401 if (is_remote_partition(cs)) { in update_exclusive_cpumask()
2403 remote_partition_disable(cs, &tmp); in update_exclusive_cpumask()
2405 remote_cpus_update(cs, trialcs->effective_xcpus, in update_exclusive_cpumask()
2408 update_parent_effective_cpumask(cs, partcmd_invalidate, in update_exclusive_cpumask()
2411 update_parent_effective_cpumask(cs, partcmd_update, in update_exclusive_cpumask()
2412 trialcs->effective_xcpus, &tmp); in update_exclusive_cpumask()
2414 } else if (!cpumask_empty(trialcs->exclusive_cpus)) { in update_exclusive_cpumask()
2416 * Use trialcs->effective_cpus as a temp cpumask in update_exclusive_cpumask()
2418 remote_partition_check(cs, trialcs->effective_xcpus, in update_exclusive_cpumask()
2419 trialcs->effective_cpus, &tmp); in update_exclusive_cpumask()
2422 cpumask_copy(cs->exclusive_cpus, trialcs->exclusive_cpus); in update_exclusive_cpumask()
2423 cpumask_copy(cs->effective_xcpus, trialcs->effective_xcpus); in update_exclusive_cpumask()
2424 if ((old_prs > 0) && !is_partition_valid(cs)) in update_exclusive_cpumask()
2425 reset_partition_data(cs); in update_exclusive_cpumask()
2433 if (is_partition_valid(cs) || force) in update_exclusive_cpumask()
2434 update_cpumasks_hier(cs, &tmp, force); in update_exclusive_cpumask()
2437 if (cs->partition_root_state) in update_exclusive_cpumask()
2438 update_partition_sd_lb(cs, old_prs); in update_exclusive_cpumask()
2441 return 0; in update_exclusive_cpumask()
2465 do_migrate_pages(mwork->mm, &mwork->from, &mwork->to, MPOL_MF_MOVE_ALL); in cpuset_migrate_mm_workfn()
2466 mmput(mwork->mm); in cpuset_migrate_mm_workfn()
2482 mwork->mm = mm; in cpuset_migrate_mm()
2483 mwork->from = *from; in cpuset_migrate_mm()
2484 mwork->to = *to; in cpuset_migrate_mm()
2485 INIT_WORK(&mwork->work, cpuset_migrate_mm_workfn); in cpuset_migrate_mm()
2486 queue_work(cpuset_migrate_mm_wq, &mwork->work); in cpuset_migrate_mm()
2498 * cpuset_change_task_nodemask - change task's mems_allowed and mempolicy
2502 * We use the mems_allowed_seq seqlock to safely update both tsk->mems_allowed
2513 write_seqcount_begin(&tsk->mems_allowed_seq); in cpuset_change_task_nodemask()
2515 nodes_or(tsk->mems_allowed, tsk->mems_allowed, *newmems); in cpuset_change_task_nodemask()
2517 tsk->mems_allowed = *newmems; in cpuset_change_task_nodemask()
2519 write_seqcount_end(&tsk->mems_allowed_seq); in cpuset_change_task_nodemask()
2528 * cpuset_update_tasks_nodemask - Update the nodemasks of tasks in the cpuset.
2529 * @cs: the cpuset in which each task's mems_allowed mask needs to be changed
2531 * Iterate through each task of @cs updating its mems_allowed to the
2535 void cpuset_update_tasks_nodemask(struct cpuset *cs) in cpuset_update_tasks_nodemask() argument
2541 cpuset_being_rebound = cs; /* causes mpol_dup() rebind */ in cpuset_update_tasks_nodemask()
2543 guarantee_online_mems(cs, &newmems); in cpuset_update_tasks_nodemask()
2547 * take while holding tasklist_lock. Forks can happen - the in cpuset_update_tasks_nodemask()
2555 css_task_iter_start(&cs->css, 0, &it); in cpuset_update_tasks_nodemask()
2566 migrate = is_memory_migrate(cs); in cpuset_update_tasks_nodemask()
2568 mpol_rebind_mm(mm, &cs->mems_allowed); in cpuset_update_tasks_nodemask()
2570 cpuset_migrate_mm(mm, &cs->old_mems_allowed, &newmems); in cpuset_update_tasks_nodemask()
2578 * cs->old_mems_allowed. in cpuset_update_tasks_nodemask()
2580 cs->old_mems_allowed = newmems; in cpuset_update_tasks_nodemask()
2587 * update_nodemasks_hier - Update effective nodemasks and tasks in the subtree
2588 * @cs: the cpuset to consider
2598 static void update_nodemasks_hier(struct cpuset *cs, nodemask_t *new_mems) in update_nodemasks_hier() argument
2604 cpuset_for_each_descendant_pre(cp, pos_css, cs) { in update_nodemasks_hier()
2607 nodes_and(*new_mems, cp->mems_allowed, parent->effective_mems); in update_nodemasks_hier()
2614 *new_mems = parent->effective_mems; in update_nodemasks_hier()
2617 if (nodes_equal(*new_mems, cp->effective_mems)) { in update_nodemasks_hier()
2622 if (!css_tryget_online(&cp->css)) in update_nodemasks_hier()
2627 cp->effective_mems = *new_mems; in update_nodemasks_hier()
2631 !nodes_equal(cp->mems_allowed, cp->effective_mems)); in update_nodemasks_hier()
2636 css_put(&cp->css); in update_nodemasks_hier()
2650 * Will take tasklist_lock, scan tasklist for tasks in cpuset cs,
2651 * lock each such tasks mm->mmap_lock, scan its vma's and rebind
2654 static int update_nodemask(struct cpuset *cs, struct cpuset *trialcs, in update_nodemask() argument
2661 * it's read-only in update_nodemask()
2663 if (cs == &top_cpuset) { in update_nodemask()
2664 retval = -EACCES; in update_nodemask()
2675 nodes_clear(trialcs->mems_allowed); in update_nodemask()
2677 retval = nodelist_parse(buf, trialcs->mems_allowed); in update_nodemask()
2678 if (retval < 0) in update_nodemask()
2681 if (!nodes_subset(trialcs->mems_allowed, in update_nodemask()
2683 retval = -EINVAL; in update_nodemask()
2688 if (nodes_equal(cs->mems_allowed, trialcs->mems_allowed)) { in update_nodemask()
2689 retval = 0; /* Too easy - nothing to do */ in update_nodemask()
2692 retval = validate_change(cs, trialcs); in update_nodemask()
2693 if (retval < 0) in update_nodemask()
2696 check_insane_mems_config(&trialcs->mems_allowed); in update_nodemask()
2699 cs->mems_allowed = trialcs->mems_allowed; in update_nodemask()
2702 /* use trialcs->mems_allowed as a temp variable */ in update_nodemask()
2703 update_nodemasks_hier(cs, &trialcs->mems_allowed); in update_nodemask()
2720 * cpuset_update_flag - read a 0 or a 1 in a file and update associated flag
2722 * cs: the cpuset to update
2728 int cpuset_update_flag(cpuset_flagbits_t bit, struct cpuset *cs, in cpuset_update_flag() argument
2736 trialcs = alloc_trial_cpuset(cs); in cpuset_update_flag()
2738 return -ENOMEM; in cpuset_update_flag()
2741 set_bit(bit, &trialcs->flags); in cpuset_update_flag()
2743 clear_bit(bit, &trialcs->flags); in cpuset_update_flag()
2745 err = validate_change(cs, trialcs); in cpuset_update_flag()
2746 if (err < 0) in cpuset_update_flag()
2749 balance_flag_changed = (is_sched_load_balance(cs) != in cpuset_update_flag()
2752 spread_flag_changed = ((is_spread_slab(cs) != is_spread_slab(trialcs)) in cpuset_update_flag()
2753 || (is_spread_page(cs) != is_spread_page(trialcs))); in cpuset_update_flag()
2756 cs->flags = trialcs->flags; in cpuset_update_flag()
2759 if (!cpumask_empty(trialcs->cpus_allowed) && balance_flag_changed) { in cpuset_update_flag()
2767 cpuset1_update_tasks_flags(cs); in cpuset_update_flag()
2774 * update_prstate - update partition_root_state
2775 * @cs: the cpuset to update
2777 * Return: 0 if successful, != 0 if error
2781 static int update_prstate(struct cpuset *cs, int new_prs) in update_prstate() argument
2783 int err = PERR_NONE, old_prs = cs->partition_root_state; in update_prstate()
2784 struct cpuset *parent = parent_cs(cs); in update_prstate()
2789 return 0; in update_prstate()
2798 return -ENOMEM; in update_prstate()
2804 if ((new_prs > 0) && cpumask_empty(cs->exclusive_cpus)) { in update_prstate()
2806 cpumask_and(cs->effective_xcpus, in update_prstate()
2807 cs->cpus_allowed, parent->effective_xcpus); in update_prstate()
2811 err = update_partition_exclusive(cs, new_prs); in update_prstate()
2819 if (xcpus_empty(cs)) { in update_prstate()
2832 err = update_parent_effective_cpumask(cs, cmd, NULL, &tmpmask); in update_prstate()
2834 err = remote_partition_enable(cs, new_prs, &tmpmask); in update_prstate()
2846 if (is_remote_partition(cs)) in update_prstate()
2847 remote_partition_disable(cs, &tmpmask); in update_prstate()
2849 update_parent_effective_cpumask(cs, partcmd_disable, in update_prstate()
2863 new_prs = -new_prs; in update_prstate()
2864 update_partition_exclusive(cs, new_prs); in update_prstate()
2868 cs->partition_root_state = new_prs; in update_prstate()
2869 WRITE_ONCE(cs->prs_err, err); in update_prstate()
2870 if (!is_partition_valid(cs)) in update_prstate()
2871 reset_partition_data(cs); in update_prstate()
2873 partition_xcpus_newstate(old_prs, new_prs, cs->effective_xcpus); in update_prstate()
2878 update_cpumasks_hier(cs, &tmpmask, !new_prs); in update_prstate()
2881 update_partition_sd_lb(cs, old_prs); in update_prstate()
2883 notify_partition_change(cs, old_prs); in update_prstate()
2887 return 0; in update_prstate()
2898 static int cpuset_can_attach_check(struct cpuset *cs) in cpuset_can_attach_check() argument
2900 if (cpumask_empty(cs->effective_cpus) || in cpuset_can_attach_check()
2901 (!is_in_v2_mode() && nodes_empty(cs->mems_allowed))) in cpuset_can_attach_check()
2902 return -ENOSPC; in cpuset_can_attach_check()
2903 return 0; in cpuset_can_attach_check()
2906 static void reset_migrate_dl_data(struct cpuset *cs) in reset_migrate_dl_data() argument
2908 cs->nr_migrate_dl_tasks = 0; in reset_migrate_dl_data()
2909 cs->sum_migrate_dl_bw = 0; in reset_migrate_dl_data()
2916 struct cpuset *cs, *oldcs; in cpuset_can_attach() local
2924 cs = css_cs(css); in cpuset_can_attach()
2929 ret = cpuset_can_attach_check(cs); in cpuset_can_attach()
2933 cpus_updated = !cpumask_equal(cs->effective_cpus, oldcs->effective_cpus); in cpuset_can_attach()
2934 mems_updated = !nodes_equal(cs->effective_mems, oldcs->effective_mems); in cpuset_can_attach()
2953 cs->nr_migrate_dl_tasks++; in cpuset_can_attach()
2954 cs->sum_migrate_dl_bw += task->dl.dl_bw; in cpuset_can_attach()
2958 if (!cs->nr_migrate_dl_tasks) in cpuset_can_attach()
2961 if (!cpumask_intersects(oldcs->effective_cpus, cs->effective_cpus)) { in cpuset_can_attach()
2962 int cpu = cpumask_any_and(cpu_active_mask, cs->effective_cpus); in cpuset_can_attach()
2965 reset_migrate_dl_data(cs); in cpuset_can_attach()
2966 ret = -EINVAL; in cpuset_can_attach()
2970 ret = dl_bw_alloc(cpu, cs->sum_migrate_dl_bw); in cpuset_can_attach()
2972 reset_migrate_dl_data(cs); in cpuset_can_attach()
2982 cs->attach_in_progress++; in cpuset_can_attach()
2991 struct cpuset *cs; in cpuset_cancel_attach() local
2994 cs = css_cs(css); in cpuset_cancel_attach()
2997 dec_attach_in_progress_locked(cs); in cpuset_cancel_attach()
2999 if (cs->nr_migrate_dl_tasks) { in cpuset_cancel_attach()
3000 int cpu = cpumask_any(cs->effective_cpus); in cpuset_cancel_attach()
3002 dl_bw_free(cpu, cs->sum_migrate_dl_bw); in cpuset_cancel_attach()
3003 reset_migrate_dl_data(cs); in cpuset_cancel_attach()
3017 static void cpuset_attach_task(struct cpuset *cs, struct task_struct *task) in cpuset_attach_task() argument
3021 if (cs != &top_cpuset) in cpuset_attach_task()
3033 cpuset1_update_task_spread_flags(cs, task); in cpuset_attach_task()
3041 struct cpuset *cs; in cpuset_attach() local
3046 cs = css_cs(css); in cpuset_attach()
3050 cpus_updated = !cpumask_equal(cs->effective_cpus, in cpuset_attach()
3051 oldcs->effective_cpus); in cpuset_attach()
3052 mems_updated = !nodes_equal(cs->effective_mems, oldcs->effective_mems); in cpuset_attach()
3061 cpuset_attach_nodemask_to = cs->effective_mems; in cpuset_attach()
3065 guarantee_online_mems(cs, &cpuset_attach_nodemask_to); in cpuset_attach()
3068 cpuset_attach_task(cs, task); in cpuset_attach()
3076 cpuset_attach_nodemask_to = cs->effective_mems; in cpuset_attach()
3077 if (!is_memory_migrate(cs) && !mems_updated) in cpuset_attach()
3094 if (is_memory_migrate(cs)) in cpuset_attach()
3095 cpuset_migrate_mm(mm, &oldcs->old_mems_allowed, in cpuset_attach()
3103 cs->old_mems_allowed = cpuset_attach_nodemask_to; in cpuset_attach()
3105 if (cs->nr_migrate_dl_tasks) { in cpuset_attach()
3106 cs->nr_deadline_tasks += cs->nr_migrate_dl_tasks; in cpuset_attach()
3107 oldcs->nr_deadline_tasks -= cs->nr_migrate_dl_tasks; in cpuset_attach()
3108 reset_migrate_dl_data(cs); in cpuset_attach()
3111 dec_attach_in_progress_locked(cs); in cpuset_attach()
3122 struct cpuset *cs = css_cs(of_css(of)); in cpuset_write_resmask() local
3124 int retval = -ENODEV; in cpuset_write_resmask()
3129 if (!is_cpuset_online(cs)) in cpuset_write_resmask()
3132 trialcs = alloc_trial_cpuset(cs); in cpuset_write_resmask()
3134 retval = -ENOMEM; in cpuset_write_resmask()
3138 switch (of_cft(of)->private) { in cpuset_write_resmask()
3140 retval = update_cpumask(cs, trialcs, buf); in cpuset_write_resmask()
3143 retval = update_exclusive_cpumask(cs, trialcs, buf); in cpuset_write_resmask()
3146 retval = update_nodemask(cs, trialcs, buf); in cpuset_write_resmask()
3149 retval = -EINVAL; in cpuset_write_resmask()
3173 struct cpuset *cs = css_cs(seq_css(sf)); in cpuset_common_seq_show() local
3174 cpuset_filetype_t type = seq_cft(sf)->private; in cpuset_common_seq_show()
3175 int ret = 0; in cpuset_common_seq_show()
3181 seq_printf(sf, "%*pbl\n", cpumask_pr_args(cs->cpus_allowed)); in cpuset_common_seq_show()
3184 seq_printf(sf, "%*pbl\n", nodemask_pr_args(&cs->mems_allowed)); in cpuset_common_seq_show()
3187 seq_printf(sf, "%*pbl\n", cpumask_pr_args(cs->effective_cpus)); in cpuset_common_seq_show()
3190 seq_printf(sf, "%*pbl\n", nodemask_pr_args(&cs->effective_mems)); in cpuset_common_seq_show()
3193 seq_printf(sf, "%*pbl\n", cpumask_pr_args(cs->exclusive_cpus)); in cpuset_common_seq_show()
3196 seq_printf(sf, "%*pbl\n", cpumask_pr_args(cs->effective_xcpus)); in cpuset_common_seq_show()
3205 ret = -EINVAL; in cpuset_common_seq_show()
3214 struct cpuset *cs = css_cs(seq_css(seq)); in sched_partition_show() local
3217 switch (cs->partition_root_state) { in sched_partition_show()
3233 err = perr_strings[READ_ONCE(cs->prs_err)]; in sched_partition_show()
3240 return 0; in sched_partition_show()
3246 struct cpuset *cs = css_cs(of_css(of)); in sched_partition_write() local
3248 int retval = -ENODEV; in sched_partition_write()
3259 return -EINVAL; in sched_partition_write()
3261 css_get(&cs->css); in sched_partition_write()
3264 if (!is_cpuset_online(cs)) in sched_partition_write()
3267 retval = update_prstate(cs, val); in sched_partition_write()
3271 css_put(&cs->css); in sched_partition_write()
3354 * cpuset_css_alloc - Allocate a cpuset css
3357 * Return: cpuset css on success, -ENOMEM on failure.
3359 * Allocate and initialize a new cpuset css, for non-NULL @parent_css, return
3365 struct cpuset *cs; in cpuset_css_alloc() local
3370 cs = kzalloc(sizeof(*cs), GFP_KERNEL); in cpuset_css_alloc()
3371 if (!cs) in cpuset_css_alloc()
3372 return ERR_PTR(-ENOMEM); in cpuset_css_alloc()
3374 if (alloc_cpumasks(cs, NULL)) { in cpuset_css_alloc()
3375 kfree(cs); in cpuset_css_alloc()
3376 return ERR_PTR(-ENOMEM); in cpuset_css_alloc()
3379 __set_bit(CS_SCHED_LOAD_BALANCE, &cs->flags); in cpuset_css_alloc()
3380 fmeter_init(&cs->fmeter); in cpuset_css_alloc()
3381 cs->relax_domain_level = -1; in cpuset_css_alloc()
3382 INIT_LIST_HEAD(&cs->remote_sibling); in cpuset_css_alloc()
3386 __set_bit(CS_MEMORY_MIGRATE, &cs->flags); in cpuset_css_alloc()
3388 return &cs->css; in cpuset_css_alloc()
3393 struct cpuset *cs = css_cs(css); in cpuset_css_online() local
3394 struct cpuset *parent = parent_cs(cs); in cpuset_css_online()
3399 return 0; in cpuset_css_online()
3404 set_bit(CS_ONLINE, &cs->flags); in cpuset_css_online()
3406 set_bit(CS_SPREAD_PAGE, &cs->flags); in cpuset_css_online()
3408 set_bit(CS_SPREAD_SLAB, &cs->flags); in cpuset_css_online()
3413 clear_bit(CS_SCHED_LOAD_BALANCE, &cs->flags); in cpuset_css_online()
3419 cpumask_copy(cs->effective_cpus, parent->effective_cpus); in cpuset_css_online()
3420 cs->effective_mems = parent->effective_mems; in cpuset_css_online()
3424 if (!test_bit(CGRP_CPUSET_CLONE_CHILDREN, &css->cgroup->flags)) in cpuset_css_online()
3430 * historical reasons - the flag may be specified during mount. in cpuset_css_online()
3433 * refuse to clone the configuration - thereby refusing the task to in cpuset_css_online()
3437 * changed to grant parent->cpus_allowed-sibling_cpus_exclusive in cpuset_css_online()
3450 cs->mems_allowed = parent->mems_allowed; in cpuset_css_online()
3451 cs->effective_mems = parent->mems_allowed; in cpuset_css_online()
3452 cpumask_copy(cs->cpus_allowed, parent->cpus_allowed); in cpuset_css_online()
3453 cpumask_copy(cs->effective_cpus, parent->cpus_allowed); in cpuset_css_online()
3458 return 0; in cpuset_css_online()
3474 struct cpuset *cs = css_cs(css); in cpuset_css_offline() local
3479 if (is_partition_valid(cs)) in cpuset_css_offline()
3480 update_prstate(cs, 0); in cpuset_css_offline()
3482 if (!cpuset_v2() && is_sched_load_balance(cs)) in cpuset_css_offline()
3483 cpuset_update_flag(CS_SCHED_LOAD_BALANCE, cs, 0); in cpuset_css_offline()
3486 clear_bit(CS_ONLINE, &cs->flags); in cpuset_css_offline()
3494 struct cpuset *cs = css_cs(css); in cpuset_css_free() local
3496 free_cpuset(cs); in cpuset_css_free()
3524 struct cpuset *cs = css_cs(cset->subsys[cpuset_cgrp_id]); in cpuset_can_fork() local
3529 same_cs = (cs == task_cs(current)); in cpuset_can_fork()
3533 return 0; in cpuset_can_fork()
3539 ret = cpuset_can_attach_check(cs); in cpuset_can_fork()
3555 cs->attach_in_progress++; in cpuset_can_fork()
3563 struct cpuset *cs = css_cs(cset->subsys[cpuset_cgrp_id]); in cpuset_cancel_fork() local
3567 same_cs = (cs == task_cs(current)); in cpuset_cancel_fork()
3573 dec_attach_in_progress(cs); in cpuset_cancel_fork()
3583 struct cpuset *cs; in cpuset_fork() local
3587 cs = task_cs(task); in cpuset_fork()
3588 same_cs = (cs == task_cs(current)); in cpuset_fork()
3592 if (cs == &top_cpuset) in cpuset_fork()
3595 set_cpus_allowed_ptr(task, current->cpus_ptr); in cpuset_fork()
3596 task->mems_allowed = current->mems_allowed; in cpuset_fork()
3602 guarantee_online_mems(cs, &cpuset_attach_nodemask_to); in cpuset_fork()
3603 cpuset_attach_task(cs, task); in cpuset_fork()
3605 dec_attach_in_progress_locked(cs); in cpuset_fork()
3631 * cpuset_init - initialize cpusets at system boot
3664 return 0; in cpuset_init()
3668 hotplug_update_tasks(struct cpuset *cs, in hotplug_update_tasks() argument
3673 if (cpumask_empty(new_cpus) && !is_partition_valid(cs)) in hotplug_update_tasks()
3674 cpumask_copy(new_cpus, parent_cs(cs)->effective_cpus); in hotplug_update_tasks()
3676 *new_mems = parent_cs(cs)->effective_mems; in hotplug_update_tasks()
3679 cpumask_copy(cs->effective_cpus, new_cpus); in hotplug_update_tasks()
3680 cs->effective_mems = *new_mems; in hotplug_update_tasks()
3684 cpuset_update_tasks_cpumask(cs, new_cpus); in hotplug_update_tasks()
3686 cpuset_update_tasks_nodemask(cs); in hotplug_update_tasks()
3695 * cpuset_hotplug_update_tasks - update tasks in a cpuset for hotunplug
3696 * @cs: cpuset in interest
3699 * Compare @cs's cpu and mem masks against top_cpuset and if some have gone
3700 * offline, update @cs accordingly. If @cs ends up with no CPU or memory,
3703 static void cpuset_hotplug_update_tasks(struct cpuset *cs, struct tmpmasks *tmp) in cpuset_hotplug_update_tasks() argument
3710 int partcmd = -1; in cpuset_hotplug_update_tasks()
3713 wait_event(cpuset_attach_wq, cs->attach_in_progress == 0); in cpuset_hotplug_update_tasks()
3721 if (cs->attach_in_progress) { in cpuset_hotplug_update_tasks()
3726 parent = parent_cs(cs); in cpuset_hotplug_update_tasks()
3727 compute_effective_cpumask(&new_cpus, cs, parent); in cpuset_hotplug_update_tasks()
3728 nodes_and(new_mems, cs->mems_allowed, parent->effective_mems); in cpuset_hotplug_update_tasks()
3730 if (!tmp || !cs->partition_root_state) in cpuset_hotplug_update_tasks()
3737 remote = is_remote_partition(cs); in cpuset_hotplug_update_tasks()
3738 if (remote || (is_partition_valid(cs) && is_partition_valid(parent))) in cpuset_hotplug_update_tasks()
3739 compute_partition_effective_cpumask(cs, &new_cpus); in cpuset_hotplug_update_tasks()
3742 partition_is_populated(cs, NULL)) { in cpuset_hotplug_update_tasks()
3743 remote_partition_disable(cs, tmp); in cpuset_hotplug_update_tasks()
3744 compute_effective_cpumask(&new_cpus, cs, parent); in cpuset_hotplug_update_tasks()
3756 if (is_local_partition(cs) && (!is_partition_valid(parent) || in cpuset_hotplug_update_tasks()
3757 tasks_nocpu_error(parent, cs, &new_cpus))) in cpuset_hotplug_update_tasks()
3763 else if (is_partition_valid(parent) && is_partition_invalid(cs)) in cpuset_hotplug_update_tasks()
3766 if (partcmd >= 0) { in cpuset_hotplug_update_tasks()
3767 update_parent_effective_cpumask(cs, partcmd, NULL, tmp); in cpuset_hotplug_update_tasks()
3768 if ((partcmd == partcmd_invalidate) || is_partition_valid(cs)) { in cpuset_hotplug_update_tasks()
3769 compute_partition_effective_cpumask(cs, &new_cpus); in cpuset_hotplug_update_tasks()
3775 cpus_updated = !cpumask_equal(&new_cpus, cs->effective_cpus); in cpuset_hotplug_update_tasks()
3776 mems_updated = !nodes_equal(new_mems, cs->effective_mems); in cpuset_hotplug_update_tasks()
3784 hotplug_update_tasks(cs, &new_cpus, &new_mems, in cpuset_hotplug_update_tasks()
3787 cpuset1_hotplug_update_tasks(cs, &new_cpus, &new_mems, in cpuset_hotplug_update_tasks()
3795 * cpuset_handle_hotplug - handle CPU/memory hot{,un}plug for a cpuset
3803 * Non-root cpusets are only affected by offlining. If any CPUs or memory
3853 top_cpuset.nr_subparts = 0; in cpuset_handle_hotplug()
3879 struct cpuset *cs; in cpuset_handle_hotplug() local
3883 cpuset_for_each_descendant_pre(cs, pos_css, &top_cpuset) { in cpuset_handle_hotplug()
3884 if (cs == &top_cpuset || !css_tryget_online(&cs->css)) in cpuset_handle_hotplug()
3888 cpuset_hotplug_update_tasks(cs, ptmp); in cpuset_handle_hotplug()
3891 css_put(&cs->css); in cpuset_handle_hotplug()
3926 * cpuset_init_smp - initialize cpus_allowed
3944 cpuset_migrate_mm_wq = alloc_ordered_workqueue("cpuset_migrate_mm", 0); in cpuset_init_smp()
3949 * cpuset_cpus_allowed - return cpus_allowed mask from a tasks cpuset.
3950 * @tsk: pointer to task_struct from which to obtain cpuset->cpus_allowed.
3954 * attached to the specified @tsk. Guaranteed to return some non-empty
3962 struct cpuset *cs; in cpuset_cpus_allowed() local
3967 cs = task_cs(tsk); in cpuset_cpus_allowed()
3968 if (cs != &top_cpuset) in cpuset_cpus_allowed()
3975 if ((cs == &top_cpuset) || cpumask_empty(pmask)) { in cpuset_cpus_allowed()
3992 * cpuset_cpus_allowed_fallback - final fallback before complete catastrophe.
3996 * tsk->cpus_allowed, we fall back to task_cs(tsk)->cpus_allowed. In legacy
3997 * mode however, this value is the same as task_cs(tsk)->effective_cpus,
4012 cs_mask = task_cs(tsk)->cpus_allowed; in cpuset_cpus_allowed_fallback()
4020 * We own tsk->cpus_allowed, nobody can change it under us. in cpuset_cpus_allowed_fallback()
4022 * But we used cs && cs->cpus_allowed lockless and thus can in cpuset_cpus_allowed_fallback()
4024 * the wrong tsk->cpus_allowed. However, both cases imply the in cpuset_cpus_allowed_fallback()
4025 * subsequent cpuset_change_cpumask()->set_cpus_allowed_ptr() in cpuset_cpus_allowed_fallback()
4029 * changes in tsk_cs()->cpus_allowed. Otherwise we can temporary in cpuset_cpus_allowed_fallback()
4041 nodes_setall(current->mems_allowed); in cpuset_init_current_mems_allowed()
4045 * cpuset_mems_allowed - return mems_allowed mask from a tasks cpuset.
4046 * @tsk: pointer to task_struct from which to obtain cpuset->mems_allowed.
4049 * attached to the specified @tsk. Guaranteed to return some non-empty
4069 * cpuset_nodemask_valid_mems_allowed - check nodemask vs. current mems_allowed
4072 * Are any of the nodes in the nodemask allowed in current->mems_allowed?
4076 return nodes_intersects(*nodemask, current->mems_allowed); in cpuset_nodemask_valid_mems_allowed()
4080 * nearest_hardwall_ancestor() - Returns the nearest mem_exclusive or
4085 static struct cpuset *nearest_hardwall_ancestor(struct cpuset *cs) in nearest_hardwall_ancestor() argument
4087 while (!(is_mem_exclusive(cs) || is_mem_hardwall(cs)) && parent_cs(cs)) in nearest_hardwall_ancestor()
4088 cs = parent_cs(cs); in nearest_hardwall_ancestor()
4089 return cs; in nearest_hardwall_ancestor()
4093 * cpuset_node_allowed - Can we allocate on a memory node?
4126 * in_interrupt - any node ok (current task context irrelevant)
4127 * GFP_ATOMIC - any node ok
4128 * tsk_is_oom_victim - any node ok
4129 * GFP_KERNEL - any node in enclosing hardwalled cpuset ok
4130 * GFP_USER - only nodes in current tasks mems allowed ok.
4134 struct cpuset *cs; /* current cpuset ancestors */ in cpuset_node_allowed() local
4140 if (node_isset(node, current->mems_allowed)) in cpuset_node_allowed()
4151 if (current->flags & PF_EXITING) /* Let dying task have memory */ in cpuset_node_allowed()
4158 cs = nearest_hardwall_ancestor(task_cs(current)); in cpuset_node_allowed()
4159 allowed = node_isset(node, cs->mems_allowed); in cpuset_node_allowed()
4167 * cpuset_spread_node() - On which node to begin search for a page
4183 * only set nodes in task->mems_allowed that are online. So it
4194 return *rotor = next_node_in(*rotor, current->mems_allowed); in cpuset_spread_node()
4198 * cpuset_mem_spread_node() - On which node to begin search for a file page
4202 if (current->cpuset_mem_spread_rotor == NUMA_NO_NODE) in cpuset_mem_spread_node()
4203 current->cpuset_mem_spread_rotor = in cpuset_mem_spread_node()
4204 node_random(&current->mems_allowed); in cpuset_mem_spread_node()
4206 return cpuset_spread_node(&current->cpuset_mem_spread_rotor); in cpuset_mem_spread_node()
4210 * cpuset_mems_allowed_intersects - Does @tsk1's mems_allowed intersect @tsk2's?
4223 return nodes_intersects(tsk1->mems_allowed, tsk2->mems_allowed); in cpuset_mems_allowed_intersects()
4227 * cpuset_print_current_mems_allowed - prints current's cpuset and mems_allowed
4238 cgrp = task_cs(current)->css.cgroup; in cpuset_print_current_mems_allowed()
4242 nodemask_pr_args(&current->mems_allowed)); in cpuset_print_current_mems_allowed()
4250 * - Print tasks cpuset path into seq_file.
4251 * - Used for /proc/<pid>/cpuset.
4252 * - No need to task_lock(tsk) on this tsk->cpuset reference, as it
4253 * doesn't really matter if tsk->cpuset changes after we read it,
4264 retval = -ENOMEM; in proc_cpuset_show()
4272 retval = cgroup_path_ns_locked(css->cgroup, buf, PATH_MAX, in proc_cpuset_show()
4273 current->nsproxy->cgroup_ns); in proc_cpuset_show()
4277 if (retval == -E2BIG) in proc_cpuset_show()
4278 retval = -ENAMETOOLONG; in proc_cpuset_show()
4279 if (retval < 0) in proc_cpuset_show()
4283 retval = 0; in proc_cpuset_show()
4295 nodemask_pr_args(&task->mems_allowed)); in cpuset_task_status_allowed()
4297 nodemask_pr_args(&task->mems_allowed)); in cpuset_task_status_allowed()