Please explain Giant-locked

I've been wondering for some time now just what are the entries in dmesg followed by [GIANT-LOCKED], [ITHREAD], [FILTER]...
On my server, FreeBSD 8.0-RELEASE-p2, CPU P4 3ghz, 4gb memory, X, fluxbox...
In particular, the [GIANT-LOCKED] entries refer to nvidia0, atkbd0, psm0.
 
Ok. As far as I understand it... And in layman's terms :e

You know there are lots of routines in the kernel? Stuff that handles memory management, process management etc. right?
If you have one CPU the kernel can access all sorts of internal data without any problems. It starts to get tricky when you have 2 or more CPU's, both trying to access the internal data. Set a value for something. To prevent different calls acting on the wrong data, some smarty pants invented a thing called a lock. Before you can access the data you need to get a lock first. If the lock is set it means some other routine, or CPU, is accessing that data. This will prevent both processes or CPUs overwriting each others data. In kernel terms the giant lock refers to a lock that locks all kernel data. This automatically means that a process running on the other CPU cannot access it.

I think it was with version 5.0 and the new SMP, they created more fine grained kernel locks. This greatly improves performance on multi core or CPU systems. Now multiple processes can access kernel data. As long as it isn't the same piece of data of course. I think almost everything in the base kernel is now giant free and uses those more fine grained locks. Unfortunately several external kernel modules, like the nvidia one, are still depending on giant lock :(
 
My CPU is a single P4 3ghz in slot 478 and the GENERIC kernel seems senses or does whatever as a SMP with cpu0 and cpu1.
Does that screw up things?
I don't suppose there is anything to be done to change this except dump the hardware and get something less obsolete... what a bummer... already one of my mboards died and theres no way to replace it... what a waste of a decent cpu and video card.:(
 
There's nothing obsolete about hardware in relation to giant lock. That's all a driver issue. It won't screw up things but it does mean there's a limitation. But the performance gains are only achieved with multi core or CPU systems.

A P4 is never a waste. And you're probably not really going to benefit a lot from SMP anyway. HyperThreading makes it appear there's 2 cores or CPUs but there is only one ;)
 
indeed, AFIK GIANT_LOCK makes no difference on single-CPU systems. And on SMP systems it never seemed to make a lot of difference to me (though I guess if you are running a hot, young 3d application on an SMP machine while madly merging database tables you might feel a performance hit, I wouldn't know).

A typical desktop system spends >90% of its life wating for you to type something or move your møuse (if I can double-click in 0.10s, my computer waits for almost 200,000,000 lonely, quiet cycles between clicks (per core), I'm pretty sure it dreams up, simulates, and destroys a thousand virtual civilisations in that time), so I doubt GIANT_LOCK affects you much there unless you're really hammering those CPUs.
 
Back
Top