Contents

Monday, December 12, 2005

read book now

HOME

VIEW

MAIL

BOOK Reviews

 

 NT AND LEVEL TWO CACHE

Alex Pournelle

Note: this myth is likely to surface often and in many places. Help spread the word.

read book now

HOME

VIEW

MAIL

 

A few days ago, Microsoft's "Windows Platform News" e-mail newsletter sent out a tip:

USE ALL OF YOUR L2 CACHE

If you have more than 256KB of L2 cache, Windows NT might not be using  all of it. To correct this, make an emergency repair disk (rdisk /s).  Run Regedt32.exe. Under HKEY_LOCAL_MACHINE, select   System\CurrentControlSet\Control\SessionManager\MemoryManagement. On  the right side of the window you will find SecondLevelDataCache. This  defaults to 0, which is the correct value for 256KB of L2 cache.  Double-click SecondLevelDataCache to bring up the D_WORD Editor. Click the Decimal radio button, enter the amount of L2 cache you have, and  click OK. Exit RegEdt32.

Eric Pobirs asked, when he sent me the note:

Is it possible that the vast majority of  Pentium Pro and PII systems aren’t running at their full potential?  Does SP4 fix this?

A quick check of all the machines at the Em/Pournelle Graphics Lab, which I run with David Em, shows that, no, none of them are set for anything other than "0" in this position. We decided (since fiddling with computers is so much more fun than actually writing about them) to experiment. What would happen on our Intergraph dual-processor PII-300, which of course has 512K of cache per processor, if we set this flag to 512 Decimal (0x200 Hex)? This machine runs NT 4 Service Pack 4 already.

We tested by constructing a series of PhotoShop 5 filters, using 5's new "action palette" (sort of like DeBab's batch mode, it's great for doing the same thing to multiple files). Ran them both before and after the update. If there was a difference, it was less than 1 second on a 1:30 series of filters, well within measurement error.

Meanwhile, I decided to email someone who had a real reason for an opinion. (One of the great things about a lab is that you can crash one system while writing on another.) To this end, I asked Jamie Hanrahan of Kernel Mode Systems his opinion. Jamie teaches (and writes books about) NT internals and device-driver issues, so he knows NT from the inside quite well.

Jamie said:

There is nothing you can do from the CPU to enable or disable part of the L2 cache; you can turn it off completely but you can’t enable only 256K of it.

I think that registry value is only "informational". Perhaps they change some other sizing policies based on the amount of cache they think the system has, but I don’t for a second believe that they’re somehow completely ignoring part of it.

But this is something I’m only reasonably certain of and that I’ve been meaning to nail down.

"0" in registry entries, esp. under the MemoryManagement key, usually tells the system "do your own default calculations based on actual hardware", not "force to a special value for one type of hardware".

--- Jamie Hanrahan, Kernel Mode Systems, San Diego CA

Internet: jeh@cmkrnl.com (JH645) CompuServe: 74140,2055

A quick sanity check says that, yes, Jamie is of course right; all that cache would be used automatically. (The print Chaos Manor column in Byte used to have a semi-regular feature called "Things that Make You Feel Stupid", and I think this is in that spirit.) That NT could calculate operation strategies based on available cache makes sense, but it should automatically use all the cache that's there; it's either used, or it isn't.

So, conclusion: Any of you out there with customers or who are in support can tell the Great Unwashed to stay the heck away from Regedt32. They’re not going to suddenly get 25% more performance out of their expensive new boxes. (Yes, yes—desktops should have such functionality denied to mere users and others who can hurt themselves playing with fire. That’s what NT security is for.)

And big nasty harrumphs to MS for putting out their so-called "tips" without even running them by their own engineers first. Editors are important.

 

 

Noel Nyman (noeln@microsoft.com)

Re: your discussion about changing the size of the Windows NT L2 cache. My grandmother used to say, "A little knowledge is a dangerous thing." In this case it’s not so much dangerous as time consuming. The "Windows Platform News" tip also appeared in at least one consumer magazine recently. In both cases, the information is correct, but incomplete. Here’s the missing parts [emphasis mine]…

"You should only consider editing the default value if you are running computers with direct-mapped L2 caches. Pentium II and later processors do not have direct-mapped L2 caches. A slight performance improvement (two percent) can be detected in older computers (486 and earlier) with memory of 64 MB and more due to the fact that physical pages are distributed better in the address space, reducing L2-cache collisions. However, defeating the operating system’s default behavior and setting the value of the SecondLevelDataCache to 256 KB rather than 2 MB when the computer has a 2 MB L2 cache reduces performance slightly."

 

TOP

birdline.gif (1428 bytes)