summaryrefslogtreecommitdiffstats
path: root/sys/dev/pci/drm/drm_linux.c
diff options
context:
space:
mode:
authorkettenis <kettenis@openbsd.org>2019-06-09 12:58:30 +0000
committerkettenis <kettenis@openbsd.org>2019-06-09 12:58:30 +0000
commit804f66499ed7f1bbdee115d5e61604e513a6050f (patch)
tree5cdc93dc96739eb614b608fc3d2c5bba098bfcbf /sys/dev/pci/drm/drm_linux.c
parentAllow memory that isn't (32-bit) DMA reachable when loading a map that was (diff)
downloadwireguard-openbsd-804f66499ed7f1bbdee115d5e61604e513a6050f.tar.xz
wireguard-openbsd-804f66499ed7f1bbdee115d5e61604e513a6050f.zip
Let drm(4) allocate memory without constraints if the hardware supports
64-bit DMA. Should reduce the pressure on DMA-reachable memory, which is important since there are still cases where the pagedaemon ends up being triggered continuously if we run out of DMA-reachable memory but have plenty of memory left. ok jsg@
Diffstat (limited to 'sys/dev/pci/drm/drm_linux.c')
-rw-r--r--sys/dev/pci/drm/drm_linux.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/sys/dev/pci/drm/drm_linux.c b/sys/dev/pci/drm/drm_linux.c
index f7a961c083d..0b86912cb72 100644
--- a/sys/dev/pci/drm/drm_linux.c
+++ b/sys/dev/pci/drm/drm_linux.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: drm_linux.c,v 1.37 2019/06/04 12:08:22 jsg Exp $ */
+/* $OpenBSD: drm_linux.c,v 1.38 2019/06/09 12:58:30 kettenis Exp $ */
/*
* Copyright (c) 2013 Jonathan Gray <jsg@openbsd.org>
* Copyright (c) 2015, 2016 Mark Kettenis <kettenis@openbsd.org>
@@ -293,16 +293,19 @@ struct vm_page *
alloc_pages(unsigned int gfp_mask, unsigned int order)
{
int flags = (gfp_mask & M_NOWAIT) ? UVM_PLA_NOWAIT : UVM_PLA_WAITOK;
+ struct uvm_constraint_range *constraint = &no_constraint;
struct pglist mlist;
if (gfp_mask & M_CANFAIL)
flags |= UVM_PLA_FAILOK;
if (gfp_mask & M_ZERO)
flags |= UVM_PLA_ZERO;
+ if (gfp_mask & __GFP_DMA32)
+ constraint = &dma_constraint;
TAILQ_INIT(&mlist);
- if (uvm_pglistalloc(PAGE_SIZE << order, dma_constraint.ucr_low,
- dma_constraint.ucr_high, PAGE_SIZE, 0, &mlist, 1, flags))
+ if (uvm_pglistalloc(PAGE_SIZE << order, constraint->ucr_low,
+ constraint->ucr_high, PAGE_SIZE, 0, &mlist, 1, flags))
return NULL;
return TAILQ_FIRST(&mlist);
}