pespin has uploaded this change for review. ( 
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(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/75/30275/1

diff --git a/src/osmo-bsc/paging.c b/src/osmo-bsc/paging.c
index fa2ffb7..6d88fad 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;
        }
 }


--
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/30275
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I225d5e08427c6bb9d92ce6a1dccb6ce36053eab5
Gerrit-Change-Number: 30275
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <[email protected]>
Gerrit-MessageType: newchange

Reply via email to