Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/external/bsd/common/linux alloc_workqueue
details: https://anonhg.NetBSD.org/src/rev/e674aec4261a
branches: trunk
changeset: 1028100:e674aec4261a
user: riastradh <riastradh%NetBSD.org@localhost>
date: Sun Dec 19 01:51:02 2021 +0000
description:
alloc_workqueue
diffstat:
sys/external/bsd/common/include/linux/workqueue.h | 10 +++++++-
sys/external/bsd/common/linux/linux_work.c | 29 ++++++++++++++++------
2 files changed, 30 insertions(+), 9 deletions(-)
diffs (102 lines):
diff -r 5b83f324765b -r e674aec4261a sys/external/bsd/common/include/linux/workqueue.h
--- a/sys/external/bsd/common/include/linux/workqueue.h Sun Dec 19 01:50:54 2021 +0000
+++ b/sys/external/bsd/common/include/linux/workqueue.h Sun Dec 19 01:51:02 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: workqueue.h,v 1.20 2021/12/19 01:41:12 riastradh Exp $ */
+/* $NetBSD: workqueue.h,v 1.21 2021/12/19 01:51:02 riastradh Exp $ */
/*-
* Copyright (c) 2013, 2018 The NetBSD Foundation, Inc.
@@ -39,6 +39,7 @@
#define INIT_DELAYED_WORK linux_INIT_DELAYED_WORK
#define INIT_WORK linux_INIT_WORK
+#define alloc_workqueue linux_alloc_workqueue
#define alloc_ordered_workqueue linux_alloc_ordered_workqueue
#define cancel_delayed_work linux_cancel_delayed_work
#define cancel_delayed_work_sync linux_cancel_delayed_work_sync
@@ -85,6 +86,11 @@
} dw_state;
};
+#define WQ_FREEZABLE __BIT(0)
+#define WQ_HIGHPRI __BIT(1)
+#define WQ_MEM_RECLAIM __BIT(2)
+#define WQ_UNBOUND __BIT(3)
+
static inline struct delayed_work *
to_delayed_work(struct work_struct *work)
{
@@ -103,6 +109,8 @@
alloc_ordered_workqueue((name), 0)
struct workqueue_struct *
+ alloc_workqueue(const char *, int, unsigned);
+struct workqueue_struct *
alloc_ordered_workqueue(const char *, int);
void destroy_workqueue(struct workqueue_struct *);
void flush_workqueue(struct workqueue_struct *);
diff -r 5b83f324765b -r e674aec4261a sys/external/bsd/common/linux/linux_work.c
--- a/sys/external/bsd/common/linux/linux_work.c Sun Dec 19 01:50:54 2021 +0000
+++ b/sys/external/bsd/common/linux/linux_work.c Sun Dec 19 01:51:02 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_work.c,v 1.51 2021/12/19 01:24:13 riastradh Exp $ */
+/* $NetBSD: linux_work.c,v 1.52 2021/12/19 01:51:02 riastradh Exp $ */
/*-
* Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_work.c,v 1.51 2021/12/19 01:24:13 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_work.c,v 1.52 2021/12/19 01:51:02 riastradh Exp $");
#include <sys/types.h>
#include <sys/atomic.h>
@@ -224,19 +224,20 @@
*/
/*
- * alloc_ordered_workqueue(name, flags)
+ * alloc_workqueue(name, flags, max_active)
*
- * Create a workqueue of the given name. No flags are currently
- * defined. Return NULL on failure, pointer to struct
- * workqueue_struct object on success.
+ * Create a workqueue of the given name. max_active is the
+ * maximum number of work items in flight, or 0 for the default.
+ * Return NULL on failure, pointer to struct workqueue_struct
+ * object on success.
*/
struct workqueue_struct *
-alloc_ordered_workqueue(const char *name, int flags)
+alloc_workqueue(const char *name, int flags, unsigned max_active)
{
struct workqueue_struct *wq;
int error;
- KASSERT(flags == 0);
+ KASSERT(max_active == 0 || max_active == 1);
wq = kmem_zalloc(sizeof(*wq), KM_SLEEP);
@@ -270,6 +271,18 @@
}
/*
+ * alloc_ordered_workqueue(name, flags)
+ *
+ * Same as alloc_workqueue(name, flags, 1).
+ */
+struct workqueue_struct *
+alloc_ordered_workqueue(const char *name, int flags)
+{
+
+ return alloc_workqueue(name, flags, 1);
+}
+
+/*
* destroy_workqueue(wq)
*
* Destroy a workqueue created with wq. Cancel any pending
Home |
Main Index |
Thread Index |
Old Index