core: rename cgroup_queue → cgroup_realize_queue
We are about to add second cgroup-related queue, called "cgroup_empty_queue", hence let's rename "cgroup_queue" to "cgroup_realize_queue" (as that is its purpose) to minimize confusion about the two queues. Just a rename, no functional changes.
This commit is contained in:
parent
6d330fef4d
commit
91a6073ef7
|
@ -1496,9 +1496,9 @@ static int unit_realize_cgroup_now(Unit *u, ManagerState state) {
|
||||||
|
|
||||||
assert(u);
|
assert(u);
|
||||||
|
|
||||||
if (u->in_cgroup_queue) {
|
if (u->in_cgroup_realize_queue) {
|
||||||
LIST_REMOVE(cgroup_queue, u->manager->cgroup_queue, u);
|
LIST_REMOVE(cgroup_realize_queue, u->manager->cgroup_realize_queue, u);
|
||||||
u->in_cgroup_queue = false;
|
u->in_cgroup_realize_queue = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
target_mask = unit_get_target_mask(u);
|
target_mask = unit_get_target_mask(u);
|
||||||
|
@ -1532,26 +1532,28 @@ static int unit_realize_cgroup_now(Unit *u, ManagerState state) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void unit_add_to_cgroup_queue(Unit *u) {
|
static void unit_add_to_cgroup_realize_queue(Unit *u) {
|
||||||
assert(u);
|
assert(u);
|
||||||
|
|
||||||
if (u->in_cgroup_queue)
|
if (u->in_cgroup_realize_queue)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
LIST_PREPEND(cgroup_queue, u->manager->cgroup_queue, u);
|
LIST_PREPEND(cgroup_realize_queue, u->manager->cgroup_realize_queue, u);
|
||||||
u->in_cgroup_queue = true;
|
u->in_cgroup_realize_queue = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned manager_dispatch_cgroup_queue(Manager *m) {
|
unsigned manager_dispatch_cgroup_realize_queue(Manager *m) {
|
||||||
ManagerState state;
|
ManagerState state;
|
||||||
unsigned n = 0;
|
unsigned n = 0;
|
||||||
Unit *i;
|
Unit *i;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
|
assert(m);
|
||||||
|
|
||||||
state = manager_state(m);
|
state = manager_state(m);
|
||||||
|
|
||||||
while ((i = m->cgroup_queue)) {
|
while ((i = m->cgroup_realize_queue)) {
|
||||||
assert(i->in_cgroup_queue);
|
assert(i->in_cgroup_realize_queue);
|
||||||
|
|
||||||
r = unit_realize_cgroup_now(i, state);
|
r = unit_realize_cgroup_now(i, state);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
|
@ -1563,7 +1565,7 @@ unsigned manager_dispatch_cgroup_queue(Manager *m) {
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void unit_queue_siblings(Unit *u) {
|
static void unit_add_siblings_to_cgroup_realize_queue(Unit *u) {
|
||||||
Unit *slice;
|
Unit *slice;
|
||||||
|
|
||||||
/* This adds the siblings of the specified unit and the
|
/* This adds the siblings of the specified unit and the
|
||||||
|
@ -1597,7 +1599,7 @@ static void unit_queue_siblings(Unit *u) {
|
||||||
unit_get_needs_bpf(m)))
|
unit_get_needs_bpf(m)))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
unit_add_to_cgroup_queue(m);
|
unit_add_to_cgroup_realize_queue(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
u = slice;
|
u = slice;
|
||||||
|
@ -1622,7 +1624,7 @@ int unit_realize_cgroup(Unit *u) {
|
||||||
* iteration. */
|
* iteration. */
|
||||||
|
|
||||||
/* Add all sibling slices to the cgroup queue. */
|
/* Add all sibling slices to the cgroup queue. */
|
||||||
unit_queue_siblings(u);
|
unit_add_siblings_to_cgroup_realize_queue(u);
|
||||||
|
|
||||||
/* And realize this one now (and apply the values) */
|
/* And realize this one now (and apply the values) */
|
||||||
return unit_realize_cgroup_now(u, manager_state(u->manager));
|
return unit_realize_cgroup_now(u, manager_state(u->manager));
|
||||||
|
@ -2329,7 +2331,7 @@ void unit_invalidate_cgroup(Unit *u, CGroupMask m) {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
u->cgroup_realized_mask &= ~m;
|
u->cgroup_realized_mask &= ~m;
|
||||||
unit_add_to_cgroup_queue(u);
|
unit_add_to_cgroup_realize_queue(u);
|
||||||
}
|
}
|
||||||
|
|
||||||
void unit_invalidate_cgroup_bpf(Unit *u) {
|
void unit_invalidate_cgroup_bpf(Unit *u) {
|
||||||
|
@ -2342,7 +2344,7 @@ void unit_invalidate_cgroup_bpf(Unit *u) {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
u->cgroup_bpf_state = UNIT_CGROUP_BPF_INVALIDATED;
|
u->cgroup_bpf_state = UNIT_CGROUP_BPF_INVALIDATED;
|
||||||
unit_add_to_cgroup_queue(u);
|
unit_add_to_cgroup_realize_queue(u);
|
||||||
|
|
||||||
/* If we are a slice unit, we also need to put compile a new BPF program for all our children, as the IP access
|
/* If we are a slice unit, we also need to put compile a new BPF program for all our children, as the IP access
|
||||||
* list of our children includes our own. */
|
* list of our children includes our own. */
|
||||||
|
|
|
@ -177,7 +177,7 @@ int unit_attach_pids_to_cgroup(Unit *u);
|
||||||
int manager_setup_cgroup(Manager *m);
|
int manager_setup_cgroup(Manager *m);
|
||||||
void manager_shutdown_cgroup(Manager *m, bool delete);
|
void manager_shutdown_cgroup(Manager *m, bool delete);
|
||||||
|
|
||||||
unsigned manager_dispatch_cgroup_queue(Manager *m);
|
unsigned manager_dispatch_cgroup_realize_queue(Manager *m);
|
||||||
|
|
||||||
Unit *manager_get_unit_by_cgroup(Manager *m, const char *cgroup);
|
Unit *manager_get_unit_by_cgroup(Manager *m, const char *cgroup);
|
||||||
Unit *manager_get_unit_by_pid_cgroup(Manager *m, pid_t pid);
|
Unit *manager_get_unit_by_pid_cgroup(Manager *m, pid_t pid);
|
||||||
|
|
|
@ -2367,7 +2367,7 @@ int manager_loop(Manager *m) {
|
||||||
if (manager_dispatch_cleanup_queue(m) > 0)
|
if (manager_dispatch_cleanup_queue(m) > 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (manager_dispatch_cgroup_queue(m) > 0)
|
if (manager_dispatch_cgroup_realize_queue(m) > 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (manager_dispatch_dbus_queue(m) > 0)
|
if (manager_dispatch_dbus_queue(m) > 0)
|
||||||
|
|
|
@ -119,7 +119,7 @@ struct Manager {
|
||||||
LIST_HEAD(Job, gc_job_queue);
|
LIST_HEAD(Job, gc_job_queue);
|
||||||
|
|
||||||
/* Units that should be realized */
|
/* Units that should be realized */
|
||||||
LIST_HEAD(Unit, cgroup_queue);
|
LIST_HEAD(Unit, cgroup_realize_queue);
|
||||||
|
|
||||||
sd_event *event;
|
sd_event *event;
|
||||||
|
|
||||||
|
|
|
@ -588,8 +588,8 @@ void unit_free(Unit *u) {
|
||||||
if (u->in_gc_queue)
|
if (u->in_gc_queue)
|
||||||
LIST_REMOVE(gc_queue, u->manager->gc_unit_queue, u);
|
LIST_REMOVE(gc_queue, u->manager->gc_unit_queue, u);
|
||||||
|
|
||||||
if (u->in_cgroup_queue)
|
if (u->in_cgroup_realize_queue)
|
||||||
LIST_REMOVE(cgroup_queue, u->manager->cgroup_queue, u);
|
LIST_REMOVE(cgroup_realize_queue, u->manager->cgroup_realize_queue, u);
|
||||||
|
|
||||||
unit_release_cgroup(u);
|
unit_release_cgroup(u);
|
||||||
|
|
||||||
|
|
|
@ -166,7 +166,7 @@ struct Unit {
|
||||||
LIST_FIELDS(Unit, gc_queue);
|
LIST_FIELDS(Unit, gc_queue);
|
||||||
|
|
||||||
/* CGroup realize members queue */
|
/* CGroup realize members queue */
|
||||||
LIST_FIELDS(Unit, cgroup_queue);
|
LIST_FIELDS(Unit, cgroup_realize_queue);
|
||||||
|
|
||||||
/* PIDs we keep an eye on. Note that a unit might have many
|
/* PIDs we keep an eye on. Note that a unit might have many
|
||||||
* more, but these are the ones we care enough about to
|
* more, but these are the ones we care enough about to
|
||||||
|
@ -263,7 +263,7 @@ struct Unit {
|
||||||
bool in_dbus_queue:1;
|
bool in_dbus_queue:1;
|
||||||
bool in_cleanup_queue:1;
|
bool in_cleanup_queue:1;
|
||||||
bool in_gc_queue:1;
|
bool in_gc_queue:1;
|
||||||
bool in_cgroup_queue:1;
|
bool in_cgroup_realize_queue:1;
|
||||||
|
|
||||||
bool sent_dbus_new_signal:1;
|
bool sent_dbus_new_signal:1;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue