linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* radix_tree_lookup_slot() comment
@ 2006-09-23 18:40 Peter Zijlstra
  2006-09-24 14:40 ` Nick Piggin
  0 siblings, 1 reply; 2+ messages in thread
From: Peter Zijlstra @ 2006-09-23 18:40 UTC (permalink / raw)
  To: Nick Piggin; +Cc: linux-mm, Lee Schermerhorn

Hi Nick,

I noticed the comment above radix_tree_lookup_slot() did not match the
uses in your lockless pagecache. Would this patch be correct?

---
 lib/radix-tree.c |    9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

Index: linux-2.6-mm/lib/radix-tree.c
===================================================================
--- linux-2.6-mm.orig/lib/radix-tree.c	2006-09-23 20:20:21.000000000 +0200
+++ linux-2.6-mm/lib/radix-tree.c	2006-09-23 20:34:31.000000000 +0200
@@ -380,11 +380,10 @@ EXPORT_SYMBOL(radix_tree_insert);
  *	Returns:  the slot corresponding to the position @index in the
  *	radix tree @root. This is useful for update-if-exists operations.
  *
- *	This function cannot be called under rcu_read_lock, it must be
- *	excluded from writers, as must the returned slot for subsequent
- *	use by radix_tree_deref_slot() and radix_tree_replace slot.
- *	Caller must hold tree write locked across slot lookup and
- *	replace.
+ * 	This function can be called under rcu_read_lock iff the slot is not
+ * 	modified by radix_tree_replace_slot, otherwise it must be called
+ * 	exclusive from other writers. Any dereference of the slot must be done
+ * 	using radix_tree_deref_slot.
  */
 void **radix_tree_lookup_slot(struct radix_tree_root *root, unsigned long index)
 {


--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: radix_tree_lookup_slot() comment
  2006-09-23 18:40 radix_tree_lookup_slot() comment Peter Zijlstra
@ 2006-09-24 14:40 ` Nick Piggin
  0 siblings, 0 replies; 2+ messages in thread
From: Nick Piggin @ 2006-09-24 14:40 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: linux-mm, Lee Schermerhorn

Hi Peter,

Yes, that looks much better, thanks.

BTW. this latest patchset has at least one -mm mismerge (page flags bit),
so I would advise against testing (though do appreciate reviews). I'll
send Andrew a more thorough version against 2.6.18-mm1.

Thanks,
Nick

Peter Zijlstra wrote:

>Hi Nick,
>
>I noticed the comment above radix_tree_lookup_slot() did not match the
>uses in your lockless pagecache. Would this patch be correct?
>
>---
> lib/radix-tree.c |    9 ++++-----
> 1 file changed, 4 insertions(+), 5 deletions(-)
>
>Index: linux-2.6-mm/lib/radix-tree.c
>===================================================================
>--- linux-2.6-mm.orig/lib/radix-tree.c	2006-09-23 20:20:21.000000000 +0200
>+++ linux-2.6-mm/lib/radix-tree.c	2006-09-23 20:34:31.000000000 +0200
>@@ -380,11 +380,10 @@ EXPORT_SYMBOL(radix_tree_insert);
>  *	Returns:  the slot corresponding to the position @index in the
>  *	radix tree @root. This is useful for update-if-exists operations.
>  *
>- *	This function cannot be called under rcu_read_lock, it must be
>- *	excluded from writers, as must the returned slot for subsequent
>- *	use by radix_tree_deref_slot() and radix_tree_replace slot.
>- *	Caller must hold tree write locked across slot lookup and
>- *	replace.
>+ * 	This function can be called under rcu_read_lock iff the slot is not
>+ * 	modified by radix_tree_replace_slot, otherwise it must be called
>+ * 	exclusive from other writers. Any dereference of the slot must be done
>+ * 	using radix_tree_deref_slot.
>  */
> void **radix_tree_lookup_slot(struct radix_tree_root *root, unsigned long index)
> {
>  
>

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-09-24 14:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-09-23 18:40 radix_tree_lookup_slot() comment Peter Zijlstra
2006-09-24 14:40 ` Nick Piggin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox