|
12 | 12 |
|
13 | 13 | using namespace srsran; |
14 | 14 |
|
| 15 | +// [Implementation-defined] Limit for the coefficient of the proportional fair metric to avoid issues with double |
| 16 | +// imprecision. |
| 17 | +constexpr unsigned MAX_PF_COEFF = 10; |
| 18 | + |
15 | 19 | scheduler_time_pf::scheduler_time_pf(const scheduler_ue_expert_config& expert_cfg_) : |
16 | 20 | fairness_coeff(std::get<time_pf_scheduler_expert_config>(expert_cfg_.strategy_cfg).pf_sched_fairness_coeff) |
17 | 21 | { |
@@ -371,14 +375,16 @@ void scheduler_time_pf::ue_ctxt::compute_dl_prio(const slice_ue& u, |
371 | 375 | const double current_total_avg_rate = total_dl_avg_rate(); |
372 | 376 | double pf_weight = 0; |
373 | 377 | if (current_total_avg_rate != 0) { |
374 | | - if (parent->fairness_coeff >= 10) { |
375 | | - // avoid overflow |
| 378 | + if (parent->fairness_coeff >= MAX_PF_COEFF) { |
| 379 | + // For very high coefficients, the pow(.) will be very high, leading to pf_weight of 0 due to lack of precision. |
| 380 | + // In such scenarios, we change the way to compute the PF weight. Instead, we completely disregard the estimated |
| 381 | + // rate, as its impact is minimal. |
376 | 382 | pf_weight = 1 / current_total_avg_rate; |
377 | 383 | } else { |
378 | 384 | pf_weight = estimated_rate / pow(current_total_avg_rate, parent->fairness_coeff); |
379 | 385 | } |
380 | 386 | } else { |
381 | | - // give the highest priority to new UE. |
| 387 | + // Give the highest priority to new UE. |
382 | 388 | pf_weight = estimated_rate == 0 ? 0 : std::numeric_limits<double>::max(); |
383 | 389 | } |
384 | 390 | const double rate_weight = compute_dl_rate_weight( |
@@ -463,8 +469,10 @@ void scheduler_time_pf::ue_ctxt::compute_ul_prio(const slice_ue& u, |
463 | 469 | const double current_avg_rate = total_ul_avg_rate(); |
464 | 470 | double pf_weight = 0; |
465 | 471 | if (current_avg_rate != 0) { |
466 | | - if (parent->fairness_coeff > 10) { |
467 | | - // avoid overflow |
| 472 | + if (parent->fairness_coeff >= MAX_PF_COEFF) { |
| 473 | + // For very high coefficients, the pow(.) will be very high, leading to pf_weight of 0 due to lack of precision. |
| 474 | + // In such scenarios, we change the way to compute the PF weight. Instead, we completely disregard the estimated |
| 475 | + // rate, as its impact is minimal. |
468 | 476 | pf_weight = 1 / current_avg_rate; |
469 | 477 | } else { |
470 | 478 | pf_weight = estimated_rate / pow(current_avg_rate, parent->fairness_coeff); |
|
0 commit comments