aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2022-11-22 16:15:15 +0100
committerPau Espin Pedrol <pespin@sysmocom.de>2022-11-22 19:55:46 +0100
commit27cb5d3e24d0e39d09bddcbea5c059dfe5bbcf3d (patch)
tree53ec030f2e6e48ab1f8ee8b9b0891404c857a312
parentccba3a9e4f34c894020ca26149de4645c1573bf6 (diff)
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
-rw-r--r--src/osmo-bsc/paging.c28
1 files changed, 18 insertions, 10 deletions
diff --git a/src/osmo-bsc/paging.c b/src/osmo-bsc/paging.c
index b73578e37..3909a7f9a 100644
--- a/src/osmo-bsc/paging.c
+++ b/src/osmo-bsc/paging.c
@@ -577,20 +577,28 @@ void paging_request_stop(struct bsc_msc_data **msc_p, enum bsc_paging_reason *re
/* 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;
}
}