version 1.218, 2017/12/04 03:05:24 |
version 1.219, 2017/12/16 03:13:29 |
Line 1073 pool_grow(struct pool *pp, int flags) |
|
Line 1073 pool_grow(struct pool *pp, int flags) |
|
} while (pp->pr_flags & PR_GROWING); |
} while (pp->pr_flags & PR_GROWING); |
return ERESTART; |
return ERESTART; |
} else { |
} else { |
|
if (pp->pr_flags & PR_GROWINGNOWAIT) { |
|
/* |
|
* This needs an unlock/relock dance so |
|
* that the other caller has a chance to |
|
* run and actually do the thing. Note |
|
* that this is effectively a busy-wait. |
|
*/ |
|
mutex_exit(&pp->pr_lock); |
|
mutex_enter(&pp->pr_lock); |
|
return ERESTART; |
|
} |
return EWOULDBLOCK; |
return EWOULDBLOCK; |
} |
} |
} |
} |
pp->pr_flags |= PR_GROWING; |
pp->pr_flags |= PR_GROWING; |
|
if ((flags & PR_WAITOK) == 0) |
|
pp->pr_flags |= PR_GROWINGNOWAIT; |
|
|
mutex_exit(&pp->pr_lock); |
mutex_exit(&pp->pr_lock); |
char *cp = pool_allocator_alloc(pp, flags); |
char *cp = pool_allocator_alloc(pp, flags); |
Line 1093 pool_grow(struct pool *pp, int flags) |
|
Line 1106 pool_grow(struct pool *pp, int flags) |
|
pool_prime_page(pp, cp, ph); |
pool_prime_page(pp, cp, ph); |
pp->pr_npagealloc++; |
pp->pr_npagealloc++; |
KASSERT(pp->pr_flags & PR_GROWING); |
KASSERT(pp->pr_flags & PR_GROWING); |
pp->pr_flags &= ~PR_GROWING; |
pp->pr_flags &= ~(PR_GROWING|PR_GROWINGNOWAIT); |
/* |
/* |
* If anyone was waiting for pool_grow, notify them that we |
* If anyone was waiting for pool_grow, notify them that we |
* may have just done it. |
* may have just done it. |
Line 1102 pool_grow(struct pool *pp, int flags) |
|
Line 1115 pool_grow(struct pool *pp, int flags) |
|
return 0; |
return 0; |
out: |
out: |
KASSERT(pp->pr_flags & PR_GROWING); |
KASSERT(pp->pr_flags & PR_GROWING); |
pp->pr_flags &= ~PR_GROWING; |
pp->pr_flags &= ~(PR_GROWING|PR_GROWINGNOWAIT); |
mutex_enter(&pp->pr_lock); |
mutex_enter(&pp->pr_lock); |
return ENOMEM; |
return ENOMEM; |
} |
} |