pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/30267 )
Change subject: paging: Use bsub->active_paging_requests to allow early loop termination adding paging_req
......................................................................
paging: Use bsub->active_paging_requests to allow early loop termination adding paging_req
Before this patch, the entire queue of paging_request had to be iterated
in order to find if the subscriber already had an active paging request
(discarding duplicates).
Now that bsc_subscriber holds a list of its active paging requests, it's
easier to look at its list to find out if it is already active on that
BTS.
As a result, there's no need to unconditionally iterate the whole list
and we can optimize the loop finding the spot to insert the new queue:
- First the potentially way smaller loop over
bsub->active_paging_requests is done
- Second, only if the first loop allowed, the bts->pending_requests is
iterated and potentially early terminated.
Related: SYS#6200
Change-Id: I7912275026c4d4983269c8870aa5565c93277c5a
---
M src/osmo-bsc/paging.c
1 file changed, 28 insertions(+), 17 deletions(-)
Approvals:
fixeria: Looks good to me, but someone else must approve
pespin: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/src/osmo-bsc/paging.c b/src/osmo-bsc/paging.c
index 2a18419..e1290f5 100644
--- a/src/osmo-bsc/paging.c
+++ b/src/osmo-bsc/paging.c
@@ -415,31 +415,42 @@
return -ENOSPC;
}
- /* Iterate list of pending requests to find if we already have one for
- * the given subscriber. While on it, find the last
- * not-yet-ever-once-transmitted request; the new request will be added
- * immediately after it, giving higher prio to initial transmissions
- * (no retrans). This avoids new subscribers being paged to be delayed
- * if the paging queue is full due to a lot of retranmissions.
+ /* Find if we already have one for the given subscriber on this BTS: */
+ if (bsc_subscr_find_req_by_bts(params->bsub, bts)) {
+ LOG_PAGING_BTS(params, bts, DPAG, LOGL_INFO, "Paging request already pending for this subscriber\n");
+ rate_ctr_inc(rate_ctr_group_get_ctr(bts->bts_ctrs, BTS_CTR_PAGING_ALREADY));
+ return -EEXIST;
+ }
+
+ /* Find the last not-yet-ever-once-transmitted request; the new request
+ * will be added immediately after it, giving higher prio to initial
+ * transmissions (no retrans). This avoids new subscribers being paged to
+ * be delayed if the paging queue is full due to a lot of retranmissions.
* Retranmissions usually mean MS are not reachable/available, so the
- * rationale here is to prioritize new subs which may be available. */
+ * rationale here is to prioritize new subs which may be available.
+ */
llist_for_each_entry(req, &bts_entry->pending_requests, entry) {
- if (params->bsub == req->bsub) {
- LOG_PAGING_BTS(params, bts, DPAG, LOGL_INFO, "Paging request already pending for this subscriber\n");
- rate_ctr_inc(rate_ctr_group_get_ctr(bts->bts_ctrs, BTS_CTR_PAGING_ALREADY));
- return -EEXIST;
- }
if (req->attempts == 0) {
+ /* Keep counting no-retransmits (general and per same pgroup): */
last_initial_req = req;
reqs_before++;
if (req->pgroup == pgroup)
reqs_before_same_pgroup++;
- } else if (last_initial_req == NULL) {
- /* If no req with attempts=0 was found, we'll append to end of list, so keep counting. */
- reqs_before++;
- if (req->pgroup == pgroup)
- reqs_before_same_pgroup++;
+ continue;
}
+ /* Here first retransmit in queue is reached: */
+ if (last_initial_req) {
+ /* There were no-retransmit in the queue, done
+ * iterating, new req will be inserted here
+ * (see below the current loop). */
+ break;
+ }
+
+ /* last_initial_req == NULL: No req with attempts=0 was found,
+ * we'll append to end of list, so keep counting. */
+ reqs_before++;
+ if (req->pgroup == pgroup)
+ reqs_before_same_pgroup++;
}
LOG_PAGING_BTS(params, bts, DPAG, LOGL_DEBUG, "Start paging\n");
--
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/30267
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I7912275026c4d4983269c8870aa5565c93277c5a
Gerrit-Change-Number: 30267
Gerrit-PatchSet: 4
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/30274 )
Change subject: lcs: Fix passing NULL bsc_subscr to paging_request_cancel()
......................................................................
lcs: Fix passing NULL bsc_subscr to paging_request_cancel()
This is triggered by BSC_Tests.TC_lcs_loc_req_no_subscriber.
Before, the NULL ptr was not a problem because paging_request_cancel()
only used the pointer to compare it against other pointers, but never
accessing it. A follow-up patch is, however, changing the implementation
to optimize the lookup by using the subscriber pointer, which generates
a crash.
Related: SYS#6200
Change-Id: Id0de43ac5bde0f52f258de6c9bf58b173301c8db
---
M src/osmo-bsc/lcs_loc_req.c
M src/osmo-bsc/paging.c
2 files changed, 3 insertions(+), 1 deletion(-)
Approvals:
Jenkins Builder: Verified
laforge: Looks good to me, but someone else must approve
fixeria: Looks good to me, approved
diff --git a/src/osmo-bsc/lcs_loc_req.c b/src/osmo-bsc/lcs_loc_req.c
index d53f2ab..bb0c5e2 100644
--- a/src/osmo-bsc/lcs_loc_req.c
+++ b/src/osmo-bsc/lcs_loc_req.c
@@ -514,7 +514,8 @@
};
/* If we're paging this subscriber for LCS, stop paging. */
- paging_request_cancel(lcs_loc_req->conn->bsub, BSC_PAGING_FOR_LCS);
+ if (lcs_loc_req->conn->bsub)
+ paging_request_cancel(lcs_loc_req->conn->bsub, BSC_PAGING_FOR_LCS);
/* Send Perform Location Abort to SMLC, only if we got started on the Lb */
if (lcs_loc_req->conn->lcs.lb.state == SUBSCR_SCCP_ST_CONNECTED)
diff --git a/src/osmo-bsc/paging.c b/src/osmo-bsc/paging.c
index e1290f5..b73578e 100644
--- a/src/osmo-bsc/paging.c
+++ b/src/osmo-bsc/paging.c
@@ -578,6 +578,7 @@
void paging_request_cancel(struct bsc_subscr *bsub, enum bsc_paging_reason reasons)
{
struct gsm_bts *bts;
+ OSMO_ASSERT(bsub);
llist_for_each_entry(bts, &bsc_gsmnet->bts_list, list) {
struct gsm_paging_request *req, *req2;
1 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
--
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/30274
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: Id0de43ac5bde0f52f258de6c9bf58b173301c8db
Gerrit-Change-Number: 30274
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged
Attention is currently required from: pespin.
fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/30277 )
Change subject: paging: Introduce BTS stat paging:request_queue_length
......................................................................
Patch Set 2: Code-Review+2
(2 comments)
File src/osmo-bsc/paging.c:
https://gerrit.osmocom.org/c/osmo-bsc/+/30277/comment/981d132a_5bed2b24
PS1, Line 92: to_be_deleted->bts
> Because "paging_bts" is not a gsm_bts, but a struct gsm_bts_paging_state, so it would be paging_bts- […]
Hmm, the naming could have been cleaner. Nevermind then.
https://gerrit.osmocom.org/c/osmo-bsc/+/30277/comment/90e1c73b_8fc4dae6
PS1, Line 470: bts
> Same, bts_entry is struct gsm_bts_paging_state, which is basically "bts->paging".
Ack
--
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/30277
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I6d296cdeba1392ef95fc31f6c04210c73f1b23e5
Gerrit-Change-Number: 30277
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Tue, 22 Nov 2022 19:05:56 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: pespin <pespin(a)sysmocom.de>
Comment-In-Reply-To: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-MessageType: comment
Attention is currently required from: pespin.
fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/30275 )
Change subject: paging: Use bsub->active_paging_requests to optimize cancelling based on reason
......................................................................
Patch Set 2: Code-Review+2
(1 comment)
File src/osmo-bsc/paging.c:
https://gerrit.osmocom.org/c/osmo-bsc/+/30275/comment/06d444bd_b877969e
PS1, Line 584: it could be freed during put():
> See my answers in previous patches. […]
Ack
--
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: 2
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Tue, 22 Nov 2022 19:03:53 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: pespin <pespin(a)sysmocom.de>
Comment-In-Reply-To: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-MessageType: comment
Attention is currently required from: pespin.
fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/30267 )
Change subject: paging: Use bsub->active_paging_requests to allow early loop termination adding paging_req
......................................................................
Patch Set 4: Code-Review+1
(1 comment)
File src/osmo-bsc/paging.c:
https://gerrit.osmocom.org/c/osmo-bsc/+/30267/comment/0f8c1b23_7f3a69d3
PS3, Line 431:
> I'm change the whole block of code, it's not really unrelated, just adapting it to the new block. […]
Done
--
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/30267
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I7912275026c4d4983269c8870aa5565c93277c5a
Gerrit-Change-Number: 30267
Gerrit-PatchSet: 4
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Tue, 22 Nov 2022 19:03:29 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: pespin <pespin(a)sysmocom.de>
Comment-In-Reply-To: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-MessageType: comment
Attention is currently required from: laforge, pespin.
fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/30266 )
Change subject: paging: Store list of gsm_paging_request in bsc_subscr
......................................................................
Patch Set 4: Code-Review+2
(1 comment)
Commit Message:
https://gerrit.osmocom.org/c/osmo-bsc/+/30266/comment/dab672a5_9de63b81
PS3, Line 10: from
> "for a given subscriber"
Done
--
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/30266
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I831d0fe01d7812c34500362b90f47cd65645b666
Gerrit-Change-Number: 30266
Gerrit-PatchSet: 4
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Tue, 22 Nov 2022 19:02:09 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: laforge <laforge(a)osmocom.org>
Gerrit-MessageType: comment