Source-Changes-HG archive

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

[src/trunk]: src/lib/libperfuse Make sure perfused remains locked in memory, ...



details:   https://anonhg.NetBSD.org/src/rev/55ec8ebbf996
branches:  trunk
changeset: 769427:55ec8ebbf996
user:      manu <manu%NetBSD.org@localhost>
date:      Fri Sep 09 15:35:22 2011 +0000

description:
Make sure perfused remains locked in memory, otherwise we can get
deadlocks in low memory situations, where ioflush waits for perfused
to fsync vnodes, and perfused waits for memory to be freed.

diffstat:

 lib/libperfuse/perfuse.c |  10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diffs (31 lines):

diff -r 726b6a1fb4e0 -r 55ec8ebbf996 lib/libperfuse/perfuse.c
--- a/lib/libperfuse/perfuse.c  Fri Sep 09 14:29:47 2011 +0000
+++ b/lib/libperfuse/perfuse.c  Fri Sep 09 15:35:22 2011 +0000
@@ -1,4 +1,4 @@
-/*  $NetBSD: perfuse.c,v 1.18 2011/08/13 23:12:15 christos Exp $ */
+/*  $NetBSD: perfuse.c,v 1.19 2011/09/09 15:35:22 manu Exp $ */
 
 /*-
  *  Copyright (c) 2010-2011 Emmanuel Dreyfus. All rights reserved.
@@ -33,6 +33,7 @@
 #include <errno.h>
 #include <puffs.h>
 #include <sys/types.h>
+#include <sys/mman.h>
 #include <sys/socket.h>
 #include <sys/extattr.h>
 #include <sys/un.h>
@@ -407,6 +408,13 @@
        struct puffs_node *pn_root;
        struct puffs_pathobj *po_root;
 
+       /*
+        * perfused needs to remain in memory. If it gets
+        * swapped out, the kernel will deadlock when trying
+        * to free memory backed by the PUFFS filesystem
+        */
+       mlockall(MCL_CURRENT|MCL_FUTURE);
+
        ps = init_state();
        ps->ps_owner_uid = pmi->pmi_uid;
 



Home | Main Index | Thread Index | Old Index