Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Bring down a fix from the "newlock" branch, slightl...



details:   https://anonhg.NetBSD.org/src/rev/cd4ce824a5fe
branches:  trunk
changeset: 534584:cd4ce824a5fe
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Tue Jul 30 01:41:00 2002 +0000

description:
Bring down a fix from the "newlock" branch, slightly modified:
* 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").
* 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 395ca3ef5a2f -r cd4ce824a5fe sys/kern/subr_pool.c
--- a/sys/kern/subr_pool.c      Mon Jul 29 22:54:38 2002 +0000
+++ b/sys/kern/subr_pool.c      Tue Jul 30 01:41:00 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr_pool.c,v 1.77 2002/07/11 17:18:48 matt Exp $      */
+/*     $NetBSD: subr_pool.c,v 1.78 2002/07/30 01:41:00 thorpej 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.77 2002/07/11 17:18:48 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.78 2002/07/30 01:41:00 thorpej 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