commit-hurd
[Top][All Lists]
Advanced

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

[hurd] 03/06: mach-defpager: make the default pager use vm_wire_all


From: Samuel Thibault
Subject: [hurd] 03/06: mach-defpager: make the default pager use vm_wire_all
Date: Mon, 02 Jan 2017 19:59:55 +0000

This is an automated email from the git hooks/post-receive script.

sthibault pushed a commit to branch upstream
in repository hurd.

commit 92e3b0a3c3ba90c90605debf6e149e5a4b8d9a8f
Author: Richard Braun <address@hidden>
Date:   Sat Dec 24 02:57:36 2016 +0100

    mach-defpager: make the default pager use vm_wire_all
    
    The vm_wire_all call was recently added to GNU Mach so that the
    default pager doesn't depend on glibc malloc hooks any more.
    
    * mach-defpager/default_pager.c
    (start_default_pager_thread): Remove call to wire_memory.
    * mach-defpager/kalloc.c (kget_space): Likewise.
    * mach-defpager/wiring.c: Include mach/gnumach.h.
    (wire_memory): Remove function.
    (wire_all_memory): Replace call to wire_memory with a direct call
    to vm_wire, call vm_wire_all after the fixup loop.
    (vm_allocate, __vm_allocate): Remove functions.
    * mach-defpager/wiring.h (wire_memory): Remove function.
---
 mach-defpager/default_pager.c |  2 --
 mach-defpager/kalloc.c        |  2 --
 mach-defpager/wiring.c        | 67 +++++++++----------------------------------
 mach-defpager/wiring.h        |  1 -
 4 files changed, 13 insertions(+), 59 deletions(-)

diff --git a/mach-defpager/default_pager.c b/mach-defpager/default_pager.c
index 787ba5b..cddbcfa 100644
--- a/mach-defpager/default_pager.c
+++ b/mach-defpager/default_pager.c
@@ -3011,8 +3011,6 @@ start_default_pager_thread(internal)
                         vm_page_size, TRUE);
        if (kr != KERN_SUCCESS)
                panic(my_name);
-       wire_memory(ndpt->dpt_buffer, vm_page_size,
-                   VM_PROT_READ|VM_PROT_WRITE);
 
        err = pthread_create(&ndpt->dpt_thread, NULL, default_pager_thread,
                             ndpt);
diff --git a/mach-defpager/kalloc.c b/mach-defpager/kalloc.c
index e4ed12f..3356643 100644
--- a/mach-defpager/kalloc.c
+++ b/mach-defpager/kalloc.c
@@ -150,8 +150,6 @@ vm_offset_t kget_space(vm_offset_t size)
                           VM_PROT_DEFAULT, VM_PROT_ALL, VM_INHERIT_DEFAULT)
                        != KERN_SUCCESS)
                    return 0;
-               wire_memory(new_space, space_to_add,
-                           VM_PROT_READ|VM_PROT_WRITE);
                pthread_spin_lock(&kget_space_lock);
                continue;
            }
diff --git a/mach-defpager/wiring.c b/mach-defpager/wiring.c
index a0a608d..ac20dda 100644
--- a/mach-defpager/wiring.c
+++ b/mach-defpager/wiring.c
@@ -28,6 +28,7 @@
  */
 #include <mach.h>
 #include <mach_init.h>
+#include <mach/gnumach.h>
 #include <mach/machine/vm_param.h>
 #include "default_pager.h"
 
@@ -44,24 +45,6 @@ wire_setup(host_priv)
 }
 
 void
-wire_memory(start, size, prot)
-       vm_address_t    start;
-       vm_size_t       size;
-       vm_prot_t       prot;
-{
-       kern_return_t   kr;
-
-       if (priv_host_port == MACH_PORT_NULL)
-           return;
-
-       kr = vm_wire(priv_host_port,
-                    this_task,
-                    start, size, prot);
-       if (kr != KERN_SUCCESS)
-           panic("mem_wire: %d", kr);
-}
-
-void
 wire_thread()
 {
        kern_return_t   kr;
@@ -125,7 +108,10 @@ wire_all_memory()
                     page += vm_page_size)
                  *(volatile int *) page = *(int *) page;
 
-               wire_memory(address, size, protection);
+               kr = vm_wire(priv_host_port, this_task,
+                            address, size, protection);
+               if (kr != KERN_SUCCESS)
+                       panic("vm_wire: %d", kr);
 
                if (!(protection & VM_PROT_WRITE))
                  {
@@ -135,42 +121,15 @@ wire_all_memory()
              }
            address += size;
        }
-}
 
-/*
- * Alias for vm_allocate to return wired memory.
- */
-kern_return_t
-vm_allocate(task, address, size, anywhere)
-       task_t          task;
-       vm_address_t    *address;
-       vm_size_t       size;
-       boolean_t       anywhere;
-{
-       kern_return_t   kr;
+       /*
+        * Automatically wire down future mappings, including those
+        * that are currently PROT_NONE but become accessible.
+        */
 
-       if (anywhere)
-           *address = VM_MIN_ADDRESS;
-       kr = vm_map(task,
-               address, size, (vm_offset_t) 0, anywhere,
-               MEMORY_OBJECT_NULL, (vm_offset_t)0, FALSE,
-               VM_PROT_DEFAULT, VM_PROT_ALL, VM_INHERIT_DEFAULT);
-       if (kr != KERN_SUCCESS)
-           return kr;
+       kr = vm_wire_all(priv_host_port, this_task, VM_WIRE_ALL);
 
-       if (task == this_task)
-           (void) vm_wire(priv_host_port, task, *address, size,
-                       VM_PROT_DEFAULT);
-       return KERN_SUCCESS;
-}
-
-/* Other versions of this function in libc... */
-kern_return_t
-__vm_allocate (task, address, size, anywhere)
-       task_t          task;
-       vm_address_t    *address;
-       vm_size_t       size;
-       boolean_t       anywhere;
-{
-  return vm_allocate (task, address, size, anywhere);
+       if (kr != KERN_SUCCESS) {
+           panic("wire_all_memory: %d", kr);
+       }
 }
diff --git a/mach-defpager/wiring.h b/mach-defpager/wiring.h
index b5f8e53..e545834 100644
--- a/mach-defpager/wiring.h
+++ b/mach-defpager/wiring.h
@@ -30,6 +30,5 @@
 #include <mach_init.h>
 
 extern void    wire_setup(/* mach_port_t host_priv */);
-extern void    wire_memory(/* vm_address_t, vm_size_t, vm_prot_t */);
 extern void    wire_thread();
 extern void    wire_all_memory();

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-hurd/hurd.git



reply via email to

[Prev in Thread] Current Thread [Next in Thread]