svn commit: r349014 - in stable/12/sys/compat/linuxkpi/common: include/linux src
Mark Johnston
markj at FreeBSD.org
Thu Jun 13 16:32:05 UTC 2019
Author: markj
Date: Thu Jun 13 16:32:03 2019
New Revision: 349014
URL: https://svnweb.freebsd.org/changeset/base/349014
Log:
MFC r348743:
Make the linuxkpi's alloc_pages() consistently return wired pages.
Modified:
stable/12/sys/compat/linuxkpi/common/include/linux/gfp.h
stable/12/sys/compat/linuxkpi/common/src/linux_page.c
Directory Properties:
stable/12/ (props changed)
Modified: stable/12/sys/compat/linuxkpi/common/include/linux/gfp.h
==============================================================================
--- stable/12/sys/compat/linuxkpi/common/include/linux/gfp.h Thu Jun 13 08:00:32 2019 (r349013)
+++ stable/12/sys/compat/linuxkpi/common/include/linux/gfp.h Thu Jun 13 16:32:03 2019 (r349014)
@@ -52,12 +52,15 @@
#define __GFP_RETRY_MAYFAIL 0
#define __GFP_MOVABLE 0
#define __GFP_COMP 0
-#define __GFP_KSWAPD_RECLAIM 0
+#define __GFP_KSWAPD_RECLAIM 0
#define __GFP_IO 0
#define __GFP_NO_KSWAPD 0
#define __GFP_WAIT M_WAITOK
#define __GFP_DMA32 (1U << 24) /* LinuxKPI only */
+#if defined(LINUXKPI_VERSION) && LINUXKPI_VERSION == 50000
+#define __GFP_NOTWIRED (1U << 25)
+#endif
#define __GFP_BITS_SHIFT 25
#define __GFP_BITS_MASK ((1 << __GFP_BITS_SHIFT) - 1)
#define __GFP_NOFAIL M_WAITOK
@@ -74,7 +77,7 @@
#define GFP_TEMPORARY M_NOWAIT
#define GFP_NATIVE_MASK (M_NOWAIT | M_WAITOK | M_USE_RESERVE | M_ZERO)
#define GFP_TRANSHUGE 0
-#define GFP_TRANSHUGE_LIGHT 0
+#define GFP_TRANSHUGE_LIGHT 0
CTASSERT((__GFP_DMA32 & GFP_NATIVE_MASK) == 0);
CTASSERT((__GFP_BITS_MASK & GFP_NATIVE_MASK) == GFP_NATIVE_MASK);
@@ -98,6 +101,9 @@ static inline struct page *
alloc_page(gfp_t flags)
{
+#ifdef __GFP_NOTWIRED
+ flags |= __GFP_NOTWIRED;
+#endif
return (linux_alloc_pages(flags, 0));
}
@@ -105,6 +111,9 @@ static inline struct page *
alloc_pages(gfp_t flags, unsigned int order)
{
+#ifdef __GFP_NOTWIRED
+ flags |= __GFP_NOTWIRED;
+#endif
return (linux_alloc_pages(flags, order));
}
@@ -112,6 +121,9 @@ static inline struct page *
alloc_pages_node(int node_id, gfp_t flags, unsigned int order)
{
+#ifdef __GFP_NOTWIRED
+ flags |= __GFP_NOTWIRED;
+#endif
return (linux_alloc_pages(flags, order));
}
Modified: stable/12/sys/compat/linuxkpi/common/src/linux_page.c
==============================================================================
--- stable/12/sys/compat/linuxkpi/common/src/linux_page.c Thu Jun 13 08:00:32 2019 (r349013)
+++ stable/12/sys/compat/linuxkpi/common/src/linux_page.c Thu Jun 13 16:32:03 2019 (r349014)
@@ -91,9 +91,14 @@ linux_alloc_pages(gfp_t flags, unsigned int order)
if (PMAP_HAS_DMAP) {
unsigned long npages = 1UL << order;
- int req = (flags & M_ZERO) ? (VM_ALLOC_ZERO | VM_ALLOC_NOOBJ |
- VM_ALLOC_NORMAL) : (VM_ALLOC_NOOBJ | VM_ALLOC_NORMAL);
+ int req = VM_ALLOC_NOOBJ | VM_ALLOC_WIRED | VM_ALLOC_NORMAL;
+#ifdef __GFP_NOTWIRED
+ if ((flags & __GFP_NOTWIRED) != 0)
+ req &= ~VM_ALLOC_WIRED;
+#endif
+ if ((flags & M_ZERO) != 0)
+ req |= VM_ALLOC_ZERO;
if (order == 0 && (flags & GFP_DMA32) == 0) {
page = vm_page_alloc(NULL, 0, req);
if (page == NULL)
@@ -154,7 +159,8 @@ linux_free_pages(vm_page_t page, unsigned int order)
vm_page_t pgo = page + x;
vm_page_lock(pgo);
- vm_page_free(pgo);
+ if (vm_page_unwire_noq(pgo))
+ vm_page_free(pgo);
vm_page_unlock(pgo);
}
} else {
More information about the svn-src-stable-12
mailing list