change the size of pages inside the kernel

Is there any windows service or registry that can change the size of pages? Is there any Windows API can be used from an application to change the size of pages?

Thanks.

xxxxx@yahoo.com wrote:

Is there any windows service or registry that can change the size of pages? Is there any Windows API can be used from an application to change the size of pages?

Change it to what? The x86 hardware can only use 4K and 4M pages. You
don’t have a lot of choices.

The answer is “no”. That’s a fundamental constant, like Avogadro’s Number…


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

Hey Tim

You a physicist or a (shudder) chemist in a previous existence?

Cheers
Lyndon

“Tim Roberts” wrote in message news:xxxxx@ntdev…
> xxxxx@yahoo.com wrote:
>> Is there any windows service or registry that can change the size of
>> pages? Is there any Windows API can be used from an application to change
>> the size of pages?
>>
>
> Change it to what? The x86 hardware can only use 4K and 4M pages. You
> don’t have a lot of choices.
>
> The answer is “no”. That’s a fundamental constant, like Avogadro’s
> Number…
>
> –
> Tim Roberts, xxxxx@probo.com
> Providenza & Boekelheide, Inc.
>
>

No, page size is hard-coded to the CPU.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From:
To: “Windows System Software Devs Interest List”
Sent: Tuesday, December 05, 2006 2:22 AM
Subject: [ntdev] change the size of pages inside the kernel

> Is there any windows service or registry that can change the size of pages?
Is there any Windows API can be used from an application to change the size of
pages?
>
> Thanks.
>
> —
> Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

I think any technical school student knows Avogadro’s number - a relation
of metrical gramm to the atomic mass unit (~protone mass). It is around 6e23.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From: “Lyndon J. Clarke”
Newsgroups: ntdev
To: “Windows System Software Devs Interest List”
Sent: Tuesday, December 05, 2006 2:48 AM
Subject: Re:[ntdev] change the size of pages inside the kernel

> Hey Tim
>
> You a physicist or a (shudder) chemist in a previous existence?
>
> Cheers
> Lyndon
>
> “Tim Roberts” wrote in message news:xxxxx@ntdev…
> > xxxxx@yahoo.com wrote:
> >> Is there any windows service or registry that can change the size of
> >> pages? Is there any Windows API can be used from an application to change
> >> the size of pages?
> >>
> >
> > Change it to what? The x86 hardware can only use 4K and 4M pages. You
> > don’t have a lot of choices.
> >
> > The answer is “no”. That’s a fundamental constant, like Avogadro’s
> > Number…
> >
> > –
> > Tim Roberts, xxxxx@probo.com
> > Providenza & Boekelheide, Inc.
> >
> >
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

Technical school? If I remember correctly, we learnt it at elementary school, 7th or 8th class, chemistry. But you’re probably right only technical school students remember it :slight_smile:

Best regards,

Michal Vodicka
UPEK, Inc.
[xxxxx@upek.com, http://www.upek.com]


From: xxxxx@lists.osr.com[SMTP:xxxxx@lists.osr.com] on behalf of Maxim S. Shatskih[SMTP:xxxxx@storagecraft.com]
Reply To: Windows System Software Devs Interest List
Sent: Tuesday, December 05, 2006 1:13 AM
To: Windows System Software Devs Interest List
Subject: Re: Re:[ntdev] change the size of pages inside the kernel

I think any technical school student knows Avogadro’s number - a relation
of metrical gramm to the atomic mass unit (~protone mass). It is around 6e23.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From: “Lyndon J. Clarke”
> Newsgroups: ntdev
> To: “Windows System Software Devs Interest List”
> Sent: Tuesday, December 05, 2006 2:48 AM
> Subject: Re:[ntdev] change the size of pages inside the kernel
>
>
> > Hey Tim
> >
> > You a physicist or a (shudder) chemist in a previous existence?
> >
> > Cheers
> > Lyndon
> >
> > “Tim Roberts” wrote in message news:xxxxx@ntdev…
> > > xxxxx@yahoo.com wrote:
> > >> Is there any windows service or registry that can change the size of
> > >> pages? Is there any Windows API can be used from an application to change
> > >> the size of pages?
> > >>
> > >
> > > Change it to what? The x86 hardware can only use 4K and 4M pages. You
> > > don’t have a lot of choices.
> > >
> > > The answer is “no”. That’s a fundamental constant, like Avogadro’s
> > > Number…
> > >
> > > –
> > > Tim Roberts, xxxxx@probo.com
> > > Providenza & Boekelheide, Inc.
> > >
> > >
> >
> >
> >
> > —
> > Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
> >
> > To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
>
> —
> Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
>

Is it true that only kernel can use 4M page and the application only use 4K page?

Thanks.

xxxxx@yahoo.com wrote:

Is it true that only kernel can use 4M page and the application only use 4K page?

That depends on how you look at it.

The page tables are set up by the kernel. It just so happens that the
only 4M pages that the kernel sets up are for kernel use, so in Windows,
the answer is “yes”. However, that’s an implementation detail, not an
architectural limitation.

I’m curious to know what problem you were hoping to solve by changing
the page size.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

Believe it or not, there actually is a flag to VirtualAlloc that allows you
allocate large pages (of course, “large” is going to be dictated by the
platform and therefore might not be 4MB. For example, I think they can even
be 2MB on an x86 if you’re running in PAE mode).

-scott

Scott Noone
Software Engineer
OSR Open Systems Resources, Inc.
http://www.osronline.com

“Tim Roberts” wrote in message news:xxxxx@ntdev…
> xxxxx@yahoo.com wrote:
>> Is it true that only kernel can use 4M page and the application only use
>> 4K page?
>>
>
> That depends on how you look at it.
>
> The page tables are set up by the kernel. It just so happens that the
> only 4M pages that the kernel sets up are for kernel use, so in Windows,
> the answer is “yes”. However, that’s an implementation detail, not an
> architectural limitation.
>
> I’m curious to know what problem you were hoping to solve by changing
> the page size.
>
> –
> Tim Roberts, xxxxx@probo.com
> Providenza & Boekelheide, Inc.
>
>

Lyndon J. Clarke wrote:

Hey Tim

You a physicist or a (shudder) chemist in a previous existence?

No, just a smart aleck…

I remember reading an article some time in the late 1990s that claimed
that the total number of CPU cycles executed in all of history would
exceed Avogadro’s number later in the same year. It would be
interesting to estimate how long it would take now.

Within an order of magnitude, if we include all computers everywhere
(including embedded processors), I’d guess there were a hundred billion
computers in the world (10^11). The average number of cycles per second
is probably 500 million (5x10^8), . Avogadro’s number is 6x10^23, which
means we’re doing that many every 1,000 seconds or so.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

I am running an application that accesses around 900MB memory. I am thinking if I can modify the application to enable large page to see if it can speed up the application. I found a link mentioned a registry to force large page for kernel

http://msdn.microsoft.com/msdnmag/issues/01/12/XPKernel/

and also from http://java.sun.com/docs/hotspot/VMOptions.html

Only Windows Server 2003 supports large page memory. In order to use it, the administrator must first assign additional privilege to the user who will be running the application:

select Control Panel -> Administrative Tools -> Local Security Policy
select Local Policies -> User Rights Assignment
double click “Lock pages in memory”, add users and/or groups
reboot the machine

It seems to me this can be done in Linux?

Thanks.

> Believe it or not, there actually is a flag to VirtualAlloc that allows

you allocate large pages (of course, “large” is going to be dictated by
the platform and therefore might not be 4MB. For example, I think they can
even be 2MB on an x86 if you’re running in PAE mode).

2MB on x64 systems.

Try using that VirtualAlloc call to allocate a 28GB area some time. The
results can be amusing, if you have the spare time to watch them. (Um, you
do need a 32+GB system to be able to do that…)

Loren

>I am running an application that accesses around 900MB memory. I am

thinking if I can modify the application to enable large page to see if it
can speed up the application. I found a link mentioned a registry to force
large page for kernel

With only .9G in use it is questionable if you could see any benefit. Large
pages are either 2 or 4 MB depending on the underlying platform. You can
allocate this with VirtualAlloc if you really want to. However, there are
some real drawbacks to doing it. Like that menory will never be paged out.
And it is a crapshoot as to whether you will get the amount you want, or
have to live with some smaller amount.

About the only case I can think of where large pages might make a measurable
difference is if you had *VERY* random access continuously to virtually the
whole space. That could possibly defeat page table caching for smaller
pages, I suppose. I doubt you would see much of a difference from page walk
time with fairly normal access patterns.

Loren

4M pages are only used to define the hard-coded region where, for instance,
NTOSKRNL itself lives. No dynamic allocations are done using 4M pages.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From:
To: “Windows System Software Devs Interest List”
Sent: Tuesday, December 05, 2006 3:43 AM
Subject: RE:[ntdev] change the size of pages inside the kernel

> Is it true that only kernel can use 4M page and the application only use 4K
page?
>
> Thanks.
>
> —
> Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

xxxxx@yahoo.com wrote:

I am running an application that accesses around 900MB memory. I am thinking if I can modify the application to enable large page to see if it can speed up the application.

What makes you think that will help? The Windows page manager is one of
the most scrutinized and well-optimized pieces of code in the entire
operating system. If you are accessing your data, the page manager will
leave it in memory. If you aren’t accessing pieces of your data, then
the page manager will swap it out for more important uses, exactly as it
should. Virtually anything you do to interfere is only going to make
the performance worse.

I found a link mentioned a registry to force large page for kernel

http://msdn.microsoft.com/msdnmag/issues/01/12/XPKernel/

Not really. That just tweaks the threshhold at which large pages are used.

and also from http://java.sun.com/docs/hotspot/VMOptions.html

Only Windows Server 2003 supports large page memory. In order to use it, the administrator must first assign additional privilege to the user who will be running the application:

Did you read the paragraph above that? “However, please note sometimes
using large page memory can negatively affect system performance.”

Seriously, the Windows kernel programmers are smarter than you are. You
need to do an awful lot of profiling, refactoring, reorganizing, and
optimizing in your application before you start looking at something as
esoteric as paging.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

Loren Wilton wrote:

Try using that VirtualAlloc call to allocate a 28GB area some time.
The results can be amusing, if you have the spare time to watch
them. (Um, you do need a 32+GB system to be able to do that…)

This should work better on Vista. Mm no longer does any
trimming/flushing when trying to satisfy MEM_LARGE_PAGES
requests. The call might still fail (in fact, it is more likely to
fail now), but it should fail much faster and without too
much impact on the system, so the app can immediately
retry with a smaller size if desired.