Remove two mallocs in the stack:

1) Extend the small buffer to 64bytes for the move_callback class.
2) Replace a std::map for a fixed size circular map in sched_time_pf.
This commit is contained in:
faluco 2021-04-20 18:28:20 +02:00 committed by faluco
parent e3b77fd82a
commit 7df308c756
3 changed files with 7 additions and 3 deletions

View File

@ -183,7 +183,7 @@ template <typename R, typename... Args, size_t Capacity, bool ForbidAlloc>
constexpr task_details::empty_table_t<R, Args...> move_callback<R(Args...), Capacity, ForbidAlloc>::empty_table;
//! Generic move task
using move_task_t = move_callback<void()>;
using move_task_t = move_callback<void(), 64>;
} // namespace srsran

View File

@ -14,6 +14,8 @@
#define SRSRAN_SCHED_TIME_PF_H
#include "sched_base.h"
#include "srsenb/hdr/common/common_enb.h"
#include "srsran/adt/circular_map.h"
#include <queue>
namespace srsenb {
@ -61,7 +63,9 @@ private:
uint32_t dl_nof_samples = 0;
uint32_t ul_nof_samples = 0;
};
std::map<uint16_t, ue_ctxt> ue_history_db;
srsran::static_circular_map<uint16_t, ue_ctxt, SRSENB_MAX_UES> ue_history_db;
struct ue_dl_prio_compare {
bool operator()(const ue_ctxt* lhs, const ue_ctxt* rhs) const;
};

View File

@ -39,7 +39,7 @@ void sched_time_pf::new_tti(sched_ue_list& ue_db, sf_sched* tti_sched)
for (auto& u : ue_db) {
auto it = ue_history_db.find(u.first);
if (it == ue_history_db.end()) {
it = ue_history_db.insert(std::make_pair(u.first, ue_ctxt{u.first, fairness_coeff})).first;
it = ue_history_db.insert(u.first, ue_ctxt{u.first, fairness_coeff}).value();
}
it->second.new_tti(*cc_cfg, *u.second, tti_sched);
if (it->second.dl_newtx_h != nullptr or it->second.dl_retx_h != nullptr) {