public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [Patch 0/10]: Cleanup online reservations for 2.6.9-rc2-mm4.
@ 2004-09-30 13:23 Stephen Tweedie
  2004-09-30 18:32 ` Andreas Dilger
  0 siblings, 1 reply; 4+ messages in thread
From: Stephen Tweedie @ 2004-09-30 13:23 UTC (permalink / raw)
  To: linux-kernel, Andrew Morton, Andreas Dilger, Theodore Ts'o,
	ext2-devel
  Cc: Stephen Tweedie

The patches to follow clean up a lot of the ext3 online reservation
code in 2.6.9-rc2-mm4.  There are a few minor fixes for things like
loglevels of printks and correcting some error returns, plus
refactoring a bit of existing ext3 code to allow resize to avoid dummy
on-stack inodes. 

There's also a review of the whole SMP locking of the resize.  Locking
is minimised: the impact on the hot path consists of nothing more than
an smp_rmb() before we test sb->s_groups_count.  That's a noop on x86,
but is a bit expensive on archs with a weak memory order; I've tried to
minimise that by reading it just once where previously it was read each
time round a loop, but I don't see how to avoid the cost entirely.

Finally, sb->s_debts is nuked from ext3.  It's broken already, as per my
email a week or two ago --- the per-group s_debt[] counts never get
modified.  We could probably do with nuking it from ext2 too, as it's
(differently) broken there (performs unlocked byte inc/dec operations on
a shared array and is vulnerable to word-tearing problems.)

This should address all of the points akpm had in his review of resize
a while back, except for the documentation/user space side of things
and the lack of error checking in certain ext3_journal_dirty_metadata
calls: I'm still fixing those up (I'll try to push out a working
user-space for this later today.)



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Patch 0/10]: Cleanup online reservations for 2.6.9-rc2-mm4.
@ 2004-09-30 16:00 Manfred Spraul
  2004-09-30 17:04 ` Stephen C. Tweedie
  0 siblings, 1 reply; 4+ messages in thread
From: Manfred Spraul @ 2004-09-30 16:00 UTC (permalink / raw)
  To: Stephen Tweedie; +Cc: linux-kernel

sct wrote:

>Locking
>is minimised: the impact on the hot path consists of nothing more than
>an smp_rmb() before we test sb->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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Patch 0/10]: Cleanup online reservations for 2.6.9-rc2-mm4.
  2004-09-30 16:00 [Patch 0/10]: Cleanup online reservations for 2.6.9-rc2-mm4 Manfred Spraul
@ 2004-09-30 17:04 ` Stephen C. Tweedie
  0 siblings, 0 replies; 4+ messages in thread
From: Stephen C. Tweedie @ 2004-09-30 17:04 UTC (permalink / raw)
  To: Manfred Spraul; +Cc: linux-kernel, Stephen Tweedie

Hi,

On Thu, 2004-09-30 at 17:00, Manfred Spraul wrote:

> >Locking
> >is minimised: the impact on the hot path consists of nothing more than
> >an smp_rmb() before we test sb->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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Patch 0/10]: Cleanup online reservations for 2.6.9-rc2-mm4.
  2004-09-30 13:23 Stephen Tweedie
@ 2004-09-30 18:32 ` Andreas Dilger
  0 siblings, 0 replies; 4+ messages in thread
From: Andreas Dilger @ 2004-09-30 18:32 UTC (permalink / raw)
  To: Stephen Tweedie
  Cc: linux-kernel, Andrew Morton, Theodore Ts'o, ext2-devel

[-- Attachment #1: Type: text/plain, Size: 583 bytes --]

On Sep 30, 2004  14:23 +0100, Stephen Tweedie wrote:
> The patches to follow clean up a lot of the ext3 online reservation
> code in 2.6.9-rc2-mm4.  There are a few minor fixes for things like
> loglevels of printks and correcting some error returns, plus
> refactoring a bit of existing ext3 code to allow resize to avoid dummy
> on-stack inodes. 

Many thanks to Stephen for putting in the effort to bring this into
shape.  All of the patches look good.

Cheers, Andreas
--
Andreas Dilger
http://members.shaw.ca/adilger/             http://members.shaw.ca/golinux/


[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-09-30 18:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-09-30 16:00 [Patch 0/10]: Cleanup online reservations for 2.6.9-rc2-mm4 Manfred Spraul
2004-09-30 17:04 ` Stephen C. Tweedie
  -- strict thread matches above, loose matches on Subject: below --
2004-09-30 13:23 Stephen Tweedie
2004-09-30 18:32 ` Andreas Dilger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox