sched/wqueue/kwork_notifier.c and several Kconfig files: Notifier should work with either lpwork or hpwork and other minor typo fix.

This commit is contained in:
Xiang Xiao 2019-01-27 11:02:56 -06:00 committed by Gregory Nutt
parent 7310fb7018
commit fe421022e2
7 changed files with 19 additions and 19 deletions

View File

@ -245,7 +245,7 @@
/* Kernel mode */ /* Kernel mode */
# define HPWORK 0 /* High priority, kernel-mode work queue */ # define HPWORK 0 /* High priority, kernel-mode work queue */
# ifdef CONFIG_SCHED_LPWORK # if defined(CONFIG_SCHED_LPWORK) && defined(CONFIG_SCHED_HPWORK)
# define LPWORK (HPWORK+1) /* Low priority, kernel-mode work queue */ # define LPWORK (HPWORK+1) /* Low priority, kernel-mode work queue */
# else # else
# define LPWORK HPWORK /* Redirect low-priority references */ # define LPWORK HPWORK /* Redirect low-priority references */

View File

@ -62,7 +62,7 @@ config IOB_THROTTLE
config IOB_NOTIFIER config IOB_NOTIFIER
bool "Support IOB notifications" bool "Support IOB notifications"
default n default n
depends on SCHED_HPWORK depends on SCHED_WORKQUEUE
select WQUEUE_NOTIFIER select WQUEUE_NOTIFIER
---help--- ---help---
Enable building of IOB notifier logic that will execute a worker Enable building of IOB notifier logic that will execute a worker

View File

@ -39,7 +39,7 @@ config NETDEV_IFINDEX
config NETDOWN_NOTIFIER config NETDOWN_NOTIFIER
bool "Support network down notifications" bool "Support network down notifications"
default n default n
depends on SCHED_LPWORK depends on SCHED_WORKQUEUE
select WQUEUE_NOTIFIER select WQUEUE_NOTIFIER
---help--- ---help---
Enable building of logic that will execute on the low priority work Enable building of logic that will execute on the low priority work

View File

@ -50,7 +50,7 @@ config NET_MAX_LISTENPORTS
config TCP_NOTIFIER config TCP_NOTIFIER
bool "Support TCP notifications" bool "Support TCP notifications"
default n default n
depends on SCHED_LPWORK depends on SCHED_WORKQUEUE
select WQUEUE_NOTIFIER select WQUEUE_NOTIFIER
---help--- ---help---
Enable building of TCP notifier logic that will execute a worker Enable building of TCP notifier logic that will execute a worker

View File

@ -60,7 +60,7 @@ config NET_UDP_READAHEAD
config UDP_READAHEAD_NOTIFIER config UDP_READAHEAD_NOTIFIER
bool "Support UDP read-ahead notifications" bool "Support UDP read-ahead notifications"
default n default n
depends on NET_UDP_READAHEAD && SCHED_HPWORK depends on NET_UDP_READAHEAD && SCHED_WORKQUEUE
select WQUEUE_NOTIFIER select WQUEUE_NOTIFIER
---help--- ---help---
Enable building of UDP read-ahead notifier logic that will execute a Enable building of UDP read-ahead notifier logic that will execute a

View File

@ -1469,6 +1469,16 @@ config SCHED_WORKQUEUE
Create dedicated "worker" threads to handle delayed or asynchronous Create dedicated "worker" threads to handle delayed or asynchronous
processing. processing.
config WQUEUE_NOTIFIER
bool "Generic work notifier"
default n
depends on SCHED_WORKQUEUE
---help---
Enable building of work queue notifier logic that will execute a
worker function an event occurs. This is is a general purpose
notifier, but was developed specifically to support poll() logic
where the poll must wait for an resources to become available.
config SCHED_HPWORK config SCHED_HPWORK
bool "High priority (kernel) worker thread" bool "High priority (kernel) worker thread"
default n default n
@ -1534,15 +1544,6 @@ config SCHED_HPWORKSTACKSIZE
---help--- ---help---
The stack size allocated for the worker thread. Default: 2K. The stack size allocated for the worker thread. Default: 2K.
config WQUEUE_NOTIFIER
bool "Generic work notifier"
default n
---help---
Enable building of work queue notifier logic that will execute a
worker function an event occurs. This is is a general purpose
notifier, but was developed specifically to support poll() logic
where the poll must wait for an resources to become available.
endif # SCHED_HPWORK endif # SCHED_HPWORK
config SCHED_LPWORK config SCHED_LPWORK

View File

@ -211,7 +211,7 @@ int work_notifier_setup(FAR struct work_notifier_s *info)
*/ */
dq_addlast((FAR dq_entry_t *)notifier, &g_notifier_pending); dq_addlast((FAR dq_entry_t *)notifier, &g_notifier_pending);
ret = work_notifier_key(); ret = notifier->key;
} }
(void)nxsem_post(&g_notifier_sem); (void)nxsem_post(&g_notifier_sem);
@ -310,11 +310,12 @@ void work_notifier_signal(enum work_evtype_e evtype,
/* Get exclusive access to the notifier data structure */ /* Get exclusive access to the notifier data structure */
ret = nxsem_wait(&g_notifier_sem); do
while (ret < 0)
{ {
ret = nxsem_wait(&g_notifier_sem);
DEBUGASSERT(ret == -EINTR || ret == -ECANCELED); DEBUGASSERT(ret == -EINTR || ret == -ECANCELED);
} }
while (ret < 0);
/* Don't let any newly started threads block this thread until all of /* Don't let any newly started threads block this thread until all of
* the notifications and been sent. * the notifications and been sent.
@ -325,8 +326,6 @@ void work_notifier_signal(enum work_evtype_e evtype,
/* Process the notification at the head of the pending list until the /* Process the notification at the head of the pending list until the
* pending list is empty */ * pending list is empty */
/* Find the entry matching this key in the g_notifier_pending list. */
for (entry = dq_peek(&g_notifier_pending); for (entry = dq_peek(&g_notifier_pending);
entry != NULL; entry != NULL;
entry = next) entry = next)