Skip to content

Commit

Permalink
Merge 'resource: move variable into smaller lexical scope' from Kefu …
Browse files Browse the repository at this point in the history
…Chai

this series includes two cleanups

- resource: use structured binding when appropriate
- resource: move variable into smaller lexical scope

Closes scylladb#1880

* https://github.com/scylladb/seastar:
  resource: move variable into smaller lexical scope
  resource: use structured binding when appropriate
  • Loading branch information
xemul committed Oct 19, 2023
2 parents e3fce16 + 3345846 commit 27d29ce
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/core/resource.cc
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,6 @@ resources allocate(configuration& c) {
std::vector<unsigned> orphan_pus;
std::unordered_map<hwloc_obj_t, size_t> topo_used_mem;
std::vector<std::pair<cpu, size_t>> remains;
size_t remain;

auto cpu_sets = distribute_objects(topology, procs);

Expand Down Expand Up @@ -662,17 +661,14 @@ resources allocate(configuration& c) {
auto node = cpu_to_node.at(cpu_id);
cpu this_cpu;
this_cpu.cpu_id = cpu_id;
remain = mem_per_proc - alloc_from_node(this_cpu, node, topo_used_mem, mem_per_proc);
size_t remain = mem_per_proc - alloc_from_node(this_cpu, node, topo_used_mem, mem_per_proc);

remains.emplace_back(std::move(this_cpu), remain);
}

// Divide the rest of the memory
auto depth = hwloc_get_type_or_above_depth(topology, HWLOC_OBJ_NUMANODE);
for (auto&& r : remains) {
cpu this_cpu;
size_t remain;
std::tie(this_cpu, remain) = r;
for (auto&& [this_cpu, remain] : remains) {
auto node = cpu_to_node.at(this_cpu.cpu_id);
auto obj = node;

Expand Down

0 comments on commit 27d29ce

Please sign in to comment.