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

Re: [Xen-devel] [PATCH v2 2/5] tasklet: Add cross CPU feeding of per-cpu tasklets.



>>> On 25.08.16 at 21:23, <konrad.wilk@xxxxxxxxxx> wrote:
> +static void percpu_tasklet_feed(void *arg)
> +{
> +    unsigned long flags;
> +    struct tasklet *t;
> +    struct list_head *dst_list;
> +    struct list_head *list = &__get_cpu_var(tasklet_feeder);
> +
> +    spin_lock_irqsave(&feeder_lock, flags);
> +
> +    if ( list_empty(list) )
> +        goto out;

Instead of this, how about e.g. initializing t to NULL above and ...

> +    while ( !list_empty(list) )
> +    {
> +        t = list_entry(list->next, struct tasklet, list);

[Intermediate note: list_first_entry(); I guess there also was at
least one such case in patch 1. Or perhaps even better
list_first_entry_or_null() and then this moved into the loop
condition.]

> +        BUG_ON(!t->is_percpu);
> +        list_del(&t->list);
> +
> +        dst_list = &__get_cpu_var(softirq_list);
> +        list_add_tail(&t->list, dst_list);
> +    }
> +    raise_softirq(TASKLET_SOFTIRQ_PERCPU);

... making this conditional upon t not being NULL? That would at
once ...

> +out:

... eliminate this label, which otherwise I would have to comment on.

Jan

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.