cpuset.c (27988c96687667e74df1a9a3b8662519bc1c29c9) cpuset.c (f9a25f776d780bfa3279f0b6e5f5cf3224997976)
1/*
2 * kernel/cpuset.c
3 *
4 * Processor and Memory placement constraints for sets of tasks.
5 *
6 * Copyright (C) 2003 BULL SA.
7 * Copyright (C) 2004-2007 Silicon Graphics, Inc.
8 * Copyright (C) 2006 Google, Inc

--- 31 unchanged lines hidden (view full) ---

40#include <linux/export.h>
41#include <linux/mount.h>
42#include <linux/fs_context.h>
43#include <linux/namei.h>
44#include <linux/pagemap.h>
45#include <linux/proc_fs.h>
46#include <linux/rcupdate.h>
47#include <linux/sched.h>
1/*
2 * kernel/cpuset.c
3 *
4 * Processor and Memory placement constraints for sets of tasks.
5 *
6 * Copyright (C) 2003 BULL SA.
7 * Copyright (C) 2004-2007 Silicon Graphics, Inc.
8 * Copyright (C) 2006 Google, Inc

--- 31 unchanged lines hidden (view full) ---

40#include <linux/export.h>
41#include <linux/mount.h>
42#include <linux/fs_context.h>
43#include <linux/namei.h>
44#include <linux/pagemap.h>
45#include <linux/proc_fs.h>
46#include <linux/rcupdate.h>
47#include <linux/sched.h>
48#include <linux/sched/deadline.h>
48#include <linux/sched/mm.h>
49#include <linux/sched/task.h>
50#include <linux/seq_file.h>
51#include <linux/security.h>
52#include <linux/slab.h>
53#include <linux/spinlock.h>
54#include <linux/stat.h>
55#include <linux/string.h>

--- 833 unchanged lines hidden (view full) ---

889 if (doms == NULL)
890 ndoms = 1;
891
892 *domains = doms;
893 *attributes = dattr;
894 return ndoms;
895}
896
49#include <linux/sched/mm.h>
50#include <linux/sched/task.h>
51#include <linux/seq_file.h>
52#include <linux/security.h>
53#include <linux/slab.h>
54#include <linux/spinlock.h>
55#include <linux/stat.h>
56#include <linux/string.h>

--- 833 unchanged lines hidden (view full) ---

890 if (doms == NULL)
891 ndoms = 1;
892
893 *domains = doms;
894 *attributes = dattr;
895 return ndoms;
896}
897
898static void update_tasks_root_domain(struct cpuset *cs)
899{
900 struct css_task_iter it;
901 struct task_struct *task;
902
903 css_task_iter_start(&cs->css, 0, &it);
904
905 while ((task = css_task_iter_next(&it)))
906 dl_add_task_root_domain(task);
907
908 css_task_iter_end(&it);
909}
910
911static void rebuild_root_domains(void)
912{
913 struct cpuset *cs = NULL;
914 struct cgroup_subsys_state *pos_css;
915
916 lockdep_assert_held(&cpuset_mutex);
917 lockdep_assert_cpus_held();
918 lockdep_assert_held(&sched_domains_mutex);
919
920 cgroup_enable_task_cg_lists();
921
922 rcu_read_lock();
923
924 /*
925 * Clear default root domain DL accounting, it will be computed again
926 * if a task belongs to it.
927 */
928 dl_clear_root_domain(&def_root_domain);
929
930 cpuset_for_each_descendant_pre(cs, pos_css, &top_cpuset) {
931
932 if (cpumask_empty(cs->effective_cpus)) {
933 pos_css = css_rightmost_descendant(pos_css);
934 continue;
935 }
936
937 css_get(&cs->css);
938
939 rcu_read_unlock();
940
941 update_tasks_root_domain(cs);
942
943 rcu_read_lock();
944 css_put(&cs->css);
945 }
946 rcu_read_unlock();
947}
948
949static void
950partition_and_rebuild_sched_domains(int ndoms_new, cpumask_var_t doms_new[],
951 struct sched_domain_attr *dattr_new)
952{
953 mutex_lock(&sched_domains_mutex);
954 partition_sched_domains_locked(ndoms_new, doms_new, dattr_new);
955 rebuild_root_domains();
956 mutex_unlock(&sched_domains_mutex);
957}
958
897/*
898 * Rebuild scheduler domains.
899 *
900 * If the flag 'sched_load_balance' of any cpuset with non-empty
901 * 'cpus' changes, or if the 'cpus' allowed changes in any cpuset
902 * which has that flag enabled, or if any cpuset with a non-empty
903 * 'cpus' is removed, then call this routine to rebuild the
904 * scheduler's dynamic sched domains.

--- 21 unchanged lines hidden (view full) ---

926 if (top_cpuset.nr_subparts_cpus &&
927 !cpumask_subset(top_cpuset.effective_cpus, cpu_active_mask))
928 goto out;
929
930 /* Generate domain masks and attrs */
931 ndoms = generate_sched_domains(&doms, &attr);
932
933 /* Have scheduler rebuild the domains */
959/*
960 * Rebuild scheduler domains.
961 *
962 * If the flag 'sched_load_balance' of any cpuset with non-empty
963 * 'cpus' changes, or if the 'cpus' allowed changes in any cpuset
964 * which has that flag enabled, or if any cpuset with a non-empty
965 * 'cpus' is removed, then call this routine to rebuild the
966 * scheduler's dynamic sched domains.

--- 21 unchanged lines hidden (view full) ---

988 if (top_cpuset.nr_subparts_cpus &&
989 !cpumask_subset(top_cpuset.effective_cpus, cpu_active_mask))
990 goto out;
991
992 /* Generate domain masks and attrs */
993 ndoms = generate_sched_domains(&doms, &attr);
994
995 /* Have scheduler rebuild the domains */
934 partition_sched_domains(ndoms, doms, attr);
996 partition_and_rebuild_sched_domains(ndoms, doms, attr);
935out:
936 put_online_cpus();
937}
938#else /* !CONFIG_SMP */
939static void rebuild_sched_domains_locked(void)
940{
941}
942#endif /* CONFIG_SMP */

--- 2591 unchanged lines hidden ---
997out:
998 put_online_cpus();
999}
1000#else /* !CONFIG_SMP */
1001static void rebuild_sched_domains_locked(void)
1002{
1003}
1004#endif /* CONFIG_SMP */

--- 2591 unchanged lines hidden ---