Source-Changes-HG archive

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

[src/netbsd-1-6]: src/sys/kern Pull up revision 1.78 (requested by thorpej in...



details:   https://anonhg.NetBSD.org/src/rev/09b294f60be4
branches:  netbsd-1-6
changeset: 529332:09b294f60be4
user:      he <he%NetBSD.org@localhost>
date:      Mon Nov 11 23:31:43 2002 +0000

description:
Pull up revision 1.78 (requested by thorpej in ticket #582):
  Bring down a fix from the "newlock" branch, slightly modified:
   o In pool_prime_page(), assert that the object being placed
     onto the free list meets the alignment constraints (that
     "ioff" within the object is aligned to "align").
   o In pool_init(), round up the object size to the alignment
     value (or ALIGN(1), if no special alignment is needed) so
     that the above invariant holds true.

diffstat:

 sys/kern/subr_pool.c |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (36 lines):

diff -r b4d487600237 -r 09b294f60be4 sys/kern/subr_pool.c
--- a/sys/kern/subr_pool.c      Mon Nov 11 23:28:02 2002 +0000
+++ b/sys/kern/subr_pool.c      Mon Nov 11 23:31:43 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr_pool.c,v 1.76 2002/03/13 10:57:18 simonb Exp $    */
+/*     $NetBSD: subr_pool.c,v 1.76.6.1 2002/11/11 23:31:43 he Exp $    */
 
 /*-
  * Copyright (c) 1997, 1999, 2000 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.76 2002/03/13 10:57:18 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.76.6.1 2002/11/11 23:31:43 he Exp $");
 
 #include "opt_pool.h"
 #include "opt_poollog.h"
@@ -415,7 +415,7 @@
        if (size < sizeof(struct pool_item))
                size = sizeof(struct pool_item);
 
-       size = ALIGN(size);
+       size = roundup(size, align);
 #ifdef DIAGNOSTIC
        if (size > palloc->pa_pagesz)
                panic("pool_init: pool item size (%lu) too large",
@@ -1125,6 +1125,8 @@
        while (n--) {
                pi = (struct pool_item *)cp;
 
+               KASSERT(((((vaddr_t)pi) + ioff) & (align - 1)) == 0);
+
                /* Insert on page list */
                TAILQ_INSERT_TAIL(&ph->ph_itemlist, pi, pi_list);
 #ifdef DIAGNOSTIC



Home | Main Index | Thread Index | Old Index