[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.198 and 1.198.2.2

version 1.198, 2012/08/28 15:52:19 version 1.198.2.2, 2013/06/23 06:18:58
Line 203  static void *pool_allocator_alloc(struct
Line 203  static void *pool_allocator_alloc(struct
 static void     pool_allocator_free(struct pool *, void *);  static void     pool_allocator_free(struct pool *, void *);
   
 static void pool_print_pagelist(struct pool *, struct pool_pagelist *,  static void pool_print_pagelist(struct pool *, struct pool_pagelist *,
         void (*)(const char *, ...));          void (*)(const char *, ...) __printflike(1, 2));
 static void pool_print1(struct pool *, const char *,  static void pool_print1(struct pool *, const char *,
         void (*)(const char *, ...));          void (*)(const char *, ...) __printflike(1, 2));
   
 static int pool_chk_page(struct pool *, const char *,  static int pool_chk_page(struct pool *, const char *,
                          struct pool_item_header *);                           struct pool_item_header *);
Line 2261  pool_cache_get_paddr(pool_cache_t pc, in
Line 2261  pool_cache_get_paddr(pool_cache_t pc, in
 static bool __noinline  static bool __noinline
 pool_cache_put_slow(pool_cache_cpu_t *cc, int s, void *object)  pool_cache_put_slow(pool_cache_cpu_t *cc, int s, void *object)
 {  {
           struct lwp *l = curlwp;
         pcg_t *pcg, *cur;          pcg_t *pcg, *cur;
         uint64_t ncsw;          uint64_t ncsw;
         pool_cache_t pc;          pool_cache_t pc;
Line 2271  pool_cache_put_slow(pool_cache_cpu_t *cc
Line 2272  pool_cache_put_slow(pool_cache_cpu_t *cc
         pc = cc->cc_cache;          pc = cc->cc_cache;
         pcg = NULL;          pcg = NULL;
         cc->cc_misses++;          cc->cc_misses++;
           ncsw = l->l_ncsw;
   
         /*          /*
          * If there are no empty groups in the cache then allocate one           * If there are no empty groups in the cache then allocate one
Line 2280  pool_cache_put_slow(pool_cache_cpu_t *cc
Line 2282  pool_cache_put_slow(pool_cache_cpu_t *cc
                 if (__predict_true(!pool_cache_disable)) {                  if (__predict_true(!pool_cache_disable)) {
                         pcg = pool_get(pc->pc_pcgpool, PR_NOWAIT);                          pcg = pool_get(pc->pc_pcgpool, PR_NOWAIT);
                 }                  }
                   /*
                    * If pool_get() blocked, then our view of
                    * the per-CPU data is invalid: retry.
                    */
                   if (__predict_false(l->l_ncsw != ncsw)) {
                           if (pcg != NULL) {
                                   pool_put(pc->pc_pcgpool, pcg);
                           }
                           return true;
                   }
                 if (__predict_true(pcg != NULL)) {                  if (__predict_true(pcg != NULL)) {
                         pcg->pcg_avail = 0;                          pcg->pcg_avail = 0;
                         pcg->pcg_size = pc->pc_pcgsize;                          pcg->pcg_size = pc->pc_pcgsize;
Line 2288  pool_cache_put_slow(pool_cache_cpu_t *cc
Line 2300  pool_cache_put_slow(pool_cache_cpu_t *cc
   
         /* Lock the cache. */          /* Lock the cache. */
         if (__predict_false(!mutex_tryenter(&pc->pc_lock))) {          if (__predict_false(!mutex_tryenter(&pc->pc_lock))) {
                 ncsw = curlwp->l_ncsw;  
                 mutex_enter(&pc->pc_lock);                  mutex_enter(&pc->pc_lock);
                 pc->pc_contended++;                  pc->pc_contended++;
   
Line 2296  pool_cache_put_slow(pool_cache_cpu_t *cc
Line 2307  pool_cache_put_slow(pool_cache_cpu_t *cc
                  * If we context switched while locking, then our view of                   * If we context switched while locking, then our view of
                  * the per-CPU data is invalid: retry.                   * the per-CPU data is invalid: retry.
                  */                   */
                 if (__predict_false(curlwp->l_ncsw != ncsw)) {                  if (__predict_false(l->l_ncsw != ncsw)) {
                         mutex_exit(&pc->pc_lock);                          mutex_exit(&pc->pc_lock);
                         if (pcg != NULL) {                          if (pcg != NULL) {
                                 pool_put(pc->pc_pcgpool, pcg);                                  pool_put(pc->pc_pcgpool, pcg);

Legend:
Removed from v.1.198  
changed lines
  Added in v.1.198.2.2

CVSweb <webmaster@jp.NetBSD.org>