Skip to content

Commit

Permalink
sched: fix stack overflow in scheduler
Browse files Browse the repository at this point in the history
  • Loading branch information
frankist authored and codebot committed Dec 19, 2024
1 parent 6c2f055 commit 3303ce1
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 8 deletions.
3 changes: 2 additions & 1 deletion lib/mac/mac_sched/uci_cell_decoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ uci_cell_decoder::uci_cell_decoder(const sched_cell_configuration_request_messag
rnti_table(rnti_table_),
cell_index(cell_cfg.cell_index),
rlf_handler(rlf_hdlr_),
logger(srslog::fetch_basic_logger("MAC"))
logger(srslog::fetch_basic_logger("MAC")),
expected_uci_report_grid(MAX_GRID_SIZE)
{
}

Expand Down
2 changes: 1 addition & 1 deletion lib/mac/mac_sched/uci_cell_decoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class uci_cell_decoder
rlf_detector& rlf_handler;
srslog::basic_logger& logger;

std::array<static_vector<uci_context, MAX_PUCCH_PDUS_PER_SLOT>, MAX_GRID_SIZE> expected_uci_report_grid;
std::vector<static_vector<uci_context, MAX_PUCCH_PDUS_PER_SLOT>> expected_uci_report_grid;
};

} // namespace srsran
4 changes: 2 additions & 2 deletions lib/scheduler/logging/scheduler_metric_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ cell_metrics_handler* scheduler_metrics_handler::add_cell(const cell_configurati
return nullptr;
}

cells.emplace(cell_cfg.cell_index, report_period, notifier, cell_cfg);
cells.emplace(cell_cfg.cell_index, std::make_unique<cell_metrics_handler>(report_period, notifier, cell_cfg));

return &cells[cell_cfg.cell_index];
return cells[cell_cfg.cell_index].get();
}
4 changes: 2 additions & 2 deletions lib/scheduler/logging/scheduler_metrics_handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,13 +192,13 @@ class scheduler_metrics_handler

cell_metrics_handler* add_cell(const cell_configuration& cell_cfg);

cell_metrics_handler& at(du_cell_index_t cell_idx) { return cells[cell_idx]; }
cell_metrics_handler& at(du_cell_index_t cell_idx) { return *cells[cell_idx]; }

private:
scheduler_metrics_notifier& notifier;
const std::chrono::milliseconds report_period;

slotted_array<cell_metrics_handler, MAX_NOF_DU_CELLS> cells;
slotted_array<std::unique_ptr<cell_metrics_handler>, MAX_NOF_DU_CELLS> cells;
};

} // namespace srsran
2 changes: 0 additions & 2 deletions lib/scheduler/scheduler_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@

#include "cell_scheduler.h"
#include "config/sched_config_manager.h"
#include "logging/scheduler_event_logger.h"
#include "logging/scheduler_metrics_handler.h"
#include "logging/scheduler_result_logger.h"
#include "ue_scheduling/ue_scheduler.h"
#include "srsran/scheduler/config/scheduler_expert_config.h"
#include "srsran/scheduler/mac_scheduler.h"
Expand Down

0 comments on commit 3303ce1

Please sign in to comment.