paging: Avoid unnecessary immediate polling in mainloop

We have seen an increased CPU load in osmo-bsc recently since the paging
improvements where merged, centered round poll() calls.
It is expected most of them will be fixed with previous patch. In any
case, let's avoid unnecessary poll() calls being called for no reason.

Related: OS#5922
Change-Id: Ie767bdc8d4353aafe375a424e02d698ef7fd3dea
This commit is contained in:
Pau Espin 2022-05-05 18:31:22 +02:00 committed by pespin
parent cdd2bbd8b8
commit 5a2347d4bc
1 changed files with 5 additions and 1 deletions

View File

@ -469,7 +469,11 @@ static int _paging_request(const struct bsc_paging_params *params, struct gsm_bt
LOG_PAGING_BTS(req, req->bts, DPAG, LOGL_DEBUG,
"New req arrived: re-scheduling next batch in %lld.%06lds\n",
(long long)tdiff.tv_sec, tdiff.tv_nsec / 1000);
osmo_timer_schedule(&bts_entry->work_timer, tdiff.tv_sec, tdiff.tv_nsec / 1000);
/* Avoid scheduling timer for short periods, run cb directly: */
if (tdiff.tv_sec == 0 && tdiff.tv_nsec < 5000)
paging_worker(bts_entry);
else
osmo_timer_schedule(&bts_entry->work_timer, tdiff.tv_sec, tdiff.tv_nsec / 1000);
} /* else: worker is already ongoing submitting initial requests, nothing do be done */
return 0;