lkml.org 
[lkml]   [2006]   [May]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/9] [I/OAT] DMA memcpy subsystem
Chris Leech <christopher.leech@intel.com> wrote:
>
> +/**
> + * dma_client_chan_free - release a DMA channel
> + * @chan: &dma_chan
> + */
> +void dma_chan_cleanup(struct kref *kref)
> +{
> + struct dma_chan *chan = container_of(kref, struct dma_chan, refcount);
> + chan->device->device_free_chan_resources(chan);
> + chan->client = NULL;
> + kref_put(&chan->device->refcount, dma_async_device_cleanup);
> +}
> +
> +static void dma_chan_free_rcu(struct rcu_head *rcu)
> +{
> + struct dma_chan *chan = container_of(rcu, struct dma_chan, rcu);
> + int bias = 0x7FFFFFFF;
> + int i;
> + for_each_cpu(i)
> + bias -= local_read(&per_cpu_ptr(chan->local, i)->refcount);
> + atomic_sub(bias, &chan->refcount.refcount);
> + kref_put(&chan->refcount, dma_chan_cleanup);
> +}
> +
> +static void dma_client_chan_free(struct dma_chan *chan)
> +{
> + atomic_add(0x7FFFFFFF, &chan->refcount.refcount);
> + chan->slow_ref = 1;
> + call_rcu(&chan->rcu, dma_chan_free_rcu);
> +}

A comment describing this `bias' magic would be nice.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-05-24 02:53    [W:1.710 / U:0.100 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site