Source-Changes-HG archive

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

[src/netbsd-1-5]: src/sys/uvm Pullup 1.82 [thorpej]:



details:   https://anonhg.NetBSD.org/src/rev/30fca16fa327
branches:  netbsd-1-5
changeset: 489740:30fca16fa327
user:      tv <tv%NetBSD.org@localhost>
date:      Mon Oct 16 22:02:17 2000 +0000

description:
Pullup 1.82 [thorpej]:
- Change SAVE_HINT() to take a "check" value.  This value is compared
  to the contents of the hint in the map, and the hint saved in the
  map only if the two values match.  When an unconditional save is
  required, the "check" value passed should be map->hint (and the
  compiler will optimize the test away).  When deleting a map entry,
  the new SAVE_HINT() will only change the hint if the entry being
  deleted was the hint value (thus preserving any meaningful hint
  that may have been there previously, rather than stomping on it).
- Add a missing hint update when deleting the map entry in
  uvm_map_entry_unlink().  This is the fix for kern/11125, from
  ITOH Yasufumi <itohy%netbsd.org@localhost>.

diffstat:

 sys/uvm/uvm_map.c |  27 ++++++++++++++++-----------
 1 files changed, 16 insertions(+), 11 deletions(-)

diffs (105 lines):

diff -r 79180ec60bb6 -r 30fca16fa327 sys/uvm/uvm_map.c
--- a/sys/uvm/uvm_map.c Mon Oct 16 21:53:27 2000 +0000
+++ b/sys/uvm/uvm_map.c Mon Oct 16 22:02:17 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_map.c,v 1.77.2.1 2000/08/06 00:11:24 fvdl Exp $    */
+/*     $NetBSD: uvm_map.c,v 1.77.2.2 2000/10/16 22:02:17 tv Exp $      */
 
 /* 
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -156,9 +156,10 @@
  *
  * => map need not be locked (protected by hint_lock).
  */
-#define SAVE_HINT(map,value) do { \
+#define SAVE_HINT(map,check,value) do { \
        simple_lock(&(map)->hint_lock); \
-       (map)->hint = (value); \
+       if ((map)->hint == (check)) \
+               (map)->hint = (value); \
        simple_unlock(&(map)->hint_lock); \
 } while (0)
 
@@ -767,7 +768,7 @@
                                 */
 
                                *entry = cur;
-                               SAVE_HINT(map, cur);
+                               SAVE_HINT(map, map->hint, cur);
                                UVMHIST_LOG(maphist,"<- search got it (0x%x)",
                                        cur, 0, 0, 0);
                                return (TRUE);
@@ -777,7 +778,7 @@
                cur = cur->next;
        }
        *entry = cur->prev;
-       SAVE_HINT(map, *entry);
+       SAVE_HINT(map, map->hint, *entry);
        UVMHIST_LOG(maphist,"<- failed!",0,0,0,0);
        return (FALSE);
 }
@@ -883,7 +884,7 @@
                        return(NULL); /* only one shot at it ... */
                }
        }
-       SAVE_HINT(map, entry);
+       SAVE_HINT(map, map->hint, entry);
        *result = hint;
        UVMHIST_LOG(maphist,"<- got it!  (result=0x%x)", hint, 0,0,0);
        return (entry);
@@ -926,7 +927,7 @@
                entry = first_entry;
                UVM_MAP_CLIP_START(map, entry, start);
                /* critical!  prevents stale hint */
-               SAVE_HINT(map, entry->prev);
+               SAVE_HINT(map, entry, entry->prev);
 
        } else {
                entry = first_entry->next;
@@ -1056,6 +1057,10 @@
                 * that we've nuked.  then go do next entry.
                 */
                UVMHIST_LOG(maphist, "  removed map entry 0x%x", entry, 0, 0,0);
+
+               /* critical!  prevents stale hint */
+               SAVE_HINT(map, entry, entry->prev);
+
                uvm_map_entry_unlink(map, entry);
                map->size -= len;
                entry->next = first_entry;
@@ -1267,7 +1272,7 @@
                last = newents->prev;           /* we expect this */
 
                /* critical: flush stale hints out of map */
-               SAVE_HINT(map, newents);
+               SAVE_HINT(map, map->hint, newents);
                if (map->first_free == oldent)
                        map->first_free = last;
 
@@ -1280,7 +1285,7 @@
        } else {
 
                /* critical: flush stale hints out of map */
-               SAVE_HINT(map, oldent->prev);
+               SAVE_HINT(map, map->hint, oldent->prev);
                if (map->first_free == oldent)
                        map->first_free = oldent->prev;
 
@@ -1388,7 +1393,7 @@
                         * fudge is zero)
                         */
                        UVM_MAP_CLIP_START(srcmap, entry, start);
-                       SAVE_HINT(srcmap, entry->prev);
+                       SAVE_HINT(srcmap, srcmap->hint, entry->prev);
                        fudge = 0;
                }
 
@@ -1547,7 +1552,7 @@
 
                /* purge possible stale hints from srcmap */
                if (flags & UVM_EXTRACT_REMOVE) {
-                       SAVE_HINT(srcmap, orig_entry->prev);
+                       SAVE_HINT(srcmap, srcmap->hint, orig_entry->prev);
                        if (srcmap->first_free->start >= start)
                                srcmap->first_free = orig_entry->prev;
                }



Home | Main Index | Thread Index | Old Index