[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.5 and 1.13

version 1.5, 1998/07/31 21:55:09 version 1.13, 1998/09/12 17:20:02
Line 17 
Line 17 
  *    documentation and/or other materials provided with the distribution.   *    documentation and/or other materials provided with the distribution.
  * 3. All advertising materials mentioning features or use of this software   * 3. All advertising materials mentioning features or use of this software
  *    must display the following acknowledgement:   *    must display the following acknowledgement:
  *        This product includes software developed by the NetBSD   *      This product includes software developed by the NetBSD
  *        Foundation, Inc. and its contributors.   *      Foundation, Inc. and its contributors.
  * 4. Neither the name of The NetBSD Foundation nor the names of its   * 4. Neither the name of The NetBSD Foundation nor the names of its
  *    contributors may be used to endorse or promote products derived   *    contributors may be used to endorse or promote products derived
  *    from this software without specific prior written permission.   *    from this software without specific prior written permission.
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 373  pool_init(pp, size, align, ioff, flags, 
Line 384  pool_init(pp, size, align, ioff, flags, 
                 /* The page header will be taken from our page header pool */                  /* The page header will be taken from our page header pool */
                 pp->pr_phoffset = 0;                  pp->pr_phoffset = 0;
                 off = pagesz;                  off = pagesz;
                 bzero(pp->pr_hashtab, sizeof(pp->pr_hashtab));                  memset(pp->pr_hashtab, 0, sizeof(pp->pr_hashtab));
         }          }
   
         /*          /*
Line 400  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 541  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 623  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 730  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 808  pool_page_alloc(sz, flags, mtype)
Line 830  pool_page_alloc(sz, flags, mtype)
         int flags;          int flags;
         int mtype;          int mtype;
 {  {
           boolean_t waitok = (flags & PR_WAITOK) ? TRUE : FALSE;
   
 #if defined(UVM)  #if defined(UVM)
         return ((void *)uvm_km_alloc_poolpage());          return ((void *)uvm_km_alloc_poolpage(waitok));
 #else  #else
         return ((void *)kmem_alloc_poolpage());          return ((void *)kmem_alloc_poolpage(waitok));
 #endif  #endif
 }  }
   
Line 824  pool_page_free(v, sz, mtype)
Line 847  pool_page_free(v, sz, mtype)
 {  {
   
 #if defined(UVM)  #if defined(UVM)
         uvm_km_free_poolpage((vm_offset_t)v);          uvm_km_free_poolpage((vaddr_t)v);
 #else  #else
         kmem_free_poolpage((vm_offset_t)v);          kmem_free_poolpage((vaddr_t)v);
 #endif  #endif
 }  }
   
 /*  /*
    * Alternate pool page allocator for pools that know they will
    * never be accessed in interrupt context.
    */
   void *
   pool_page_alloc_nointr(sz, flags, mtype)
           unsigned long sz;
           int flags;
           int mtype;
   {
   #if defined(UVM)
           boolean_t waitok = (flags & PR_WAITOK) ? TRUE : FALSE;
   
           /*
            * With UVM, we can use the kernel_map.
            */
           return ((void *)uvm_km_alloc_poolpage1(kernel_map, uvm.kernel_object,
               waitok));
   #else
           /*
            * Can't do anything so cool with Mach VM.
            */
           return (pool_page_alloc(sz, flags, mtype));
   #endif
   }
   
   void
   pool_page_free_nointr(v, sz, mtype)
           void *v;
           unsigned long sz;
           int mtype;
   {
   
   #if defined(UVM)
           uvm_km_free_poolpage1(kernel_map, (vaddr_t)v);
   #else
           pool_page_free(v, sz, mtype);
   #endif
   }
   
   
   /*
  * Release all complete pages that have not been used recently.   * Release all complete pages that have not been used recently.
  */   */
 void  void
Line 905  pool_print(pp, label)
Line 969  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 979  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.5  
changed lines
  Added in v.1.13

CVSweb <webmaster@jp.NetBSD.org>