Skip to contentSkip to conversation

+ lib-idrc-use-rcu_init_pointerx-null.patch added to -mm tree

PATCH [email protected] 1 participant 1 message Mar 26, 2014

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

Subject: + lib-idrc-use-rcu_init_pointerx-null.patch added to -mm tree
To: [email protected],[email protected]
From: [email protected]
Date: Wed, 26 Mar 2014 15:56:10 -0700

The patch titled
Subject: lib/idr.c: use RCU_INIT_POINTER(x, NULL)
has been added to the -mm tree. Its filename is
lib-idrc-use-rcu_init_pointerx-null.patch

This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/lib-idrc-use-rcu_init_pointerx-null.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/lib-idrc-use-rcu_init_pointerx-null.patch

Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

The -mm tree is included into linux-next and is updated there every 3-4 working days

------------------------------------------------------
From: Monam Agarwal <[email protected]>
Subject: lib/idr.c: use RCU_INIT_POINTER(x, NULL)

Replace rcu_assign_pointer(x, NULL) with RCU_INIT_POINTER(x, NULL)

The rcu_assign_pointer() ensures that the initialization of a structure is carried out before storing a pointer to that structure. And in the case of the NULL pointer, there is no structure to initialize. So, rcu_assign_pointer(p, NULL) can be safely converted to RCU_INIT_POINTER(p, NULL)

---

 lib/idr.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
lib/idr.c renamed from lib/idr.c~lib-idrc-use-rcu_init_pointerx-null +2 -2
diff -puN lib/idr.c~lib-idrc-use-rcu_init_pointerx-null lib/idr.c
@@ -533,7 +533,7 @@ static void sub_remove(struct idr *idp,
 	n = id & IDR_MASK;
 	if (likely(p != NULL && test_bit(n, p->bitmap))) {
 		__clear_bit(n, p->bitmap);
-		rcu_assign_pointer(p->ary[n], NULL);
+		RCU_INIT_POINTER(p->ary[n], NULL);
 		to_free = NULL;
 		while(*paa && ! --((**paa)->count)){
 			if (to_free)
@@ -602,7 +602,7 @@ static void __idr_remove_all(struct idr
 
 	n = idp->layers * IDR_BITS;
 	p = idp->top;
-	rcu_assign_pointer(idp->top, NULL);
+	RCU_INIT_POINTER(idp->top, NULL);
 	max = idr_max(idp->layers);
 
 	id = 0;

_

Patches currently in -mm which might be from [email protected] are

checkpatch-make-return-is-not-a-function-test-quieter.patch lib-idrc-use-rcu_init_pointerx-null.patch linux-next.patch