[BACK]Return to subr_pool.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / sys / kern

Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.

Diff for /src/sys/kern/subr_pool.c between version 1.3 and 1.8

version 1.3, 1998/07/23 20:34:00 version 1.8, 1998/08/02 19:07:47
Line 65 
Line 65 
  */   */
   
 /* List of all pools */  /* List of all pools */
 static TAILQ_HEAD(,pool) pool_head = TAILQ_HEAD_INITIALIZER(pool_head);  TAILQ_HEAD(,pool) pool_head = TAILQ_HEAD_INITIALIZER(pool_head);
   
 /* Private pool for page header structures */  /* Private pool for page header structures */
 static struct pool phpool;  static struct pool phpool;
Line 226  pr_rmpage(pp, ph)
Line 226  pr_rmpage(pp, ph)
 {  {
   
         /*          /*
            * If the page was idle, decrement the idle page count.
            */
           if (ph->ph_nmissing == 0) {
   #ifdef DIAGNOSTIC
                   if (pp->pr_nidle == 0)
                           panic("pr_rmpage: nidle inconsistent");
   #endif
                   pp->pr_nidle--;
           }
   
           /*
          * Unlink a page from the pool and release it.           * Unlink a page from the pool and release it.
          */           */
         TAILQ_REMOVE(&pp->pr_pagelist, ph, ph_pagelist);          TAILQ_REMOVE(&pp->pr_pagelist, ph, ph_pagelist);
Line 321  pool_init(pp, size, align, ioff, flags, 
Line 332  pool_init(pp, size, align, ioff, flags, 
         if (!powerof2(pagesz) || pagesz > PAGE_SIZE)          if (!powerof2(pagesz) || pagesz > PAGE_SIZE)
                 panic("pool_init: page size invalid (%lx)\n", (u_long)pagesz);                  panic("pool_init: page size invalid (%lx)\n", (u_long)pagesz);
   
         if (alloc == NULL)          if (alloc == NULL && release == NULL) {
                 alloc = pool_page_alloc;                  alloc = pool_page_alloc;
   
         if (release == NULL)  
                 release = pool_page_free;                  release = pool_page_free;
                   pagesz = PAGE_SIZE;     /* Rounds to PAGE_SIZE anyhow. */
           } else if ((alloc != NULL && release != NULL) == 0) {
                   /* If you specifiy one, must specify both. */
                   panic("pool_init: must specify alloc and release together");
           }
   
         if (pagesz == 0)          if (pagesz == 0)
                 pagesz = PAGE_SIZE;                  pagesz = PAGE_SIZE;
   
Line 397  pool_init(pp, size, align, ioff, flags, 
Line 411  pool_init(pp, size, align, ioff, flags, 
         pp->pr_npagealloc = 0;          pp->pr_npagealloc = 0;
         pp->pr_npagefree = 0;          pp->pr_npagefree = 0;
         pp->pr_hiwat = 0;          pp->pr_hiwat = 0;
           pp->pr_nidle = 0;
   
 #ifdef POOL_DIAGNOSTIC  #ifdef POOL_DIAGNOSTIC
         if ((flags & PR_LOGGING) != 0) {          if ((flags & PR_LOGGING) != 0) {
Line 538  again:
Line 553  again:
          * Remove from item list.           * Remove from item list.
          */           */
         TAILQ_REMOVE(&ph->ph_itemlist, pi, pi_list);          TAILQ_REMOVE(&ph->ph_itemlist, pi, pi_list);
           if (ph->ph_nmissing == 0) {
   #ifdef DIAGNOSTIC
                   if (pp->pr_nidle == 0)
                           panic("pool_get: nidle inconsistent");
   #endif
                   pp->pr_nidle--;
           }
         ph->ph_nmissing++;          ph->ph_nmissing++;
         if (TAILQ_FIRST(&ph->ph_itemlist) == NULL) {          if (TAILQ_FIRST(&ph->ph_itemlist) == NULL) {
                 /*                  /*
Line 620  pool_put(pp, v)
Line 642  pool_put(pp, v)
          * If this page has just become un-empty, move it the head.           * If this page has just become un-empty, move it the head.
          */           */
         if (ph->ph_nmissing == 0) {          if (ph->ph_nmissing == 0) {
                   pp->pr_nidle++;
                 if (pp->pr_npages > pp->pr_maxpages) {                  if (pp->pr_npages > pp->pr_maxpages) {
 #if 0  #if 0
                         timeout(pool_drain, 0, pool_inactive_time*hz);                          timeout(pool_drain, 0, pool_inactive_time*hz);
Line 727  pool_prime_page(pp, storage)
Line 750  pool_prime_page(pp, storage)
         ph->ph_nmissing = 0;          ph->ph_nmissing = 0;
         ph->ph_time.tv_sec = ph->ph_time.tv_usec = 0;          ph->ph_time.tv_sec = ph->ph_time.tv_usec = 0;
   
           pp->pr_nidle++;
   
         /*          /*
          * Color this page.           * Color this page.
          */           */
Line 805  pool_page_alloc(sz, flags, mtype)
Line 830  pool_page_alloc(sz, flags, mtype)
         int flags;          int flags;
         int mtype;          int mtype;
 {  {
         vm_offset_t va;  
   
 #if defined(UVM)  #if defined(UVM)
         va = uvm_km_kmemalloc(kernel_map, uvm.kernel_object,          return ((void *)uvm_km_alloc_poolpage());
                               (vm_size_t)sz, UVM_KMF_NOWAIT);  #else
 #else          return ((void *)kmem_alloc_poolpage());
         va = kmem_malloc(kmem_map, (vm_size_t)sz, 0);  #endif
 #endif  
         return ((void *)va);  
 }  }
   
 static void  static void
Line 824  pool_page_free(v, sz, mtype)
Line 846  pool_page_free(v, sz, mtype)
 {  {
   
 #if defined(UVM)  #if defined(UVM)
         uvm_km_free(kernel_map, (vm_offset_t)v, sz);          uvm_km_free_poolpage((vm_offset_t)v);
 #else  #else
         kmem_free(kmem_map, (vm_offset_t)v, sz);          kmem_free_poolpage((vm_offset_t)v);
 #endif  #endif
 }  }
   
Line 905  pool_print(pp, label)
Line 927  pool_print(pp, label)
                 printf("%s: ", label);                  printf("%s: ", label);
   
         printf("pool %s: nalloc %lu nfree %lu npagealloc %lu npagefree %lu\n"          printf("pool %s: nalloc %lu nfree %lu npagealloc %lu npagefree %lu\n"
                "         npages %u minitems %u itemsperpage %u itemoffset %u\n",                 "         npages %u minitems %u itemsperpage %u itemoffset %u\n"
                  "         nidle %lu\n",
                 pp->pr_wchan,                  pp->pr_wchan,
                 pp->pr_nget,                  pp->pr_nget,
                 pp->pr_nput,                  pp->pr_nput,
Line 914  pool_print(pp, label)
Line 937  pool_print(pp, label)
                 pp->pr_npages,                  pp->pr_npages,
                 pp->pr_minitems,                  pp->pr_minitems,
                 pp->pr_itemsperpage,                  pp->pr_itemsperpage,
                 pp->pr_itemoffset);                  pp->pr_itemoffset,
                   pp->pr_nidle);
 }  }
   
 int  int

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.8

CVSweb <webmaster@jp.NetBSD.org>