mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
cgroup: Merge branch 'for-7.3-fixes' into for-7.4
Pull to receive 1765a153d9 ("cgroup/pids: Restore pids.events
notifications in local mode") for the pids.events notification
selftest.
Signed-off-by: Tejun Heo <tj@kernel.org>
This commit is contained in:
commit
c2dfb2aea8
|
|
@ -5317,10 +5317,13 @@ struct task_struct *css_task_iter_next(struct css_task_iter *it)
|
|||
if (it->flags & CSS_TASK_ITER_SKIPPED)
|
||||
css_task_iter_advance(it);
|
||||
|
||||
if (it->task_pos) {
|
||||
while (it->task_pos && !it->cur_task) {
|
||||
it->cur_task = list_entry(it->task_pos, struct task_struct,
|
||||
cg_list);
|
||||
get_task_struct(it->cur_task);
|
||||
/* a task on dying_tasks with zero refcount is only valid for
|
||||
* RCU readers, not even interesting for
|
||||
* CSS_TASK_ITER_WITH_DEAD, find another one */
|
||||
it->cur_task = tryget_task_struct(it->cur_task);
|
||||
css_task_iter_advance(it);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -152,6 +152,12 @@ static cpumask_var_t isolated_cpus; /* CSCB */
|
|||
*/
|
||||
static bool update_housekeeping; /* RWCS */
|
||||
|
||||
/*
|
||||
* Set if "cpuset_v2_mode" mount option is used
|
||||
* Cached at bind time and not lock protected; accessed via {READ,WRITE}_ONCE
|
||||
*/
|
||||
static bool cpuset_v2_mode;
|
||||
|
||||
/*
|
||||
* Copy of isolated_cpus to be passed to housekeeping_update()
|
||||
*/
|
||||
|
|
@ -438,8 +444,7 @@ static inline bool cpuset_v2(void)
|
|||
*/
|
||||
static inline bool is_in_v2_mode(void)
|
||||
{
|
||||
return cpuset_v2() ||
|
||||
(cpuset_cgrp_subsys.root->flags & CGRP_ROOT_CPUSET_V2_MODE);
|
||||
return cpuset_v2() || READ_ONCE(cpuset_v2_mode);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -512,10 +517,26 @@ static void guarantee_active_cpus(struct task_struct *tsk,
|
|||
rcu_read_lock();
|
||||
cs = task_cs(tsk);
|
||||
|
||||
while (!cpumask_intersects(cs->effective_cpus, pmask))
|
||||
while (!cpumask_intersects(cs->effective_cpus, pmask)) {
|
||||
cs = parent_cs(cs);
|
||||
|
||||
if (unlikely(!cs)) {
|
||||
/*
|
||||
* The top cpuset doesn't have any active cpu as a
|
||||
* consequence of a race between its caller and the cpu
|
||||
* hotplug operation where cpu_active_mask is updated
|
||||
* asynchronously before cpuset_handle_hotplug() is
|
||||
* being called to adjust the effective_cpus of the
|
||||
* affected cpusets. But we know the top cpuset's
|
||||
* effective_cpus is on its way to be identical to
|
||||
* cpu_active_mask minus the exclusive CPUs dedicated
|
||||
* to other valid cpuset partitions. Just pass back
|
||||
* the filtered cpu_active_mask in this case.
|
||||
*/
|
||||
goto out_unlock;
|
||||
}
|
||||
}
|
||||
cpumask_and(pmask, pmask, cs->effective_cpus);
|
||||
out_unlock:
|
||||
rcu_read_unlock();
|
||||
}
|
||||
|
||||
|
|
@ -1567,10 +1588,11 @@ static int remote_partition_enable(struct cpuset *cs, int new_prs,
|
|||
* above it or remote partition root underneath it is not allowed.
|
||||
*/
|
||||
compute_excpus(cs, tmp->new_cpus);
|
||||
WARN_ON_ONCE(cpumask_intersects(tmp->new_cpus, subpartitions_cpus));
|
||||
if (!cpumask_intersects(tmp->new_cpus, cpu_active_mask) ||
|
||||
cpumask_subset(top_cpuset.effective_cpus, tmp->new_cpus))
|
||||
return PERR_INVCPUS;
|
||||
if (cpumask_intersects(tmp->new_cpus, subpartitions_cpus))
|
||||
return PERR_NOCPUS;
|
||||
if (((new_prs == PRS_ISOLATED) &&
|
||||
!isolated_cpus_can_update(tmp->new_cpus, NULL)) ||
|
||||
prstate_housekeeping_conflict(new_prs, tmp->new_cpus))
|
||||
|
|
@ -3618,6 +3640,8 @@ static void cpuset_bind(struct cgroup_subsys_state *root_css)
|
|||
mutex_lock(&cpuset_mutex);
|
||||
spin_lock_irq(&callback_lock);
|
||||
|
||||
WRITE_ONCE(cpuset_v2_mode,
|
||||
!!(cpuset_cgrp_subsys.root->flags & CGRP_ROOT_CPUSET_V2_MODE));
|
||||
if (is_in_v2_mode()) {
|
||||
cpumask_copy(top_cpuset.cpus_allowed, cpu_possible_mask);
|
||||
cpumask_copy(top_cpuset.effective_xcpus, cpu_possible_mask);
|
||||
|
|
@ -3930,15 +3954,16 @@ static void cpuset_handle_hotplug(void)
|
|||
static cpumask_t new_cpus;
|
||||
static nodemask_t new_mems;
|
||||
bool cpus_updated, mems_updated;
|
||||
bool on_dfl = is_in_v2_mode();
|
||||
bool on_dfl;
|
||||
struct tmpmasks tmp, *ptmp = NULL;
|
||||
|
||||
if (on_dfl && !alloc_tmpmasks(&tmp))
|
||||
ptmp = &tmp;
|
||||
|
||||
lockdep_assert_cpus_held();
|
||||
mutex_lock(&cpuset_mutex);
|
||||
|
||||
on_dfl = is_in_v2_mode();
|
||||
if (on_dfl && !alloc_tmpmasks(&tmp))
|
||||
ptmp = &tmp;
|
||||
|
||||
/* fetch the available cpus/mems and find out which changed how */
|
||||
cpumask_copy(&new_cpus, cpu_active_mask);
|
||||
new_mems = node_states[N_MEMORY];
|
||||
|
|
|
|||
|
|
@ -253,6 +253,11 @@ static void pids_event(struct pids_cgroup *pids_forking,
|
|||
}
|
||||
if (!cgroup_subsys_on_dfl(pids_cgrp_subsys) ||
|
||||
cgrp_dfl_root.flags & CGRP_ROOT_PIDS_LOCAL_EVENTS) {
|
||||
/*
|
||||
* pids.events reports the local counter on legacy hierarchies
|
||||
* and when pids_localevents is enabled.
|
||||
*/
|
||||
cgroup_file_notify(&p->events_file);
|
||||
cgroup_file_notify(&p->events_local_file);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -298,6 +298,8 @@ TEST_MATRIX=(
|
|||
" C0-4:X2-4 C1-4:X2-4:P2 C2-4:X4:P1 \
|
||||
. . . X1 . 0 A1:0-1|A2:2-4|A3:2-4 \
|
||||
A1:P0|A2:P2|A3:P-1 2-4"
|
||||
" CX1-3:P1 CX1-3 CX1-3 . . . P1 . 0 A1:1-3|A2:1-3|A3:1-3 \
|
||||
A1:P1|A2:P0|A3:P-1"
|
||||
|
||||
# Remote partition offline tests
|
||||
" C0-3 C1-3 C2-3 . X2-3 X2-3 X2-3:P2:O2=0 . 0 A1:0-1|A2:1|A3:3 A1:P0|A3:P2 2-3"
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ static int page_size;
|
|||
|
||||
int get_temp_fd(void)
|
||||
{
|
||||
return open(".", O_TMPFILE | O_RDWR | O_EXCL);
|
||||
return open(".", O_TMPFILE | O_RDWR | O_EXCL, 0600);
|
||||
}
|
||||
|
||||
int alloc_pagecache(int fd, size_t size)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user