summaryrefslogtreecommitdiff
path: root/sys/external/bsd/drm2/include/linux
diff options
context:
space:
mode:
authorriastradh <riastradh@NetBSD.org>2021-12-19 12:07:55 +0000
committerriastradh <riastradh@NetBSD.org>2021-12-19 12:07:55 +0000
commited314ebd4ef538a14a8987dc94bcd4ceab090d79 (patch)
treef46ecce10cf3e20a845ba5edf5e9e3002b3564d0 /sys/external/bsd/drm2/include/linux
parent3a9e48730c2a1846dfd4f94e584c7d17aabb2d22 (diff)
linux: Use kmem directly for Linux kmalloc.
Take advantage of this to do LOCKDEBUG_MEM_CHECK at the point of kfree_rcu rather than in the RCU GC thread.
Diffstat (limited to 'sys/external/bsd/drm2/include/linux')
-rw-r--r--sys/external/bsd/drm2/include/linux/mm.h15
-rw-r--r--sys/external/bsd/drm2/include/linux/vmalloc.h20
2 files changed, 15 insertions, 20 deletions
diff --git a/sys/external/bsd/drm2/include/linux/mm.h b/sys/external/bsd/drm2/include/linux/mm.h
index 0fcd7ac6631..3fac9c6698f 100644
--- a/sys/external/bsd/drm2/include/linux/mm.h
+++ b/sys/external/bsd/drm2/include/linux/mm.h
@@ -1,4 +1,4 @@
-/* $NetBSD: mm.h,v 1.22 2021/12/19 11:46:58 riastradh Exp $ */
+/* $NetBSD: mm.h,v 1.23 2021/12/19 12:07:55 riastradh Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -32,8 +32,6 @@
#ifndef _LINUX_MM_H_
#define _LINUX_MM_H_
-#include <sys/malloc.h>
-
#include <uvm/uvm_extern.h>
#include <uvm/uvm_object.h>
@@ -135,16 +133,15 @@ kvmalloc_array(size_t nelem, size_t elemsize, gfp_t gfp)
}
/*
- * XXX Requires that kmalloc in <linux/slab.h> and vmalloc in
- * <linux/vmalloc.h> both use malloc(9). If you change either of
- * those, be sure to update this.
+ * XXX kvfree must additionally work on kmalloc (linux/slab.h) and
+ * vmalloc (linux/vmalloc.h). If you change either of those, be sure
+ * to change this too.
*/
+
static inline void
kvfree(void *ptr)
{
-
- if (ptr != NULL)
- free(ptr, M_TEMP);
+ kfree(ptr);
}
static inline void
diff --git a/sys/external/bsd/drm2/include/linux/vmalloc.h b/sys/external/bsd/drm2/include/linux/vmalloc.h
index bb05275ac1c..56a52de74e5 100644
--- a/sys/external/bsd/drm2/include/linux/vmalloc.h
+++ b/sys/external/bsd/drm2/include/linux/vmalloc.h
@@ -1,4 +1,4 @@
-/* $NetBSD: vmalloc.h,v 1.10 2021/12/19 10:51:24 riastradh Exp $ */
+/* $NetBSD: vmalloc.h,v 1.11 2021/12/19 12:07:55 riastradh Exp $ */
/*-
* Copyright (c) 2013, 2018 The NetBSD Foundation, Inc.
@@ -32,21 +32,21 @@
#ifndef _LINUX_VMALLOC_H_
#define _LINUX_VMALLOC_H_
-#include <sys/malloc.h>
-
#include <uvm/uvm_extern.h>
#include <linux/mm.h>
#include <linux/mm_types.h>
#include <linux/overflow.h>
+#include <linux/slab.h>
#include <asm/page.h>
struct notifier_block;
/*
- * XXX vmalloc and kmalloc both use malloc(9). If you change this, be
- * sure to update kmalloc in <linux/slab.h> and kvfree in <linux/mm.h>.
+ * XXX vmalloc and kvmalloc both use kmalloc. If you change that, be
+ * sure to update this so kvfree in <linux/mm.h> still works on vmalloc
+ * addresses.
*/
static inline bool
@@ -58,27 +58,25 @@ is_vmalloc_addr(void *addr)
static inline void *
vmalloc(unsigned long size)
{
- return malloc(size, M_TEMP, M_WAITOK);
+ return kmalloc(size, GFP_KERNEL);
}
static inline void *
vmalloc_user(unsigned long size)
{
- return malloc(size, M_TEMP, (M_WAITOK | M_ZERO));
+ return kzalloc(size, GFP_KERNEL);
}
static inline void *
vzalloc(unsigned long size)
{
- return malloc(size, M_TEMP, (M_WAITOK | M_ZERO));
+ return kzalloc(size, GFP_KERNEL);
}
static inline void
vfree(void *ptr)
{
- if (ptr == NULL)
- return;
- return free(ptr, M_TEMP);
+ return kfree(ptr);
}
#define PAGE_KERNEL UVM_PROT_RW