Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/x86/x86 Add comments.



details:   https://anonhg.NetBSD.org/src/rev/4182dfa89d35
branches:  trunk
changeset: 745028:4182dfa89d35
user:      maxv <maxv%NetBSD.org@localhost>
date:      Fri Feb 21 18:31:55 2020 +0000

description:
Add comments.

diffstat:

 sys/arch/x86/x86/pmap.c |  19 +++++++++++++++++--
 1 files changed, 17 insertions(+), 2 deletions(-)

diffs (57 lines):

diff -r 867859575c98 -r 4182dfa89d35 sys/arch/x86/x86/pmap.c
--- a/sys/arch/x86/x86/pmap.c   Fri Feb 21 15:15:48 2020 +0000
+++ b/sys/arch/x86/x86/pmap.c   Fri Feb 21 18:31:55 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.c,v 1.355 2020/01/12 13:01:11 ad Exp $    */
+/*     $NetBSD: pmap.c,v 1.356 2020/02/21 18:31:55 maxv Exp $  */
 
 /*
  * Copyright (c) 2008, 2010, 2016, 2017, 2019, 2020 The NetBSD Foundation, Inc.
@@ -130,7 +130,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.355 2020/01/12 13:01:11 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.356 2020/02/21 18:31:55 maxv Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -1258,6 +1258,17 @@
        vaddr_t startva, va;
 
        sz = roundup(sz, align);
+
+       /*
+        * Take one more slot with +NBPD_L4, because we may end up choosing
+        * an area that crosses slots:
+        *     +------+------+------+
+        *     | Slot | Slot | Slot |
+        *     +------+------+------+
+        *        [Chosen Area]
+        * And in that case we must take into account the additional slot
+        * consumed.
+        */
        nslots = roundup(sz+NBPD_L4, NBPD_L4) / NBPD_L4;
 
        /* Get the holes. */
@@ -1279,16 +1290,20 @@
                                minnslot = slotspace.area[i].nslot;
                        }
                }
+
+               /* No hole anymore, stop here. */
                if (minsslot == 512) {
                        break;
                }
 
+               /* Register the hole. */
                if (minsslot - curslot >= nslots) {
                        holes[nholes].start = curslot;
                        holes[nholes].end = minsslot;
                        nholes++;
                }
 
+               /* Skip that hole, and iterate again. */
                curslot = minsslot + minnslot;
        }
 



Home | Main Index | Thread Index | Old Index