Re: [patch 3/3] radix-tree: RCU lockless readside

Nick Piggin
2006-06-23T08:39:25Z

Andrew Morton wrote:
> On Thu, 22 Jun 2006 20:11:12 +0200
> Nick Piggin <npiggin@suse.de> wrote:
>
>
>>On Thu, Jun 22, 2006 at 10:40:57AM -0700, Paul E. McKenney wrote:
>>
>>>On Thu, Jun 22, 2006 at 06:55:51PM +0200, Nick Piggin wrote:
>>>
>>>>No problem, will change.
>>>
>>>Thank you!
>>
>>OK, and with that I believe I've covered all your concerns.
>>
>>Attached is the incremental patch (plus a little bit of fuzz
>>that's gone to Andrew). The big items are:
>>
>>- documentation, clarification of comments
>>- tag lookups are now RCU safe (tested with harness)
>>- cleanups of various misuses of rcu_ API that Paul spotted
>>- thought I might put in a copyright -- is this OK?
>>
>>Andrew, please apply.
>
>
> Freeing unused kernel memory: 316k freed
> Write protecting the kernel read-only data: 384k
> No module found in object
> No module found in object
> No module found in object
> No module found in object
> input: AT Translated Set 2 keyboard as /class/input/input0
> No module found in object
> EXT3-fs: INFO: recovery required on readonly filesystem.
> EXT3-fs: write access will be enabled during recovery.
> kjournald starting. Commit interval 5 seconds
> EXT3-fs: recovery complete.
> EXT3-fs: mounted filesystem with ordered data mode.
> BUG: NMI Watchdog detected LOCKUP on CPU0, eip c0264345, registers:
> CPU: 0
> EIP is at radix_tree_gang_lookup_tag+0x105/0x1a0
> eax: ffffffff ebx: 00000040 ecx: ffffffc0 edx: 00000007
> esi: e701e9d8 edi: 000001c0 ebp: e6fbddd8 esp: e6fbdda8
> ds: 007b es: 007b ss: 0068
> Process fsck.ext3 (pid: 1565, ti=e6fbc000 task=c1fbcb90 task.ti=e6fbc000)
> Stack: e77f2dc4 e701e9d8 e701e9d8 00000002 00000fff 00000000 e701e8c8 e6fbde60
> 0000000e c1c6c52c e6fbde60 c1c6c538 e6fbde00 c014b68f c1c6c52c e6fbde60
> 00000000 0000000e 00000000 e6fbde58 00000000 00000001 e6fbde20 c0155631
> Call Trace:
> Code: 89 fa 8d 4c 09 fa d3 e3 d3 ea 89 d9 83 e2 3f f7 d9 eb 13 8d 76 00 89 f8 89 df 21 c8 01 c7 74 26 42 83 fa 40 74 95 0f a3 16 19 c0 <85> c0 74 e7 83 7d dc 01 74 3a 31 f6 89 75 f0 e9 6e ff ff ff c7
> console shuts up ...
>
>
> Not sure why, either. It all looks like an equivalent transformation to
> me.
>
> fwiw, here's what I tested:

Arggh, line 755 has an extra semicolon. I caught and fixed this in the rtth
tree, but obviously forgot to transfer it over.

> @@ -741,15 +740,19 @@ __lookup_tag(struct radix_tree_node *slo
> for ( ; j < RADIX_TREE_MAP_SIZE; j++) {
> index++;
> if (tag_get(slot, tag, j)) {
> - BUG_ON(slot->slots[j] == NULL);
> - results[nr_found++] = slot->slots[j];
> - if (nr_found == max_items)
> - goto out;
> + struct radix_tree_node *node = slot->slots[j];
> + if (node) {
> + results[nr_found++] = rcu_dereference(node);
> + if (nr_found == max_items)
> + goto out;
> + }
> }
> }
> }
> shift -= RADIX_TREE_MAP_SHIFT;
> - slot = slot->slots[i];
> + slot = rcu_dereference(slot->slots[i]);
> + if (slot == NULL);
> + break;
> }

^^^^^^^^

Up there.

--
SUSE Labs, Novell Inc.
Send instant messages to your online friends http://au.messenger.yahoo.com