[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090110234352.GA20843@elte.hu>
Date: Sun, 11 Jan 2009 00:43:52 +0100
From: Ingo Molnar <mingo@...e.hu>
To: Joerg Roedel <joerg.roedel@....com>
Cc: linux-kernel@...r.kernel.org, mingo@...hat.com,
dwmw2@...radead.org, fujita.tomonori@....ntt.co.jp,
netdev@...r.kernel.org, iommu@...ts.linux-foundation.org
Subject: Re: [PATCH 04/16] dma-debug: add allocator code
* Joerg Roedel <joerg.roedel@....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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists