FreeBSD Bugzilla – Attachment 148440 Details for
Bug 194455
[PATCH] Preserve lowmem for devices on large memory machines
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
( applies with -p1 on CURRENT ~r273263 )
a.patch (text/plain), 4.04 KB, created by
Conrad Meyer
on 2014-10-18 20:45:20 UTC
(
hide
)
Description:
( applies with -p1 on CURRENT ~r273263 )
Filename:
MIME Type:
Creator:
Conrad Meyer
Created:
2014-10-18 20:45:20 UTC
Size:
4.04 KB
patch
obsolete
>From 56ff85862a92468c742afadd12d1763d10a68887 Mon Sep 17 00:00:00 2001 >From: Conrad Meyer <conrad.meyer@isilon.com> >Date: Sat, 18 Oct 2014 12:50:14 -0700 >Subject: [PATCH] Preserve lowmem for devices on large memory machines > >Add an intermediate VM_FREELIST "DMA32" between DEFAULT and ISADMA on >AMD64. Physical allocations try freelists ascending, so the effect is to >prefer DEFAULT, then DMA32, then ISADMA. > >This leaves low memory available for things that need it (DMA) on >large-memory systems which statically allocate a lot (e.g. bufs). > >Sponsored by: EMC / Isilon storage division >--- > sys/amd64/include/vmparam.h | 15 +++++++++------ > sys/vm/vm_phys.c | 29 ++++++++++++++++++++++++----- > 2 files changed, 33 insertions(+), 11 deletions(-) > >diff --git a/sys/amd64/include/vmparam.h b/sys/amd64/include/vmparam.h >index 14c5134..568ae36 100644 >--- a/sys/amd64/include/vmparam.h >+++ b/sys/amd64/include/vmparam.h >@@ -99,18 +99,21 @@ > #define VM_FREEPOOL_CACHE 2 > #define VM_FREEPOOL_DEFAULT 0 > #define VM_FREEPOOL_DIRECT 1 > > /* >- * Create two free page lists: VM_FREELIST_DEFAULT is for physical >- * pages that are above the largest physical address that is >- * accessible by ISA DMA and VM_FREELIST_ISADMA is for physical pages >- * that are below that address. >+ * Create three free page lists: VM_FREELIST_DEFAULT is for physical pages that >+ * are above the largest physical address that is accessible by 32-bit DMA, >+ * VM_FREELIST_DMA32 is for physical pages that are above the largest physical >+ * address that is accessible by 32-bit ISA DMA, and VM_FREELIST_ISADMA is for >+ * physical pages that are below that >+ * address. > */ >-#define VM_NFREELIST 2 >+#define VM_NFREELIST 3 > #define VM_FREELIST_DEFAULT 0 >-#define VM_FREELIST_ISADMA 1 >+#define VM_FREELIST_DMA32 1 >+#define VM_FREELIST_ISADMA 2 > > /* > * An allocation size of 16MB is supported in order to optimize the > * use of the direct map by UMA. Specifically, a cache line contains > * at most 8 PDEs, collectively mapping 16MB of physical memory. By >diff --git a/sys/vm/vm_phys.c b/sys/vm/vm_phys.c >index be3d5be..ca764bd 100644 >--- a/sys/vm/vm_phys.c >+++ b/sys/vm/vm_phys.c >@@ -65,10 +65,12 @@ __FBSDID("$FreeBSD$"); > #include <vm/vm_kern.h> > #include <vm/vm_object.h> > #include <vm/vm_page.h> > #include <vm/vm_phys.h> > >+#include <machine/bus.h> >+ > _Static_assert(sizeof(long) * NBBY >= VM_PHYSSEG_MAX, > "Too many physsegs."); > > struct mem_affinity *mem_affinity; > >@@ -365,24 +367,41 @@ vm_phys_init(void) > struct vm_freelist *fl; > int dom, flind, i, oind, pind; > > for (i = 0; phys_avail[i + 1] != 0; i += 2) { > #ifdef VM_FREELIST_ISADMA >- if (phys_avail[i] < 16777216) { >- if (phys_avail[i + 1] > 16777216) { >- vm_phys_create_seg(phys_avail[i], 16777216, >+ if (phys_avail[i] < BUS_SPACE_MAXADDR_24BIT) { >+ if (phys_avail[i + 1] > BUS_SPACE_MAXADDR_24BIT) { >+ vm_phys_create_seg(phys_avail[i], >+ BUS_SPACE_MAXADDR_24BIT, > VM_FREELIST_ISADMA); >- vm_phys_create_seg(16777216, phys_avail[i + 1], >- VM_FREELIST_DEFAULT); >+ vm_phys_create_seg(BUS_SPACE_MAXADDR_24BIT, >+ phys_avail[i + 1], VM_FREELIST_DEFAULT); > } else { > vm_phys_create_seg(phys_avail[i], > phys_avail[i + 1], VM_FREELIST_ISADMA); > } > if (VM_FREELIST_ISADMA >= vm_nfreelists) > vm_nfreelists = VM_FREELIST_ISADMA + 1; > } else > #endif >+#ifdef VM_FREELIST_DMA32 >+ if (phys_avail[i] < BUS_SPACE_MAXADDR_32BIT) { >+ if (phys_avail[i + 1] > BUS_SPACE_MAXADDR_32BIT) { >+ vm_phys_create_seg(phys_avail[i], >+ BUS_SPACE_MAXADDR_32BIT, >+ VM_FREELIST_DMA32); >+ vm_phys_create_seg(BUS_SPACE_MAXADDR_32BIT, >+ phys_avail[i + 1], VM_FREELIST_DEFAULT); >+ } else { >+ vm_phys_create_seg(phys_avail[i], >+ phys_avail[i + 1], VM_FREELIST_DMA32); >+ } >+ if (VM_FREELIST_DMA32 >= vm_nfreelists) >+ vm_nfreelists = VM_FREELIST_DMA32 + 1; >+ } else >+#endif > #ifdef VM_FREELIST_HIGHMEM > if (phys_avail[i + 1] > VM_HIGHMEM_ADDRESS) { > if (phys_avail[i] < VM_HIGHMEM_ADDRESS) { > vm_phys_create_seg(phys_avail[i], > VM_HIGHMEM_ADDRESS, VM_FREELIST_DEFAULT); >-- >1.9.3 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 194455
: 148440