Source-Changes-HG archive

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

[src/trunk]: src/sys/uvm If a pager fault method returns ENOMEM but some memo...



details:   https://anonhg.NetBSD.org/src/rev/5dc856655267
branches:  trunk
changeset: 998564:5dc856655267
user:      chs <chs%NetBSD.org@localhost>
date:      Sun Apr 21 15:27:59 2019 +0000

description:
If a pager fault method returns ENOMEM but some memory appears to be reclaimable,
wake up the pagedaemon and retry the fault.  This fixes the problems with Xorg
being killed with an "out of swap" message due to a transient memory shortage.

diffstat:

 sys/uvm/uvm_fault.c |  14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diffs (35 lines):

diff -r c206fce0be0e -r 5dc856655267 sys/uvm/uvm_fault.c
--- a/sys/uvm/uvm_fault.c       Sun Apr 21 14:14:14 2019 +0000
+++ b/sys/uvm/uvm_fault.c       Sun Apr 21 15:27:59 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_fault.c,v 1.204 2018/05/08 19:33:57 christos Exp $ */
+/*     $NetBSD: uvm_fault.c,v 1.205 2019/04/21 15:27:59 chs Exp $      */
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.204 2018/05/08 19:33:57 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.205 2019/04/21 15:27:59 chs Exp $");
 
 #include "opt_uvmhist.h"
 
@@ -901,6 +901,16 @@
                                 * object fault routine responsible for
                                 * pmap_update().
                                 */
+
+                               /*
+                                * Wake up the pagedaemon if the fault method
+                                * failed for lack of memory but some can be
+                                * reclaimed.
+                                */
+                               if (error == ENOMEM && uvm_reclaimable()) {
+                                       uvm_wait("pgo_fault");
+                                       error = ERESTART;
+                               }
                        } else {
                                error = uvm_fault_lower(&ufi, &flt, pages);
                        }



Home | Main Index | Thread Index | Old Index