Source-Changes-D archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/sys



David Young <dyoung%pobox.com@localhost> wrote:
> > > It seems that pmf_event_inject() is called from interrupt context, from
> > > which kmem(9) cannot be used. You probably want to use pool_cache(9), or
> > > perhaps avoid allocations at all (since they are not intensive).
> > > 
> > 
> > Are you planning to fix it? It should probably be reverted, if takes a
> > while.
> 
> How is this for a fix?  I haven't run-tested this, yet.

Looks good in general, but few things I would do differently:

> +pmf_event_workitem_put(pmf_event_workitem_t *pew)
> +{
> +     KASSERT(pew != NULL);
> +     mutex_enter(&pew_mtx);
> +     SIMPLEQ_INSERT_HEAD(&pew_list, pew, pew_next_free);
> +     mutex_exit(&pew_mtx);
> +}

You can memset() here before locking, so there will be no need to do that
in pmf_event_workitem_get() with lock held.

> +
> +     for (i = __arraycount(pew_array); --i >= 0; )
> +             SIMPLEQ_INSERT_HEAD(&pew_list, &pew_array[i], pew_next_free);

Instead of array, I would use kmem_zalloc() and size changeable via sysctl.
If memory gets exhausted in some workload, size could be easily bumped.

> Dave
> 

-- 
Mindaugas


Home | Main Index | Thread Index | Old Index