Re: Take lock only once in dma_pool_free()

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Andrew Morton
Date: Tuesday, January 4, 2011 - 1:37 pm

On Mon, 20 Dec 2010 18:03:06 +0100
Rolf Eike Beer <eike-kernel@sf-tec.de> wrote:


Fair enough, I guess.


You have some wordwrapping there.


It's a bit scary that the code is playing with the dma_page outside the
lock, but I guess the refcounting takes care of that.  As does the
apparently-intentional leakiness of leaving a cache of pages around.

The use of TASK_INTERRUPTIBLE in dma_pool_alloc() looks like a bug -
the code will busywait if signal_pending().

--- a/mm/dmapool.c~a
+++ a/mm/dmapool.c
@@ -324,7 +324,7 @@ void *dma_pool_alloc(struct dma_pool *po
 		if (mem_flags & __GFP_WAIT) {
 			DECLARE_WAITQUEUE(wait, current);
 
-			__set_current_state(TASK_INTERRUPTIBLE);
+			__set_current_state(TASK_UNINTERRUPTIBLE);
 			__add_wait_queue(&pool->waitq, &wait);
 			spin_unlock_irqrestore(&pool->lock, flags);
 
_


--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Take lock only once in dma_pool_free(), Rolf Eike Beer, (Mon Dec 20, 10:03 am)
Re: Take lock only once in dma_pool_free(), Andrew Morton, (Tue Jan 4, 1:37 pm)