: Cleanup online reservations for 2.6.9-rc2-mm4.
Quoted 4 lines · sct
Locking
is minimised: the impact on the hot path consists of nothing more than ansmp_rmb()before we testsb->s_groups_count. That's a noop on x86,
No, wrong way around:wmb() is empty. rmb() is either lfence or a locked dummy instruction.
--
Manfred
Hi,
Quoted 6 lines · Manfred Spraul
Quoted 4 lines
Locking
is minimised: the impact on the hot path consists of nothing more than ansmp_rmb()before we testsb->s_groups_count. That's a noop on x86,No, wrong way around:
wmb()is empty.rmb()is either lfence or a locked dummy instruction.
Hmm. But I'm still not sure we can get away with anything lighter-weight.
The basic construct we need to worry about is:
new_group_table = kmalloc(...); memcpy(new_group_table, old_group_table); new_group_table[new_group] = foo; sbi->s_group_desc = new_group_table; /* SMP WRITE BARRIER */ sbi->s_group_count = new_group_count;
on the writer side, and
ngroups = sbi->s_group_count; /* SMP READ BARRIER */ for (i = 0; i < ngroups; i++) gdp = sbi->s_group_desc[i];
The latter is the worry --- we're doing a read that depends immediately on "i" and s_group_desc, but not on sbi->s_group_count. There *IS* a comparison between i and s_group_count, though, so the dependency is implicit.
I'm just not familiar enough with the architecture of weakly-ordered platforms to know if we can get away with smp_read_barrier_depends() in this particular case. If so, we can use that and be done with the extra locked op on x86.
--Stephen