[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.60.4.2 and 1.61

version 1.60.4.2, 2001/10/11 00:02:31 version 1.61, 2001/09/26 07:14:56
Line 70  TAILQ_HEAD(,pool) pool_head = TAILQ_HEAD
Line 70  TAILQ_HEAD(,pool) pool_head = TAILQ_HEAD
 /* Private pool for page header structures */  /* Private pool for page header structures */
 static struct pool phpool;  static struct pool phpool;
   
 #ifdef POOL_SUBPAGE  
 /* Pool of subpages for use by normal pools. */  
 static struct pool psppool;  
 #endif  
   
 /* # of seconds to retain page after last use */  /* # of seconds to retain page after last use */
 int pool_inactive_time = 10;  int pool_inactive_time = 10;
   
Line 158  static void pool_prime_page(struct pool 
Line 153  static void pool_prime_page(struct pool 
                     struct pool_item_header *);                      struct pool_item_header *);
 static void     *pool_page_alloc(unsigned long, int, int);  static void     *pool_page_alloc(unsigned long, int, int);
 static void     pool_page_free(void *, unsigned long, int);  static void     pool_page_free(void *, unsigned long, int);
 #ifdef POOL_SUBPAGE  
 static void     *pool_subpage_alloc(unsigned long, int, int);  
 static void     pool_subpage_free(void *, unsigned long, int);  
 #endif  
   
 static void pool_print1(struct pool *, const char *,  static void pool_print1(struct pool *, const char *,
         void (*)(const char *, ...));          void (*)(const char *, ...));
Line 390  pool_init(struct pool *pp, size_t size, 
Line 381  pool_init(struct pool *pp, size_t 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 && release == NULL) {          if (alloc == NULL && release == NULL) {
 #ifdef POOL_SUBPAGE  
                 alloc = pool_subpage_alloc;  
                 release = pool_subpage_free;  
                 pagesz = POOL_SUBPAGE;  
 #else  
                 alloc = pool_page_alloc;                  alloc = pool_page_alloc;
                 release = pool_page_free;                  release = pool_page_free;
                 pagesz = PAGE_SIZE;     /* Rounds to PAGE_SIZE anyhow. */                  pagesz = PAGE_SIZE;     /* Rounds to PAGE_SIZE anyhow. */
 #endif  
         } else if ((alloc != NULL && release != NULL) == 0) {          } else if ((alloc != NULL && release != NULL) == 0) {
                 /* If you specifiy one, must specify both. */                  /* If you specifiy one, must specify both. */
                 panic("pool_init: must specify alloc and release together");                  panic("pool_init: must specify alloc and release together");
         }          }
 #ifdef POOL_SUBPAGE  
         else if (alloc == pool_page_alloc_nointr &&  
             release == pool_page_free_nointr)  
                 pagesz = POOL_SUBPAGE;  
 #endif  
   
         if (pagesz == 0)          if (pagesz == 0)
                 pagesz = PAGE_SIZE;                  pagesz = PAGE_SIZE;
Line 523  pool_init(struct pool *pp, size_t size, 
Line 503  pool_init(struct pool *pp, size_t size, 
          * XXX LOCKING.           * XXX LOCKING.
          */           */
         if (phpool.pr_size == 0) {          if (phpool.pr_size == 0) {
 #ifdef POOL_SUBPAGE  
                 pool_init(&phpool, sizeof(struct pool_item_header), 0, 0, 0,  
                     "phpool", PAGE_SIZE, pool_page_alloc, pool_page_free, 0);  
                 pool_init(&psppool, POOL_SUBPAGE, POOL_SUBPAGE, 0,  
                     PR_RECURSIVE, "psppool", PAGE_SIZE,  
                     pool_page_alloc, pool_page_free, 0);  
 #else  
                 pool_init(&phpool, sizeof(struct pool_item_header), 0, 0,                  pool_init(&phpool, sizeof(struct pool_item_header), 0, 0,
                     0, "phpool", 0, 0, 0, 0);                      0, "phpool", 0, 0, 0, 0);
 #endif  
                 pool_init(&pcgpool, sizeof(struct pool_cache_group), 0, 0,                  pool_init(&pcgpool, sizeof(struct pool_cache_group), 0, 0,
                     0, "pcgpool", 0, 0, 0, 0);                      0, "pcgpool", 0, 0, 0, 0);
         }          }
Line 1257  pool_page_free(void *v, unsigned long sz
Line 1229  pool_page_free(void *v, unsigned long sz
         uvm_km_free_poolpage((vaddr_t)v);          uvm_km_free_poolpage((vaddr_t)v);
 }  }
   
 #ifdef POOL_SUBPAGE  
 /*  
  * Sub-page allocator, for machines with large hardware pages.  
  */  
 static void *  
 pool_subpage_alloc(unsigned long sz, int flags, int mtype)  
 {  
   
         return pool_get(&psppool, flags);  
 }  
   
 static void  
 pool_subpage_free(void *v, unsigned long sz, int mtype)  
 {  
   
         pool_put(&psppool, v);  
 }  
 #endif  
   
 #ifdef POOL_SUBPAGE  
 /* We don't provide a real nointr allocator.  Maybe later. */  
 void *  
 pool_page_alloc_nointr(unsigned long sz, int flags, int mtype)  
 {  
   
         return pool_subpage_alloc(sz, flags, mtype);  
 }  
   
 void  
 pool_page_free_nointr(void *v, unsigned long sz, int mtype)  
 {  
   
         pool_subpage_free(v, sz, mtype);  
 }  
 #else  
 /*  /*
  * Alternate pool page allocator for pools that know they will   * Alternate pool page allocator for pools that know they will
  * never be accessed in interrupt context.   * never be accessed in interrupt context.
Line 1311  pool_page_free_nointr(void *v, unsigned 
Line 1248  pool_page_free_nointr(void *v, unsigned 
   
         uvm_km_free_poolpage1(kernel_map, (vaddr_t)v);          uvm_km_free_poolpage1(kernel_map, (vaddr_t)v);
 }  }
 #endif  
   
   
 /*  /*

Legend:
Removed from v.1.60.4.2  
changed lines
  Added in v.1.61

CVSweb <webmaster@jp.NetBSD.org>