Re: andrea buffer code (2.2.9-C.gz)

Ingo Molnar (mingo@chiara.csoma.elte.hu)
Thu, 20 May 1999 13:37:08 +0200 (CEST)


On Wed, 19 May 1999, Andrea Arcangeli wrote:

> The point is that there we don't need a global spinlock but there we can
> scale far more finegriend on per-page basis. If our approch is to scale
> well as possible in SMP without bother to waste some more kbyte of memory
> the spinlock it's required. [...]

this is a mistake some other OSs did in the early SMP stage, _too_
finegrained locking increases the size of kernel objects, increases cache
footprint, sometimes increases the number of lock operations and thus
slows things down.

> [...] You know: to scale better you need to waste
> more memory :-).

Not necesserily, sometimes we need more locks, sometimes we need less. The
point is to have Linux perform better. Putting a spinlock into every
'struct page' wastes some memory (128k RAM on a 128M box, not much, but
not small either), so this issue is not as easy to judge as you appear to
think. Eg. i have threaded the SysV IPC code recently, and actually ended
up _removing_ one particular type of spinlock because it only decreased
measured performance.

> >The spinlock is only acquired for a few lines,
> >perhaps one global spinlock would save memory.
>
> Yes but I am not worried, and being more finegrined in SMP is more fun :-).

you might not be worried but others are ... Manfred has asked good
questions: is the particular lock you have 'expanded' into per-object
locks contended in tests, have you measured things. OS development is
never 'mathematically clean'.

-- mingo

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/