Source-Changes-HG archive

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

[src/trunk]: src/regress/sys/uvm/mmap Explain why we can expect to have some ...



details:   https://anonhg.NetBSD.org/src/rev/2fbe011a0ef4
branches:  trunk
changeset: 486329:2fbe011a0ef4
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Fri May 19 04:56:48 2000 +0000

description:
Explain why we can expect to have some resident pages even after an
MADV_FREE of a range in e.g. a SYSV SHM segment, and make such a
condition not a failure of the regression test.

Addresses kern/10115, submitted by Thomas Klausner.

diffstat:

 regress/sys/uvm/mmap/mmap.c |  22 +++++++++++++++++-----
 1 files changed, 17 insertions(+), 5 deletions(-)

diffs (36 lines):

diff -r e867b6056ef3 -r 2fbe011a0ef4 regress/sys/uvm/mmap/mmap.c
--- a/regress/sys/uvm/mmap/mmap.c       Fri May 19 04:53:25 2000 +0000
+++ b/regress/sys/uvm/mmap/mmap.c       Fri May 19 04:56:48 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mmap.c,v 1.10 2000/01/24 00:39:17 mycroft Exp $        */
+/*     $NetBSD: mmap.c,v 1.11 2000/05/19 04:56:48 thorpej Exp $        */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -371,10 +371,22 @@
 
        printf("    CHECKING RESIDENCY\n");
 
-       if (check_residency(addr, npgs) != 0) {
-               printf("    RESIDENCY CHECK FAILED!\n");
-               ecode = 1;
-       }
+       /*
+        * NOTE!  Even though we have MADV_FREE'd the range,
+        * there is another reference (the kernel's) to the
+        * object which owns the pages.  In this case, the
+        * kernel does not simply free the pages, as haphazardly
+        * freeing pages when there are still references to
+        * an object can cause data corruption (say, the other
+        * referencer doesn't expect the pages to be freed,
+        * and is surprised by the subsequent ZFOD).
+        *
+        * Because of this, we simply report the number of
+        * pages still resident, for information only.
+        */
+
+       npgs = check_residency(addr, npgs);
+       printf("    RESIDENCY CHECK: %d pages still resident\n", npgs);
 
        if (shmdt(addr) == -1)
                warn("shmdt");



Home | Main Index | Thread Index | Old Index