mm/iob: IOB free notifier should accept the work queue ID as a paramter. The notification may need to run on either the high- or low- priority work queue. sched/work: Change the default priority of the low-priority work queue to 100.
This commit is contained in:
parent
91aa26774b
commit
11a635dcb3
@ -213,10 +213,11 @@ FAR struct iob_s *iob_free(FAR struct iob_s *iob);
|
||||
*
|
||||
* Description:
|
||||
* Set up to perform a callback to the worker function when an IOB is
|
||||
* available. The worker function will execute on the high priority
|
||||
* available. The worker function will execute on the selected priority
|
||||
* worker thread.
|
||||
*
|
||||
* Input Parameters:
|
||||
* qid - Selects work queue. Must be HPWORK or LPWORK.
|
||||
* worker - The worker function to execute on the high priority work queue
|
||||
* when the event occurs.
|
||||
* arg - A user-defined argument that will be available to the worker
|
||||
@ -235,7 +236,7 @@ FAR struct iob_s *iob_free(FAR struct iob_s *iob);
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_IOB_NOTIFIER
|
||||
int iob_notifier_setup(worker_t worker, FAR void *arg);
|
||||
int iob_notifier_setup(int qid, worker_t worker, FAR void *arg);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -296,7 +296,7 @@ enum work_evtype_e
|
||||
struct work_notifier_s
|
||||
{
|
||||
uint8_t evtype; /* See enum work_evtype_e */
|
||||
uint8_t wqueue; /* The work queue to use: HPWORK or LPWORK */
|
||||
uint8_t qid; /* The work queue to use: HPWORK or LPWORK */
|
||||
FAR void *qualifier; /* Event qualifier value */
|
||||
FAR void *arg; /* User-defined worker function argument */
|
||||
worker_t worker; /* The worker function to schedule */
|
||||
|
@ -58,10 +58,11 @@
|
||||
*
|
||||
* Description:
|
||||
* Set up to perform a callback to the worker function when an IOB is
|
||||
* available. The worker function will execute on the high priority
|
||||
* available. The worker function will execute on the selected priority
|
||||
* worker thread.
|
||||
*
|
||||
* Input Parameters:
|
||||
* qid - Selects work queue. Must be HPWORK or LPWORK.
|
||||
* worker - The worker function to execute on the high priority work queue
|
||||
* when the event occurs.
|
||||
* arg - A user-defined argument that will be available to the worker
|
||||
@ -77,7 +78,7 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int iob_notifier_setup(worker_t worker, FAR void *arg)
|
||||
int iob_notifier_setup(int qid, worker_t worker, FAR void *arg)
|
||||
{
|
||||
struct work_notifier_s info;
|
||||
|
||||
@ -95,7 +96,7 @@ int iob_notifier_setup(worker_t worker, FAR void *arg)
|
||||
/* Otherwise, this is just a simple wrapper around work_notifer_setup(). */
|
||||
|
||||
info.evtype = WORK_IOB_AVAIL;
|
||||
info.wqueue = HPWORK;
|
||||
info.qid = qid;
|
||||
info.qualifier = NULL;
|
||||
info.arg = arg;
|
||||
info.worker = worker;
|
||||
|
@ -98,7 +98,7 @@ int netdown_notifier_setup(worker_t worker, FAR struct net_driver_s *dev,
|
||||
/* Otherwise, this is just a simple wrapper around work_notifer_setup(). */
|
||||
|
||||
info.evtype = WORK_NET_DOWN;
|
||||
info.wqueue = LPWORK;
|
||||
info.qid = LPWORK;
|
||||
info.qualifier = dev;
|
||||
info.arg = arg;
|
||||
info.worker = worker;
|
||||
|
@ -100,7 +100,7 @@ int tcp_readahead_notifier_setup(worker_t worker,
|
||||
/* Otherwise, this is just a simple wrapper around work_notifer_setup(). */
|
||||
|
||||
info.evtype = WORK_TCP_READAHEAD;
|
||||
info.wqueue = LPWORK;
|
||||
info.qid = LPWORK;
|
||||
info.qualifier = conn;
|
||||
info.arg = arg;
|
||||
info.worker = worker;
|
||||
@ -151,7 +151,7 @@ int tcp_readahead_disconnect_setup(worker_t worker,
|
||||
/* Otherwise, this is just a simple wrapper around work_notifer_setup(). */
|
||||
|
||||
info.evtype = WORK_TCP_DISCONNECT;
|
||||
info.wqueue = LPWORK;
|
||||
info.qid = LPWORK;
|
||||
info.qualifier = conn;
|
||||
info.arg = arg;
|
||||
info.worker = worker;
|
||||
|
@ -653,23 +653,22 @@ int udp_pollteardown(FAR struct socket *psock, FAR struct pollfd *fds);
|
||||
* Description:
|
||||
* Set up to perform a callback to the worker function when an UDP data
|
||||
* is added to the read-ahead buffer. The worker function will execute
|
||||
* on the high priority worker thread.
|
||||
* on the low priority worker thread.
|
||||
*
|
||||
* Input Parameters:
|
||||
* worker - The worker function to execute on the high priority work
|
||||
* queue when data is available in the UDP readahead buffer.
|
||||
* worker - The worker function to execute on the low priority work
|
||||
* queue when data is available in the UDP read-ahead buffer.
|
||||
* conn - The UDP connection where read-ahead data is needed.
|
||||
* arg - A user-defined argument that will be available to the worker
|
||||
* function when it runs.
|
||||
*
|
||||
* Returned Value:
|
||||
* > 0 - The signal notification is in place. The returned value is a
|
||||
* key that may be used later in a call to
|
||||
* udp_notifier_teardown().
|
||||
* == 0 - There is already buffered read-ahead data. No signal
|
||||
* notification will be provided.
|
||||
* < 0 - An unexpected error occurred and no signal will be sent. The
|
||||
* returned value is a negated errno value that indicates the
|
||||
* > 0 - The notification is in place. The returned value is a key that
|
||||
* may be used later in a call to udp_notifier_teardown().
|
||||
* == 0 - There is already buffered read-ahead data. No notification
|
||||
* will be provided.
|
||||
* < 0 - An unexpected error occurred and no notification will occur.
|
||||
* The returned value is a negated errno value that indicates the
|
||||
* nature of the failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
@ -686,7 +685,7 @@ int udp_notifier_setup(worker_t worker, FAR struct udp_conn_s *conn,
|
||||
* Eliminate a UDP read-ahead notification previously setup by
|
||||
* udp_notifier_setup(). This function should only be called if the
|
||||
* notification should be aborted prior to the notification. The
|
||||
* notification will automatically be torn down after the signal is sent.
|
||||
* notification will automatically be torn down after the notification.
|
||||
*
|
||||
* Input Parameters:
|
||||
* key - The key value returned from a previous call to
|
||||
@ -706,7 +705,7 @@ int udp_notifier_teardown(int key);
|
||||
* Name: udp_notifier_signal
|
||||
*
|
||||
* Description:
|
||||
* Read-ahead data has been buffered. Signal all threads waiting for
|
||||
* Read-ahead data has been buffered. Notify all threads waiting for
|
||||
* read-ahead data to become available.
|
||||
*
|
||||
* When read-ahead data becomes available, *all* of the workers waiting
|
||||
|
@ -59,22 +59,21 @@
|
||||
* Description:
|
||||
* Set up to perform a callback to the worker function when an UDP data
|
||||
* is added to the read-ahead buffer. The worker function will execute
|
||||
* on the high priority worker thread.
|
||||
* on the low priority worker thread.
|
||||
*
|
||||
* Input Parameters:
|
||||
* worker - The worker function to execute on the high priority work
|
||||
* queue when data is available in the UDP readahead buffer.
|
||||
* worker - The worker function to execute on the low priority work
|
||||
* queue when data is available in the UDP read-ahead buffer.
|
||||
* conn - The UDP connection where read-ahead data is needed.
|
||||
* arg - A user-defined argument that will be available to the worker
|
||||
* function when it runs.
|
||||
*
|
||||
* Returned Value:
|
||||
* > 0 - The signal notification is in place. The returned value is a
|
||||
* key that may be used later in a call to
|
||||
* udp_notifier_teardown().
|
||||
* == 0 - There is already buffered read-ahead data. No signal
|
||||
* notification will be provided.
|
||||
* < 0 - An unexpected error occurred and no signal will be sent. The
|
||||
* > 0 - The notification is in place. The returned value is a key that
|
||||
* may be used later in a call to udp_notifier_teardown().
|
||||
* == 0 - There is already buffered read-ahead data. No notification
|
||||
* will be provided.
|
||||
* < 0 - An unexpected error occurred and notification will occur. The
|
||||
* returned value is a negated errno value that indicates the
|
||||
* nature of the failure.
|
||||
*
|
||||
@ -99,6 +98,7 @@ int udp_notifier_setup(worker_t worker, FAR struct udp_conn_s *conn,
|
||||
/* Otherwise, this is just a simple wrapper around work_notifer_setup(). */
|
||||
|
||||
info.evtype = WORK_UDP_READAHEAD;
|
||||
info.qid = LPWORK;
|
||||
info.qualifier = conn;
|
||||
info.arg = arg;
|
||||
info.worker = worker;
|
||||
@ -113,7 +113,7 @@ int udp_notifier_setup(worker_t worker, FAR struct udp_conn_s *conn,
|
||||
* Eliminate a UDP read-ahead notification previously setup by
|
||||
* udp_notifier_setup(). This function should only be called if the
|
||||
* notification should be aborted prior to the notification. The
|
||||
* notification will automatically be torn down after the signal is sent.
|
||||
* notification will automatically be torn down after the notification.
|
||||
*
|
||||
* Input Parameters:
|
||||
* key - The key value returned from a previous call to
|
||||
@ -136,7 +136,7 @@ int udp_notifier_teardown(int key)
|
||||
* Name: udp_notifier_signal
|
||||
*
|
||||
* Description:
|
||||
* Read-ahead data has been buffered. Signal all threads waiting for
|
||||
* Read-ahead data has been buffered. Notify all threads waiting for
|
||||
* read-ahead data to become available.
|
||||
*
|
||||
* When read-ahead data becomes available, *all* of the workers waiting
|
||||
|
@ -1511,7 +1511,7 @@ config SCHED_LPNTHREADS
|
||||
|
||||
config SCHED_LPWORKPRIORITY
|
||||
int "Low priority worker thread priority"
|
||||
default 50
|
||||
default 100
|
||||
---help---
|
||||
The minimum execution priority of the lower priority worker thread.
|
||||
|
||||
@ -1520,7 +1520,7 @@ config SCHED_LPWORKPRIORITY
|
||||
priority, of course, but has the added advantage that it supports
|
||||
"priority inheritance" (if PRIORITY_INHERITANCE is also selected):
|
||||
The priority of the lower priority worker thread can then be
|
||||
adjusted to match the highest priority client. Default: 50
|
||||
adjusted to match the highest priority client. Default: 100
|
||||
|
||||
NOTE: This priority inheritance feature is not automatic. The
|
||||
lower priority worker thread will always a fixed priority unless
|
||||
|
@ -203,7 +203,7 @@ int work_notifier_setup(FAR struct work_notifier_s *info)
|
||||
int ret;
|
||||
|
||||
DEBUGASSERT(info != NULL && info->worker != NULL);
|
||||
DEBUGASSERT(info->wqueue == HPWORK && info->wqueue == LPWORK);
|
||||
DEBUGASSERT(info->qid == HPWORK && info->qid == LPWORK);
|
||||
|
||||
/* Get exclusive access to the notifier data structures */
|
||||
|
||||
@ -395,7 +395,7 @@ void work_notifier_signal(enum work_evtype_e evtype,
|
||||
|
||||
/* Schedule the work */
|
||||
|
||||
(void)work_queue(info->wqueue, ¬ifier->work, info->worker,
|
||||
(void)work_queue(info->qid, ¬ifier->work, info->worker,
|
||||
info, 0);
|
||||
}
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user