Bug fix on burst of GENA notification
When a lot of notifications were generated by a device in a short period of time then 100% of the CPU was used to reorder those notifications by pushing back the thread in the job queue. This mechanism has been modified so now thread sleep 1 ms before being pushed back into the job queue. Removing DEFAULT_SCHED_PARAM parameter and use sched_get_priority_min(DEFAULT_POLICY) instead.
This commit is contained in:
parent
4966423d96
commit
c33b11d09f
13
ChangeLog
13
ChangeLog
@ -2,6 +2,19 @@
|
|||||||
Version 1.6.7
|
Version 1.6.7
|
||||||
*******************************************************************************
|
*******************************************************************************
|
||||||
|
|
||||||
|
2010-09-28 Marc Essayan <marc.essayan(at)orange-ftgroup.com>
|
||||||
|
|
||||||
|
Bug fix on burst of GENA notification
|
||||||
|
|
||||||
|
When a lot of notifications were generated by a device in a short
|
||||||
|
period of time then 100% of the CPU was used to reorder those
|
||||||
|
notifications by pushing back the thread in the job queue. This
|
||||||
|
mechanism has been modified so now thread sleep 1 ms before being
|
||||||
|
pushed back into the job queue.
|
||||||
|
|
||||||
|
Removing DEFAULT_SCHED_PARAM parameter and use
|
||||||
|
sched_get_priority_min(DEFAULT_POLICY) instead.
|
||||||
|
|
||||||
2010-09-22 Fabrice Fontaine <fabrice.fontaine(at)orange-ftgroup.com>
|
2010-09-22 Fabrice Fontaine <fabrice.fontaine(at)orange-ftgroup.com>
|
||||||
|
|
||||||
Bug fix on M-SEARCH response
|
Bug fix on M-SEARCH response
|
||||||
|
@ -158,10 +158,6 @@ typedef int PolicyType;
|
|||||||
#define DEFAULT_POLICY SCHED_OTHER
|
#define DEFAULT_POLICY SCHED_OTHER
|
||||||
|
|
||||||
|
|
||||||
/*! Default priority */
|
|
||||||
#define DEFAULT_SCHED_PARAM 0
|
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: free_routine
|
* Name: free_routine
|
||||||
*
|
*
|
||||||
|
@ -246,7 +246,7 @@ static int SetPolicyType(PolicyType in)
|
|||||||
|
|
||||||
memset(¤t, 0, sizeof(current));
|
memset(¤t, 0, sizeof(current));
|
||||||
sched_getparam(0, ¤t);
|
sched_getparam(0, ¤t);
|
||||||
current.sched_priority = DEFAULT_SCHED_PARAM;
|
current.sched_priority = sched_get_priority_min(DEFAULT_POLICY);
|
||||||
sched_result = sched_setscheduler(0, in, ¤t);
|
sched_result = sched_setscheduler(0, in, ¤t);
|
||||||
retVal = (sched_result != -1 || errno == EPERM) ? 0 : errno;
|
retVal = (sched_result != -1 || errno == EPERM) ? 0 : errno;
|
||||||
#else
|
#else
|
||||||
|
@ -342,7 +342,12 @@ static void genaNotifyThread(
|
|||||||
struct Handle_Info *handle_info;
|
struct Handle_Info *handle_info;
|
||||||
ThreadPoolJob job;
|
ThreadPoolJob job;
|
||||||
|
|
||||||
HandleReadLock();
|
/* This should be a HandleLock and not a HandleReadLock otherwise if there
|
||||||
|
* is a lot of notifications, then multiple threads will acquire a read
|
||||||
|
* lock and the thread which sends the notification will be blocked forever
|
||||||
|
* on the HandleLock at the end of this function. */
|
||||||
|
//HandleReadLock();
|
||||||
|
HandleLock();
|
||||||
//validate context
|
//validate context
|
||||||
|
|
||||||
if( GetHandleInfo( in->device_handle, &handle_info ) != HND_DEVICE ) {
|
if( GetHandleInfo( in->device_handle, &handle_info ) != HND_DEVICE ) {
|
||||||
@ -366,6 +371,12 @@ static void genaNotifyThread(
|
|||||||
TPJobInit( &job, ( start_routine ) genaNotifyThread, input );
|
TPJobInit( &job, ( start_routine ) genaNotifyThread, input );
|
||||||
TPJobSetFreeFunction( &job, ( free_function ) free_notify_struct );
|
TPJobSetFreeFunction( &job, ( free_function ) free_notify_struct );
|
||||||
TPJobSetPriority( &job, MED_PRIORITY );
|
TPJobSetPriority( &job, MED_PRIORITY );
|
||||||
|
|
||||||
|
/* Sleep a little before creating another thread otherwise if there is
|
||||||
|
* a lot of notifications to send, the device will take 100% of the CPU
|
||||||
|
* to create threads and push them back to the job queue. */
|
||||||
|
imillisleep( 1 );
|
||||||
|
|
||||||
ThreadPoolAdd( &gSendThreadPool, &job, NULL );
|
ThreadPoolAdd( &gSendThreadPool, &job, NULL );
|
||||||
|
|
||||||
freeSubscription( &sub_copy );
|
freeSubscription( &sub_copy );
|
||||||
|
Loading…
Reference in New Issue
Block a user