[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4DD353E9.6020503@jp.fujitsu.com>
Date: Wed, 18 May 2011 14:06:49 +0900
From: KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>
To: john.stultz@...aro.org
CC: linux-kernel@...r.kernel.org, joe@...ches.com, mingo@...e.hu,
mina86@...a86.com, apw@...onical.com, jirislaby@...il.com,
rientjes@...gle.com, dave@...ux.vnet.ibm.com,
akpm@...ux-foundation.org, linux-mm@...ck.org
Subject: Re: [PATCH 1/4] comm: Introduce comm_lock spinlock to protect task->comm
access
>> If we provide __get_task_comm(), we can't remove memset() forever.
>
> True enough. I'll fix that comment up then.
>
>>
>>> task_lock(tsk);
>>> + spin_lock_irqsave(&tsk->comm_lock, flags);
>>
>> This is strange order. task_lock() doesn't disable interrupt.
>
> Strange order? Can you explain why you think that is? Having comm_lock
> as an inner-most lock seems quite reasonable, given the limited nature
> of what it protects.
spinlock -> irq_disable is wrong order.
local_irq_save()
task_lock()
spin_lock(task->comm)
is better. I think.
I mean if the task get interrupt at following point,
task_lock(tsk);
// HERE
spin_lock_irqsave(&tsk->comm_lock, flags);
the task hold task-lock long time rather than expected.
>> And, can you please document why we need interrupt disabling?
>
> Since we might access current->comm from irq context. Where would you
> like this documented? Just there in the code?
I'm prefer code comment. but another way is also good.
Thanks.
--
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