lkml.org 
[lkml]   [2009]   [Jan]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 04/16] dma-debug: add allocator code

* Joerg Roedel <joerg.roedel@amd.com> wrote:

> + printk(KERN_ERR "DMA-API: debugging out of memory "
> + "- disabling\n");

btw., i'd suggest to not break kernel messages mid-string, but do
something like this instead:

> + printk(KERN_ERR
"DMA-API: debugging out of memory - disabling\n");

Also, i'd use WARN() - it might be useful to see what callsite depleted
the pool.

> + entry = list_entry(free_entries.next, struct dma_debug_entry, list);
> + list_del(&entry->list);
> + memset(entry, 0, sizeof(*entry));
> +
> + num_free_entries -= 1;
> + if (num_free_entries < min_free_entries)
> + min_free_entries = num_free_entries;

unlikely() i guess.

Regarding the entry pool locking:

> +static void dma_entry_free(struct dma_debug_entry *entry)
> +{
> + unsigned long flags;
> +
> + /*
> + * add to beginning of the list - this way the entries are
> + * more likely cache hot when they are reallocated.
> + */
> + spin_lock_irqsave(&free_entries_lock, flags);
> + list_add(&entry->list, &free_entries);
> + num_free_entries += 1;
> + spin_unlock_irqrestore(&free_entries_lock, flags);

it might make sense to cache entries in the buckets - hence reuse the
bucket spinlock. This means a somewhat higher effective pool size, but it
also avoids a global lock.

Ingo


\
 
 \ /
  Last update: 2009-01-11 00:47    [W:1.503 / U:0.084 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site