mirror of
https://git.openafs.org/openafs.git
synced 2025-01-18 23:10:58 +00:00
STABLE12-rx-thread-id-startup-20030303
FIXES 1304
avoid using rxi_availProcs to allocate thread ids as it may decrement from under us
(cherry picked from commit 45a4d9cb08
)
This commit is contained in:
parent
6e1cf41686
commit
0941d7d223
@ -1455,8 +1455,8 @@ osi_socket *socketp;
|
||||
if (!QuotaOK(service)) {
|
||||
continue;
|
||||
}
|
||||
if (!tno || !tcall->queue_item_header.next) {
|
||||
/* If we're thread 0, then we'll just use
|
||||
if (tno==rxi_fcfs_thread_num || !tcall->queue_item_header.next ) {
|
||||
/* If we're the fcfs thread , then we'll just use
|
||||
* this call. If we haven't been able to find an optimal
|
||||
* choice, and we're at the end of the list, then use a
|
||||
* 2d choice if one has been identified. Otherwise... */
|
||||
@ -1608,8 +1608,8 @@ rx_GetCall(tno, cur_service, socketp)
|
||||
for (queue_Scan(&rx_incomingCallQueue, tcall, ncall, rx_call)) {
|
||||
service = tcall->conn->service;
|
||||
if (QuotaOK(service)) {
|
||||
if (!tno || !tcall->queue_item_header.next ) {
|
||||
/* If we're thread 0, then we'll just use
|
||||
if (tno==rxi_fcfs_thread_num || !tcall->queue_item_header.next ) {
|
||||
/* If we're the fcfs thread, then we'll just use
|
||||
* this call. If we haven't been able to find an optimal
|
||||
* choice, and we're at the end of the list, then use a
|
||||
* 2d choice if one has been identified. Otherwise... */
|
||||
|
@ -373,10 +373,13 @@ EXT int rxi_callAbortDelay INIT(3000);
|
||||
*/
|
||||
|
||||
#if defined(AFS_PTHREAD_ENV)
|
||||
EXT int rxi_fcfs_thread_num INIT(0);
|
||||
EXT pthread_key_t rx_thread_id_key;
|
||||
/* keep track of pthread numbers - protected by rx_stats_mutex,
|
||||
except in rx_Init() before mutex exists! */
|
||||
EXT int rxi_pthread_hinum INIT(0);
|
||||
#else
|
||||
#define rxi_fcfs_thread_num (0)
|
||||
#endif
|
||||
|
||||
#if defined(RX_ENABLE_LOCKS)
|
||||
|
@ -133,9 +133,6 @@ void rxi_StartServerProc(proc, stacksize)
|
||||
printf("Unable to Create Rx server thread\n");
|
||||
exit(1);
|
||||
}
|
||||
MUTEX_ENTER(&rx_stats_mutex);
|
||||
++rxi_pthread_hinum;
|
||||
MUTEX_EXIT(&rx_stats_mutex);
|
||||
AFS_SIGSET_RESTORE();
|
||||
}
|
||||
|
||||
@ -282,7 +279,21 @@ void rx_ServerProc()
|
||||
rxi_dataQuota += rx_initSendWindow; /* Reserve some pkts for hard times */
|
||||
/* threadID is used for making decisions in GetCall. Get it by bumping
|
||||
* number of threads handling incoming calls */
|
||||
threadID = rxi_availProcs++;
|
||||
/* Unique thread ID: used for scheduling purposes *and* as index into
|
||||
the host hold table (fileserver).
|
||||
The previously used rxi_availProcs is unsuitable as it
|
||||
will already go up and down as packets arrive while the server
|
||||
threads are still initialising! The recently introduced
|
||||
rxi_pthread_hinum does not necessarily lead to a server
|
||||
thread with id 0, which is not allowed to hop through the
|
||||
incoming call queue.
|
||||
So either introduce yet another counter or flag the FCFS
|
||||
thread... chose the latter.
|
||||
*/
|
||||
threadID = ++rxi_pthread_hinum;
|
||||
if (rxi_fcfs_thread_num==0 && rxi_fcfs_thread_num!=threadID)
|
||||
rxi_fcfs_thread_num=threadID;
|
||||
++rxi_availProcs;
|
||||
MUTEX_EXIT(&rx_stats_mutex);
|
||||
|
||||
while(1) {
|
||||
|
Loading…
Reference in New Issue
Block a user