Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/external/bsd/drm2/drm Don't sleep in the drm_vma allocat...



details:   https://anonhg.NetBSD.org/src/rev/8f6eb0c68d09
branches:  trunk
changeset: 336462:8f6eb0c68d09
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Mon Mar 02 17:34:23 2015 +0000

description:
Don't sleep in the drm_vma allocator.  Fail with ENOSPC, not ENOMEM.

Caller has dev->struct_mutex locked and will handle ENOSPC anyway.

diffstat:

 sys/external/bsd/drm2/drm/drm_vma_manager.c |  11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diffs (35 lines):

diff -r 5039230f9595 -r 8f6eb0c68d09 sys/external/bsd/drm2/drm/drm_vma_manager.c
--- a/sys/external/bsd/drm2/drm/drm_vma_manager.c       Mon Mar 02 17:30:17 2015 +0000
+++ b/sys/external/bsd/drm2/drm/drm_vma_manager.c       Mon Mar 02 17:34:23 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: drm_vma_manager.c,v 1.1 2014/07/16 20:56:25 riastradh Exp $    */
+/*     $NetBSD: drm_vma_manager.c,v 1.2 2015/03/02 17:34:23 riastradh Exp $    */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: drm_vma_manager.c,v 1.1 2014/07/16 20:56:25 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_vma_manager.c,v 1.2 2015/03/02 17:34:23 riastradh Exp $");
 
 #include <sys/kmem.h>
 #include <sys/rbtree.h>
@@ -164,11 +164,14 @@
        if (0 < node->von_npages)
                return 0;
 
-       error = vmem_alloc(mgr->vom_vmem, npages, VM_SLEEP|VM_BESTFIT,
+       error = vmem_alloc(mgr->vom_vmem, npages, VM_NOSLEEP|VM_BESTFIT,
            &startpage);
-       if (error)
+       if (error) {
+               if (error == ENOMEM)
+                       error = ENOSPC;
                /* XXX errno NetBSD->Linux */
                return -error;
+       }
 
        node->von_startpage = startpage;
        node->von_npages = npages;



Home | Main Index | Thread Index | Old Index