lkml.org 
[lkml]   [2007]   [Sep]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: 2.6.23-rc6-mm1: IPC: sleeping function called ...
Jarek Poplawski wrote:
> On 18-09-2007 16:55, Nadia Derbey wrote:
> ...
>
>>Well, reviewing the code I found another place where the
>>rcu_read_unlock() was missing.
>>I'm so sorry for the inconvenience. It's true that I should have tested
>>with CONFIG_PREEMPT=y :-(
>>Now, the ltp tests pass even with this option set...
>>
>>In attachment you'll find a patch thhat
>>1) adds the missing rcu_read_unlock()
>>2) replaces Andrew's fix with a new one: the rcu_read_lock() is now
>>taken in ipc_lock() / ipc_lock_by_ptr() and released in ipc_unlock(),
>>exactly as it was done in the ref code.
>
>
> BTW, probably I miss something, but I wonder, how this RCU is working
> here. E.g. in msg.c do_msgsnd() there is:
>
> msq = msg_lock_check(ns, msqid);
> ...
>
> msg_unlock(msq);
> schedule();
>
> ipc_lock_by_ptr(&msq->q_perm);
>
> Since msq_lock_check() gets msq with ipc_lock_check() under
> rcu_read_lock(), and then goes msg_unlock(msq) (i.e. ipc_unlock())
> with rcu_read_unlock(), is it valid to use this with
> ipc_lock_by_ptr() yet?

Before Calling msg_unlock() they call ipc_rcu_getref() that increments a
refcount in the rcu header for the msg structure. This guarantees that
the the structure won't be freed before they relock it. Once the
structure is relocked by ipc_lock_by_ptr(), they do the symmetric
operation i.e. ipc_rcu_putref().

Regards,
Nadia
-
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: 2007-09-20 08:23    [from the cache]
©2003-2011 Jasper Spaans