Skip to content

Commit

Permalink
process: Expose current cpu_set the process is running on
Browse files Browse the repository at this point in the history
  • Loading branch information
MatejKafka committed Jul 23, 2021
1 parent bb4152a commit c2675e5
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/partition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ void Partition::reset(bool move_to_first_proc,

clear_completed_flag();
cgc.set_cpus(cpus);
current_cpus = cpus;
_completed_cb = process_completion_cb;
// for BE partition, we don't want to reset to first process
if (move_to_first_proc) {
Expand Down
2 changes: 2 additions & 0 deletions src/partition.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ class Partition
// Note: `processes` MUST be located after all cgroups (cgc, cgf, cge) - Process destructors
// must run before the cgroup destructors to cleanup child cgroups in correct order
Processes processes{};
/** Current cpu_set the partition is running under. */
cpu_set current_cpus{};

public:
Partition(Cgroup &freezer_parent,
Expand Down
10 changes: 5 additions & 5 deletions src/process.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ Process::Process(ev::loop_ref loop,
std::optional<unsigned int> a53_freq,
std::optional<unsigned int> a72_freq,
bool has_initialization)
: a53_freq_i{a53_freq}
, a72_freq_i{a72_freq}
// budget +- (jitter / 2)
, jitter_distribution_ms(-budget_jitter.count() / 2, budget_jitter.count() - budget_jitter.count() / 2)
: part(partition)
, a53_freq_i{ a53_freq }
, a72_freq_i{ a72_freq } // budget +- (jitter / 2)
, jitter_distribution_ms(-budget_jitter.count() / 2,
budget_jitter.count() - budget_jitter.count() / 2)
, loop(loop)
, efd_continue(CHECK(eventfd(0, EFD_SEMAPHORE)))
, part(partition)
, cge(loop,
partition.cge,
name,
Expand Down
2 changes: 1 addition & 1 deletion src/process.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ class Process
void mark_completed();
void mark_uncompleted();

Partition &part;
const std::optional<unsigned int> a53_freq_i;
const std::optional<unsigned int> a72_freq_i;

Expand All @@ -89,7 +90,6 @@ class Process
ev::child child_w{ loop };
int efd_continue; // new period eventfd

Partition &part;
CgroupEvents cge;
CgroupFreezer cgf;

Expand Down

0 comments on commit c2675e5

Please sign in to comment.