svn commit: r359438 - in head/sys: dev/hwpmc kern netinet netinet6 sys
Mark Johnston
markj at FreeBSD.org
Mon Mar 30 14:31:37 UTC 2020
Author: markj
Date: Mon Mar 30 14:24:03 2020
New Revision: 359438
URL: https://svnweb.freebsd.org/changeset/base/359438
Log:
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
Modified:
head/sys/dev/hwpmc/hwpmc_mod.c
head/sys/kern/subr_gtaskqueue.c
head/sys/netinet/in_mcast.c
head/sys/netinet6/in6_mcast.c
head/sys/sys/gtaskqueue.h
Modified: head/sys/dev/hwpmc/hwpmc_mod.c
==============================================================================
--- head/sys/dev/hwpmc/hwpmc_mod.c Mon Mar 30 14:23:08 2020 (r359437)
+++ head/sys/dev/hwpmc/hwpmc_mod.c Mon Mar 30 14:24:03 2020 (r359438)
@@ -36,9 +36,9 @@
__FBSDID("$FreeBSD$");
#include <sys/param.h>
+#include <sys/systm.h>
#include <sys/domainset.h>
#include <sys/eventhandler.h>
-#include <sys/gtaskqueue.h>
#include <sys/jail.h>
#include <sys/kernel.h>
#include <sys/kthread.h>
@@ -63,7 +63,7 @@ __FBSDID("$FreeBSD$");
#include <sys/sysctl.h>
#include <sys/sysent.h>
#include <sys/syslog.h>
-#include <sys/systm.h>
+#include <sys/taskqueue.h>
#include <sys/vnode.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
*/
-static struct grouptask free_gtask;
+static struct task free_task;
/*
* 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);
pmc_threadfreelist_entries++;
if (pmc_threadfreelist_entries > pmc_threadfreelist_max)
- GROUPTASK_ENQUEUE(&free_gtask);
+ taskqueue_enqueue(taskqueue_fast, &free_task);
mtx_unlock_spin(&pmc_threadfreelist_mtx);
}
/*
- * A callout to manage the free list.
+ * An asynchronous task to manage the free list.
*/
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;
LIST_HEAD(, pmc_thread) tmplist;
@@ -5717,11 +5717,8 @@ pmc_initialize(void)
mtx_init(&pmc_threadfreelist_mtx, "pmc-threadfreelist", "pmc-leaf",
MTX_SPIN);
- /*
- * Initialize the callout to monitor the thread free list.
- * 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");
+ /* Initialize the task to prune the thread free list. */
+ TASK_INIT(&free_task, 0, pmc_thread_descriptor_pool_free_task, NULL);
/* register process {exit,fork,exec} handlers */
pmc_exit_tag = EVENTHANDLER_REGISTER(process_exit,
@@ -5820,6 +5817,7 @@ pmc_cleanup(void)
}
/* reclaim allocated data structures */
+ taskqueue_drain(taskqueue_fast, &free_task);
mtx_destroy(&pmc_threadfreelist_mtx);
pmc_thread_descriptor_pool_drain();
@@ -5827,7 +5825,6 @@ pmc_cleanup(void)
mtx_pool_destroy(&pmc_mtxpool);
mtx_destroy(&pmc_processhash_mtx);
- taskqgroup_config_gtask_deinit(&free_gtask);
if (pmc_processhash) {
#ifdef HWPMC_DEBUG
struct pmc_process *pp;
Modified: head/sys/kern/subr_gtaskqueue.c
==============================================================================
--- head/sys/kern/subr_gtaskqueue.c Mon Mar 30 14:23:08 2020 (r359437)
+++ head/sys/kern/subr_gtaskqueue.c Mon Mar 30 14:24:03 2020 (r359438)
@@ -55,7 +55,6 @@ static int task_is_running(struct gtaskqueue *queue, s
static void gtaskqueue_drain_locked(struct gtaskqueue *queue, struct gtask *gtask);
TASKQGROUP_DEFINE(softirq, mp_ncpus, 1);
-TASKQGROUP_DEFINE(config, 1, 1);
struct gtaskqueue_busy {
struct gtask *tb_running;
@@ -817,21 +816,4 @@ taskqgroup_create(const char *name, int cnt, int strid
void
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);
}
Modified: head/sys/netinet/in_mcast.c
==============================================================================
--- head/sys/netinet/in_mcast.c Mon Mar 30 14:23:08 2020 (r359437)
+++ head/sys/netinet/in_mcast.c Mon Mar 30 14:24:03 2020 (r359438)
@@ -51,7 +51,6 @@ __FBSDID("$FreeBSD$");
#include <sys/sysctl.h>
#include <sys/ktr.h>
#include <sys/taskqueue.h>
-#include <sys/gtaskqueue.h>
#include <sys/tree.h>
#include <net/if.h>
@@ -224,24 +223,17 @@ inm_is_ifp_detached(const struct in_multi *inm)
}
#endif
-static struct grouptask free_gtask;
-static struct in_multi_head inm_free_list;
-static void inm_release_task(void *arg __unused);
-static void inm_init(void)
+static struct task free_task;
+static struct in_multi_head inm_free_list = SLIST_HEAD_INITIALIZER();
+static void inm_release_task(void *arg __unused, int pending __unused);
+
+static void
+inm_init(void)
{
- SLIST_INIT(&inm_free_list);
- taskqgroup_config_gtask_init(NULL, &free_gtask, inm_release_task, "inm release task");
+ TASK_INIT(&free_task, 0, inm_release_task, NULL);
}
+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
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);
SLIST_CONCAT(&inm_free_list, inmh, in_multi, inm_nrele);
mtx_unlock(&in_multi_free_mtx);
- GROUPTASK_ENQUEUE(&free_gtask);
+ taskqueue_enqueue(taskqueue_thread, &free_task);
}
void
@@ -304,7 +296,7 @@ inm_release_deferred(struct in_multi *inm)
}
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 *inm, *tinm;
Modified: head/sys/netinet6/in6_mcast.c
==============================================================================
--- head/sys/netinet6/in6_mcast.c Mon Mar 30 14:23:08 2020 (r359437)
+++ head/sys/netinet6/in6_mcast.c Mon Mar 30 14:24:03 2020 (r359438)
@@ -41,8 +41,8 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/systm.h>
-#include <sys/gtaskqueue.h>
#include <sys/kernel.h>
+#include <sys/ktr.h>
#include <sys/malloc.h>
#include <sys/mbuf.h>
#include <sys/protosw.h>
@@ -50,7 +50,7 @@ __FBSDID("$FreeBSD$");
#include <sys/socketvar.h>
#include <sys/sysctl.h>
#include <sys/priv.h>
-#include <sys/ktr.h>
+#include <sys/taskqueue.h>
#include <sys/tree.h>
#include <net/if.h>
@@ -59,7 +59,6 @@ __FBSDID("$FreeBSD$");
#include <net/route.h>
#include <net/vnet.h>
-
#include <netinet/in.h>
#include <netinet/udp.h>
#include <netinet/in_var.h>
@@ -511,24 +510,17 @@ in6m_release(struct in6_multi *inm)
}
}
-static struct grouptask free_gtask;
-static struct in6_multi_head in6m_free_list;
-static void in6m_release_task(void *arg __unused);
-static void in6m_init(void)
+static struct task free_task;
+static struct in6_multi_head in6m_free_list = SLIST_HEAD_INITIALIZER();
+static void in6m_release_task(void *arg __unused, int pending __unused);
+
+static void
+in6m_init(void)
{
- SLIST_INIT(&in6m_free_list);
- taskqgroup_config_gtask_init(NULL, &free_gtask, in6m_release_task, "in6m release task");
+ TASK_INIT(&free_task, 0, in6m_release_task, NULL);
}
+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
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);
SLIST_CONCAT(&in6m_free_list, inmh, in6_multi, in6m_nrele);
mtx_unlock(&in6_multi_free_mtx);
- GROUPTASK_ENQUEUE(&free_gtask);
+ taskqueue_enqueue(taskqueue_thread, &free_task);
}
void
in6m_release_wait(void)
{
-
- /* Wait for all jobs to complete. */
- gtaskqueue_drain_all(free_gtask.gt_taskqueue);
+ taskqueue_drain_all(taskqueue_thread);
}
void
@@ -605,7 +595,7 @@ in6m_disconnect_locked(struct in6_multi_head *inmh, st
}
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 *inm, *tinm;
Modified: head/sys/sys/gtaskqueue.h
==============================================================================
--- head/sys/sys/gtaskqueue.h Mon Mar 30 14:23:08 2020 (r359437)
+++ head/sys/sys/gtaskqueue.h Mon Mar 30 14:24:03 2020 (r359438)
@@ -80,9 +80,6 @@ void taskqgroup_detach(struct taskqgroup *qgroup, stru
struct taskqgroup *taskqgroup_create(const char *name, int cnt, int stride);
void taskqgroup_destroy(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 { \
(gtask)->ta_flags = flags; \
More information about the svn-src-all
mailing list