idr: document that idr_for_each may be used under rcu_read_lock()
Subsystems (2)
PATCH 1/1 idr: document that idr_for_each may be used under rcu_read_lock()
Hello Nadia,
In commit f9c46d6ea5ce138a886c3a0f10a46130afab75f5, you converted idr_find() and idr_for_each() to rcu_dereference(). The documentation of idr_find() was updated to say that it may now be called under rcu_read_lock(). But the doc of idr_for_each() still says:
"The caller must serialize idr_for_each() vs idr_get_new() and idr_remove()."
I might be missing something, but assuming idr_for_each() may also be called under rcu_read_lock(), we need something like the patch below, right? (I just duplicated the doc update of idr_find())
thanks,
Brice
Quoted 1 line
From
35a05eba9cc16d7fe786a9a7ff17f88fcf8b06e2Mon Sep 17 00:00:00 2001
From: Brice Goglin <[email protected]>
Date: Mon, 10 May 2010 18:49:51 +0200
Subject: [PATCH] idr: document that idr_for_each may be used under rcu_read_lock()
Since commit f9c46d6ea5ce138a886c3a0f10a46130afab75f5, idr_for_each() may be called under rcu_read_lock(). It does not need serialization against idr_get_new() and idr_remove() anymore.
--- lib/idr.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
lib/idr.c +2 -1
@@ -541,7 +541,8 @@ EXPORT_SYMBOL(idr_find);* We check the return of @fn each time. If it returns anything other * than 0, we break out and return that value. * -* The caller must serialize idr_for_each() vs idr_get_new() and idr_remove(). +* This function can be called under rcu_read_lock(), given that the leaf +* pointers lifetimes are correctly managed. */ int idr_for_each (struct idr *idp,int (*fn)(int id,void *p,void *data),void *data)
Signature · 1 line
1.7.1