Skip to contentSkip to conversation

2.6 test1 mm2 user.c race (?)

PATCH Andrew Morton 2 participants 2 messages Jul 28, 2003 – Jul 30, 2003 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Review

Quoted 4 lines · <[email protected]> wrote:
(quoted diff) +2 -0
+	spin_lock(&uidhash_lock);
 	uid_hash_insert(&root_user, uidhashentry(0));
+	spin_unlock(&uidhash_lock);	

This code runs within an initcall, so it is very unlikely that anything will race with us here.

But SMP is up, and this code gets dropped out of memory later (the out-of-line spinlock code doesn't get dropped though).

So yes, I'd prefer that the locking be there, if only for documentary purposes. A /* comment */ which explains why the locking was omitted would also be suitabe.

#2 lore raw
Quoted 9 lines · Andrew Morton

Review

Quoted 4 lines · <[email protected]> wrote:
(quoted diff) +2 -0
+	spin_lock(&uidhash_lock);
 	uid_hash_insert(&root_user, uidhashentry(0));
+	spin_unlock(&uidhash_lock);	

This code runs within an initcall, so it is very unlikely that anything will race with us here.

Quoted 6 lines

But SMP is up, and this code gets dropped out of memory later (the out-of-line spinlock code doesn't get dropped though).

So yes, I'd prefer that the locking be there, if only for documentary purposes. A /* comment */ which explains why the locking was omitted would also be suitabe.

I like the locking better than the comment, I trust the analysis today, but with SMP and preempt, the lock protects the future (and you may be missing something even today).

Signature · 3 lines
bill davidsen <[email protected]>
  CTO, TMR Associates, Inc
Doing interesting things with little computers since 1979.