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

Re: Pageout not succeeding



On 27/05/2025 17:39, Samuel Thibault wrote:
Hello,

Michael Kelly, le mar. 27 mai 2025 15:22:27 +0100, a ecrit:
I've been looking at why the page out to the default pager isn't currently
working.
Could you please add the -u option to diff? Otherwise we don't have the
context and it's extremely risky to apply a patch without context :)

Thanks,
Samuel

Looking back at more historic versions of vm_page.c the comment regarding locking of maps and deadlocking has been present for much longer than I realised and is perhaps unrelated to the recent alterations as I had supposed.

Anyway, here are the contextual diffs as requested:

diff -u git/gnumach/kern/slab.c gnumach/kern/slab.c
--- ./git/gnumach/kern/slab.c   2025-05-27 10:13:48.422454969 +0100
+++ gnumach/kern/slab.c 2025-05-27 10:31:48.257755655 +0100
@@ -366,13 +366,20 @@
 static vm_offset_t
 kmem_pagealloc_physmem(vm_size_t size)
 {
+    thread_t thread = current_thread();
     struct vm_page *page;

     assert(size == PAGE_SIZE);

     for (;;) {
+       if (thread)
+           thread->vm_privilege++;
+
         page = vm_page_grab(VM_PAGE_DIRECTMAP);

+       if (thread)
+           thread->vm_privilege--;
+
         if (page != NULL)
             break;

diff -u git/gnumach/vm/vm_page.c gnumach/vm/vm_page.c
--- ./git/gnumach/vm/vm_page.c  2025-05-27 10:13:48.518453877 +0100
+++ gnumach/vm/vm_page.c        2025-05-27 14:37:19.675842175 +0100
@@ -368,10 +368,7 @@

     assert(order < VM_PAGE_NR_FREE_LISTS);

-    if (vm_page_alloc_paused && current_thread()
-        && !current_thread()->vm_privilege) {
-        return NULL;
-    } else if (seg->nr_free_pages <= seg->low_free_pages) {
+    if (seg->nr_free_pages <= seg->low_free_pages) {
         vm_pageout_start();

         if ((seg->nr_free_pages <= seg->min_free_pages)
@@ -1136,6 +1133,7 @@
         current_task()->reactivations++;
         vm_page_unlock_queues();
         page = NULL;
+       object = NULL;
         goto restart;
     }

@@ -1210,15 +1208,15 @@
      * one unnecessarily.
      */

-    if (double_paging && !object->pager_initialized) {
+    if (!object->pager_initialized) {
         vm_object_collapse(object);
     }

-    if (double_paging && !object->pager_initialized) {
+    if (!object->pager_initialized) {
         vm_object_pager_create(object);
     }

-    if (double_paging && !object->pager_initialized) {
+    if (!object->pager_initialized) {
         panic("vm_page_seg_evict");
     }


Reply to: