1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-10-19 02:29:40 +00:00

Remove the "config" taskqgroup and its KPIs.

Equivalent functionality is already provided by taskqueue(9), just use
that instead.

MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
This commit is contained in:
Mark Johnston 2020-03-30 14:24:03 +00:00
parent 9893ab3f50
commit 9b1d850be8
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=359438
5 changed files with 32 additions and 74 deletions

View File

@ -36,9 +36,9 @@
__FBSDID("$FreeBSD$"); __FBSDID("$FreeBSD$");
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h>
#include <sys/domainset.h> #include <sys/domainset.h>
#include <sys/eventhandler.h> #include <sys/eventhandler.h>
#include <sys/gtaskqueue.h>
#include <sys/jail.h> #include <sys/jail.h>
#include <sys/kernel.h> #include <sys/kernel.h>
#include <sys/kthread.h> #include <sys/kthread.h>
@ -63,7 +63,7 @@ __FBSDID("$FreeBSD$");
#include <sys/sysctl.h> #include <sys/sysctl.h>
#include <sys/sysent.h> #include <sys/sysent.h>
#include <sys/syslog.h> #include <sys/syslog.h>
#include <sys/systm.h> #include <sys/taskqueue.h>
#include <sys/vnode.h> #include <sys/vnode.h>
#include <sys/linker.h> /* needs to be after <sys/malloc.h> */ #include <sys/linker.h> /* needs to be after <sys/malloc.h> */
@ -187,7 +187,7 @@ static int pmc_threadfreelist_entries=0;
/* /*
* Task to free thread descriptors * Task to free thread descriptors
*/ */
static struct grouptask free_gtask; static struct task free_task;
/* /*
* A map of row indices to classdep structures. * A map of row indices to classdep structures.
@ -2413,15 +2413,15 @@ pmc_thread_descriptor_pool_free(struct pmc_thread *pt)
LIST_INSERT_HEAD(&pmc_threadfreelist, pt, pt_next); LIST_INSERT_HEAD(&pmc_threadfreelist, pt, pt_next);
pmc_threadfreelist_entries++; pmc_threadfreelist_entries++;
if (pmc_threadfreelist_entries > pmc_threadfreelist_max) if (pmc_threadfreelist_entries > pmc_threadfreelist_max)
GROUPTASK_ENQUEUE(&free_gtask); taskqueue_enqueue(taskqueue_fast, &free_task);
mtx_unlock_spin(&pmc_threadfreelist_mtx); mtx_unlock_spin(&pmc_threadfreelist_mtx);
} }
/* /*
* A callout to manage the free list. * An asynchronous task to manage the free list.
*/ */
static void static void
pmc_thread_descriptor_pool_free_task(void *arg __unused) pmc_thread_descriptor_pool_free_task(void *arg __unused, int pending __unused)
{ {
struct pmc_thread *pt; struct pmc_thread *pt;
LIST_HEAD(, pmc_thread) tmplist; LIST_HEAD(, pmc_thread) tmplist;
@ -5717,11 +5717,8 @@ pmc_initialize(void)
mtx_init(&pmc_threadfreelist_mtx, "pmc-threadfreelist", "pmc-leaf", mtx_init(&pmc_threadfreelist_mtx, "pmc-threadfreelist", "pmc-leaf",
MTX_SPIN); MTX_SPIN);
/* /* Initialize the task to prune the thread free list. */
* Initialize the callout to monitor the thread free list. TASK_INIT(&free_task, 0, pmc_thread_descriptor_pool_free_task, NULL);
* This callout will also handle the initial population of the list.
*/
taskqgroup_config_gtask_init(NULL, &free_gtask, pmc_thread_descriptor_pool_free_task, "thread descriptor pool free task");
/* register process {exit,fork,exec} handlers */ /* register process {exit,fork,exec} handlers */
pmc_exit_tag = EVENTHANDLER_REGISTER(process_exit, pmc_exit_tag = EVENTHANDLER_REGISTER(process_exit,
@ -5820,6 +5817,7 @@ pmc_cleanup(void)
} }
/* reclaim allocated data structures */ /* reclaim allocated data structures */
taskqueue_drain(taskqueue_fast, &free_task);
mtx_destroy(&pmc_threadfreelist_mtx); mtx_destroy(&pmc_threadfreelist_mtx);
pmc_thread_descriptor_pool_drain(); pmc_thread_descriptor_pool_drain();
@ -5827,7 +5825,6 @@ pmc_cleanup(void)
mtx_pool_destroy(&pmc_mtxpool); mtx_pool_destroy(&pmc_mtxpool);
mtx_destroy(&pmc_processhash_mtx); mtx_destroy(&pmc_processhash_mtx);
taskqgroup_config_gtask_deinit(&free_gtask);
if (pmc_processhash) { if (pmc_processhash) {
#ifdef HWPMC_DEBUG #ifdef HWPMC_DEBUG
struct pmc_process *pp; struct pmc_process *pp;

View File

@ -55,7 +55,6 @@ static int task_is_running(struct gtaskqueue *queue, struct gtask *gtask);
static void gtaskqueue_drain_locked(struct gtaskqueue *queue, struct gtask *gtask); static void gtaskqueue_drain_locked(struct gtaskqueue *queue, struct gtask *gtask);
TASKQGROUP_DEFINE(softirq, mp_ncpus, 1); TASKQGROUP_DEFINE(softirq, mp_ncpus, 1);
TASKQGROUP_DEFINE(config, 1, 1);
struct gtaskqueue_busy { struct gtaskqueue_busy {
struct gtask *tb_running; struct gtask *tb_running;
@ -817,21 +816,4 @@ taskqgroup_create(const char *name, int cnt, int stride)
void void
taskqgroup_destroy(struct taskqgroup *qgroup) taskqgroup_destroy(struct taskqgroup *qgroup)
{ {
}
void
taskqgroup_config_gtask_init(void *ctx, struct grouptask *gtask, gtask_fn_t *fn,
const char *name)
{
GROUPTASK_INIT(gtask, 0, fn, ctx);
taskqgroup_attach(qgroup_config, gtask, gtask, NULL, NULL, name);
}
void
taskqgroup_config_gtask_deinit(struct grouptask *gtask)
{
taskqgroup_detach(qgroup_config, gtask);
} }

View File

@ -51,7 +51,6 @@ __FBSDID("$FreeBSD$");
#include <sys/sysctl.h> #include <sys/sysctl.h>
#include <sys/ktr.h> #include <sys/ktr.h>
#include <sys/taskqueue.h> #include <sys/taskqueue.h>
#include <sys/gtaskqueue.h>
#include <sys/tree.h> #include <sys/tree.h>
#include <net/if.h> #include <net/if.h>
@ -224,23 +223,16 @@ inm_is_ifp_detached(const struct in_multi *inm)
} }
#endif #endif
static struct grouptask free_gtask; static struct task free_task;
static struct in_multi_head inm_free_list; static struct in_multi_head inm_free_list = SLIST_HEAD_INITIALIZER();
static void inm_release_task(void *arg __unused); static void inm_release_task(void *arg __unused, int pending __unused);
static void inm_init(void)
static void
inm_init(void)
{ {
SLIST_INIT(&inm_free_list); TASK_INIT(&free_task, 0, inm_release_task, NULL);
taskqgroup_config_gtask_init(NULL, &free_gtask, inm_release_task, "inm release task");
} }
SYSINIT(inm_init, SI_SUB_TASKQ, SI_ORDER_ANY, inm_init, NULL);
#ifdef EARLY_AP_STARTUP
SYSINIT(inm_init, SI_SUB_SMP + 1, SI_ORDER_FIRST,
inm_init, NULL);
#else
SYSINIT(inm_init, SI_SUB_ROOT_CONF - 1, SI_ORDER_FIRST,
inm_init, NULL);
#endif
void void
inm_release_list_deferred(struct in_multi_head *inmh) inm_release_list_deferred(struct in_multi_head *inmh)
@ -251,7 +243,7 @@ inm_release_list_deferred(struct in_multi_head *inmh)
mtx_lock(&in_multi_free_mtx); mtx_lock(&in_multi_free_mtx);
SLIST_CONCAT(&inm_free_list, inmh, in_multi, inm_nrele); SLIST_CONCAT(&inm_free_list, inmh, in_multi, inm_nrele);
mtx_unlock(&in_multi_free_mtx); mtx_unlock(&in_multi_free_mtx);
GROUPTASK_ENQUEUE(&free_gtask); taskqueue_enqueue(taskqueue_thread, &free_task);
} }
void void
@ -304,7 +296,7 @@ inm_release_deferred(struct in_multi *inm)
} }
static void static void
inm_release_task(void *arg __unused) inm_release_task(void *arg __unused, int pending __unused)
{ {
struct in_multi_head inm_free_tmp; struct in_multi_head inm_free_tmp;
struct in_multi *inm, *tinm; struct in_multi *inm, *tinm;

View File

@ -41,8 +41,8 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
#include <sys/gtaskqueue.h>
#include <sys/kernel.h> #include <sys/kernel.h>
#include <sys/ktr.h>
#include <sys/malloc.h> #include <sys/malloc.h>
#include <sys/mbuf.h> #include <sys/mbuf.h>
#include <sys/protosw.h> #include <sys/protosw.h>
@ -50,7 +50,7 @@ __FBSDID("$FreeBSD$");
#include <sys/socketvar.h> #include <sys/socketvar.h>
#include <sys/sysctl.h> #include <sys/sysctl.h>
#include <sys/priv.h> #include <sys/priv.h>
#include <sys/ktr.h> #include <sys/taskqueue.h>
#include <sys/tree.h> #include <sys/tree.h>
#include <net/if.h> #include <net/if.h>
@ -59,7 +59,6 @@ __FBSDID("$FreeBSD$");
#include <net/route.h> #include <net/route.h>
#include <net/vnet.h> #include <net/vnet.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <netinet/udp.h> #include <netinet/udp.h>
#include <netinet/in_var.h> #include <netinet/in_var.h>
@ -511,23 +510,16 @@ in6m_release(struct in6_multi *inm)
} }
} }
static struct grouptask free_gtask; static struct task free_task;
static struct in6_multi_head in6m_free_list; static struct in6_multi_head in6m_free_list = SLIST_HEAD_INITIALIZER();
static void in6m_release_task(void *arg __unused); static void in6m_release_task(void *arg __unused, int pending __unused);
static void in6m_init(void)
static void
in6m_init(void)
{ {
SLIST_INIT(&in6m_free_list); TASK_INIT(&free_task, 0, in6m_release_task, NULL);
taskqgroup_config_gtask_init(NULL, &free_gtask, in6m_release_task, "in6m release task");
} }
SYSINIT(in6m_init, SI_SUB_TASKQ, SI_ORDER_ANY, in6m_init, NULL);
#ifdef EARLY_AP_STARTUP
SYSINIT(in6m_init, SI_SUB_SMP + 1, SI_ORDER_FIRST,
in6m_init, NULL);
#else
SYSINIT(in6m_init, SI_SUB_ROOT_CONF - 1, SI_ORDER_SECOND,
in6m_init, NULL);
#endif
void void
in6m_release_list_deferred(struct in6_multi_head *inmh) in6m_release_list_deferred(struct in6_multi_head *inmh)
@ -537,15 +529,13 @@ in6m_release_list_deferred(struct in6_multi_head *inmh)
mtx_lock(&in6_multi_free_mtx); mtx_lock(&in6_multi_free_mtx);
SLIST_CONCAT(&in6m_free_list, inmh, in6_multi, in6m_nrele); SLIST_CONCAT(&in6m_free_list, inmh, in6_multi, in6m_nrele);
mtx_unlock(&in6_multi_free_mtx); mtx_unlock(&in6_multi_free_mtx);
GROUPTASK_ENQUEUE(&free_gtask); taskqueue_enqueue(taskqueue_thread, &free_task);
} }
void void
in6m_release_wait(void) in6m_release_wait(void)
{ {
taskqueue_drain_all(taskqueue_thread);
/* Wait for all jobs to complete. */
gtaskqueue_drain_all(free_gtask.gt_taskqueue);
} }
void void
@ -605,7 +595,7 @@ in6m_disconnect_locked(struct in6_multi_head *inmh, struct in6_multi *inm)
} }
static void static void
in6m_release_task(void *arg __unused) in6m_release_task(void *arg __unused, int pending __unused)
{ {
struct in6_multi_head in6m_free_tmp; struct in6_multi_head in6m_free_tmp;
struct in6_multi *inm, *tinm; struct in6_multi *inm, *tinm;

View File

@ -80,9 +80,6 @@ void taskqgroup_detach(struct taskqgroup *qgroup, struct grouptask *gtask);
struct taskqgroup *taskqgroup_create(const char *name, int cnt, int stride); struct taskqgroup *taskqgroup_create(const char *name, int cnt, int stride);
void taskqgroup_destroy(struct taskqgroup *qgroup); void taskqgroup_destroy(struct taskqgroup *qgroup);
void taskqgroup_bind(struct taskqgroup *qgroup); void taskqgroup_bind(struct taskqgroup *qgroup);
void taskqgroup_config_gtask_init(void *ctx, struct grouptask *gtask,
gtask_fn_t *fn, const char *name);
void taskqgroup_config_gtask_deinit(struct grouptask *gtask);
#define GTASK_INIT(gtask, flags, priority, func, context) do { \ #define GTASK_INIT(gtask, flags, priority, func, context) do { \
(gtask)->ta_flags = flags; \ (gtask)->ta_flags = flags; \