On Sun, 3 Apr 2011, Theo de Raadt wrote:

> based on a conversation at the bar.
> 
> POOL_DEBUG is expensive.  But we really want it because it finds bugs
> before they hurt us. The solution to this is to make it simpler to
> turn off.

Is it expensive because it tests every pool entry? Could it be made
cheaper by only checking the adjacent (+/- 1) entries on get/put?

> +     if (ph->ph_magic) {
> +             for (ip = (int *)pi, i = sizeof(*pi)/sizeof(int);

Shouldn't this be (pool_debug && ph->ph_magic)? Otherwise it will trigger
checking for entries left in the pool from before sysctl is reset.

> -             for (ip = (int *)pi, i = sizeof(*pi)/sizeof(int);
> -                 i < pp->pr_size / sizeof(int); i++)
> -                     ip[i] = PI_MAGIC;
> +             if (ph->ph_magic) {
> +                     for (ip = (int *)pi, i = sizeof(*pi)/sizeof(int);
> +                         i < pp->pr_size / sizeof(int); i++)
> +                             ip[i] = ph->ph_magic;

ditto.

Reply via email to