pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/30275 )
Change subject: paging: Use bsub->active_paging_requests to optimize cancelling based on reason ......................................................................
paging: Use bsub->active_paging_requests to optimize cancelling based on reason
Prior to this patch the whole paging queue of each BTS was iterated. After the patch only the active paging_req for a given subscriber are iterated.
Related: SYS#6200 Change-Id: I225d5e08427c6bb9d92ce6a1dccb6ce36053eab5 --- M src/osmo-bsc/paging.c 1 file changed, 18 insertions(+), 10 deletions(-)
Approvals: fixeria: Looks good to me, approved laforge: Looks good to me, but someone else must approve Jenkins Builder: Verified
diff --git a/src/osmo-bsc/paging.c b/src/osmo-bsc/paging.c index b73578e..3909a7f 100644 --- a/src/osmo-bsc/paging.c +++ b/src/osmo-bsc/paging.c @@ -577,20 +577,28 @@ /* Remove all paging requests, for specific reasons only. */ void paging_request_cancel(struct bsc_subscr *bsub, enum bsc_paging_reason reasons) { - struct gsm_bts *bts; + struct gsm_paging_request *req, *req2; OSMO_ASSERT(bsub);
- llist_for_each_entry(bts, &bsc_gsmnet->bts_list, list) { - struct gsm_paging_request *req, *req2; + /* Avoid accessing bsub after reaching 0 active_paging_request_len, + * since it could be freed during put(): */ + unsigned remaining = bsub->active_paging_requests_len;
- llist_for_each_entry_safe(req, req2, &bts->paging.pending_requests, entry) { - if (req->bsub != bsub) - continue; - if (!(req->reason & reasons)) - continue; - LOG_PAGING_BTS(req, bts, DPAG, LOGL_DEBUG, "Cancel paging\n"); - paging_remove_request(&bts->paging, req); + llist_for_each_entry_safe(req, req2, &bsub->active_paging_requests, bsub_entry) { + if (!(req->reason & reasons)) + continue; + LOG_PAGING_BTS(req, req->bts, DPAG, LOGL_DEBUG, "Cancel paging reasons=0x%x\n", + reasons); + if (req->reason & ~reasons) { + /* Other reasons are active, simply drop the reasons from func arg: */ + req->reason &= ~reasons; + continue; } + /* No reason to keep the paging, remove it: */ + paging_remove_request(&req->bts->paging, req); + remaining--; + if (remaining == 0) + break; } }