Switch default page size to 64k?
[Forwarding the question to the list]
Would it be possible to make the 64k page size the default for Linux/SPARC64 (e.g. UltraSPARCs except the original UltraSPARC-III)? IMO it would result in some performance gains for HPC applications with small and medium memory usage.
--
Holger
From: "Holger Berger" <[email protected]>
Date: Sun, 19 Mar 2006 23:35:43 +0100
Quoted 4 lines
Would it be possible to make the 64k page size the default for Linux/SPARC64 (e.g. UltraSPARCs except the original UltraSPARC-III)? IMO it would result in some performance gains for HPC applications with small and medium memory usage.
But it would kill performance for workloads using small files. Each and every file needs to use at least one page in the file system page cache, and even currently at 8K there is a huge amount of memory wasted on small files.
And we will not go to using different page sizes on different chips, we have a single sparc64 kernel image that works on all sparc64 processor types, and after working so hard to maintain that for the sanity of distribution maintainers we are not moving away from that without a good reason.
I'd like the whole list to know that Holger's agenda is aparently to get Linux to move to a 64K default page size on Niagara in order to pressure the OpenSolaris folks to do the same. And that's not a reason for Linux to make such a technical decision.
Quoted 19 lines · David S. Miller
From: "Holger Berger" <[email protected]>
Date: Sun, 19 Mar 2006 23:35:43 +0100Quoted 4 lines
Would it be possible to make the 64k page size the default for Linux/SPARC64 (e.g. UltraSPARCs except the original UltraSPARC-III)? IMO it would result in some performance gains for HPC applications with small and medium memory usage.
But it would kill performance for workloads using small files. Each and every file needs to use at least one page in the file system page cache, and even currently at 8K there is a huge amount of memory wasted on small files.
And we will not go to using different page sizes on different chips, we have a single sparc64 kernel image that works on all sparc64 processor types, and after working so hard to maintain that for the sanity of distribution maintainers we are not moving away from that without a good reason.
Quoted 4 lines
I'd like the whole list to know that Holger's agenda is aparently to get Linux to move to a 64K default page size on Niagara in order to pressure the OpenSolaris folks to do the same. And that's not a reason for Linux to make such a technical decision.
David,
there is no such agenda. Neither is there any "pressure" against OpenSolaris folks. My only suggestion on [email protected] was to revive Sun's "64k kernel project" which was apparently canceled due administrative problems rather than technical issues. And this is neither related to Niagara at all. It was one of the Sun engineers who suggested that this may be useful for Niagara, not me.
--
Holger
From: "Holger Berger" <[email protected]>
Date: Mon, 20 Mar 2006 01:25:24 +0100
Quoted 1 line
there is no such agenda.
I would like to publicly apologize to Holger for saying that he had an agenda for suggesting a default page size of 64K.
That claim was baseless and in any event that kind of crap simply doesn't belong here.
Hopefully Holger can find it in his heart to forgive me so that we can get this back to being a technical conversation.
Thanks, I don't know what was bugging me today that made me say that.
Quoted 7 lines · David S. Miller
From: "Holger Berger" <[email protected]>
Date: Mon, 20 Mar 2006 01:25:24 +0100Quoted 1 line
there is no such agenda.
I would like to publicly apologize to Holger for saying that he had an agenda for suggesting a default page size of 64K.
Apology accepted... :-)
Quoted 5 lines
Hopefully Holger can find it in his heart to forgive me so that we can get this back to being a technical conversation.
Thanks, I don't know what was bugging me today that made me say that.
Maybe it was my fault for rushing part of the conversation the wrong way. Next time I will try to give more details. The lack of explanation and reference to the original Sun "64k kernel" project was just wrong.
--
Holger
From: "Holger Berger" <[email protected]>
Date: Mon, 20 Mar 2006 18:45:56 +0100
Quoted 10 lines · David S. Miller
Quoted 7 lines
From: "Holger Berger" <[email protected]>
Date: Mon, 20 Mar 2006 01:25:24 +0100Quoted 1 line
there is no such agenda.
I would like to publicly apologize to Holger for saying that he had an agenda for suggesting a default page size of 64K.
Apology accepted... :-)
Ok, so let's talk about what happens on your system when the default page size goes up to 64K. I think most users will not be pleased with the following ramifications.
Let's look at how much memory it takes to hold the Linux kernel source tree in the filesystem page cache with different page sizes. There are around 19,000 files, which by size total around 208MB.
The average size of a file is 11K, the median size, however, is around 4K. By page size, a table of the number of files in that set which fit in one page looks like this:
in 4kB: 9616 files (49.9%) in 8kB: 12996 files (67.5%) in 16kB: 15912 files (82.6%) in 32kB: 17820 files (92.5%) in 64kB: 18747 files (97.3%)
Half of the files file in a 4K page, 2/3 fit into an 8K page.
So how much memory is required to hold all of those files in ram for each page size? Let's do the math, keeping in mind that, as we stated above, the size total assuming no alignment (ie. if we could have a page size of 1 byte :-), is 208MB:
- 4kB: 251.5 MB
- 8kB: 303.4 MB
- 16kB: 421.0 MB
- 32kB: 684.0 MB
- 64kB: 1252.3 MB
- 128kB: 2428.6 MB
That's right, with a 64K page size it takes more than a gigabyte of ram to hold the kernel sources, whereas with an 8KB page it takes only 300MB. If that doesn't make you feel ill about using 64K pages by default, I don't know what will :-)
Let's express this disaster in terms of overhead.
1) with 4K pages, the overhead is ~%25, rather acceptable
2) with 8K pages, the overhead is ~%50, which is worse than 4K but isn't too hard to live with
3) with 16K pages, we are now wasting half of our memory, this is starting to hurt
4) with 64K pages, we are wasting 85% of our memory, that is simply unacceptable
I can only conclude that 64K pages are a fun benchmarking tool and nothing more. Benchmarks can make 64K pages look great, especially when everything fits in ram and none of the above issues cause the workload to start not fitting in memory. But that is not real life, and I would label any such benchmark to be seriously flawed.
I would severely discourage anyone from seriously considering 64K pages by default.
Quoted 5 lines · David S. Miller
And we will not go to using different page sizes on different chips, we have a single sparc64 kernel image that works on all sparc64 processor types, and after working so hard to maintain that for the sanity of distribution maintainers we are not moving away from that without a good reason.
I'm sure I'm being somewhat naive here, but how much of my eroding sanity is actually saved here? There are some obvious places where userland is affected, such as mkswap, things that do raw i/o accesses and thus need aligned pages, etc., but those already have to do the right detection, or else they don't work with a common 32-bit userland between sparc32 and sparc64 machines. What's the big scary part?
I've already read your mail about the kernel source tree, and agree that 64kB as the default page size is a bad idea. I'm just wondering which parts of userland you expect will actually operate incorrectly, for reasons other than OOM.
Signature · 1 line
Peter
From: Peter Jones <[email protected]>
Date: Tue, 21 Mar 2006 14:54:56 -0500
Quoted 6 lines
I'm sure I'm being somewhat naive here, but how much of my eroding sanity is actually saved here? There are some obvious places where userland is affected, such as mkswap, things that do raw i/o accesses and thus need aligned pages, etc., but those already have to do the right detection, or else they don't work with a common 32-bit userland between sparc32 and sparc64 machines. What's the big scary part?
Building and fielding bug reports against multiple kernels. That's very real, and the reason the distribution vendors try to minimize the number of kernel variants they have to ship on each platform.
Quoted 4 lines
I've already read your mail about the kernel source tree, and agree that 64kB as the default page size is a bad idea. I'm just wondering which parts of userland you expect will actually operate incorrectly, for reasons other than OOM.
I don't expect anything to operate incorrectly. The Linux userland is very clean already because any application has to deal already with the abundance of page size differences across the various platforms.
Quoted 10 lines · David S. Miller
From: Peter Jones <[email protected]>
Date: Tue, 21 Mar 2006 14:54:56 -0500Quoted 6 lines
I'm sure I'm being somewhat naive here, but how much of my eroding sanity is actually saved here? There are some obvious places where userland is affected, such as mkswap, things that do raw i/o accesses and thus need aligned pages, etc., but those already have to do the right detection, or else they don't work with a common 32-bit userland between sparc32 and sparc64 machines. What's the big scary part?
Quoted 4 lines
Building and fielding bug reports against multiple kernels. That's very real, and the reason the distribution vendors try to minimize the number of kernel variants they have to ship on each platform.
Very true; I was thinking you meant your statement in a context more directly regarding code maintenance. But you're right, that's a very valid concern.
Signature · 1 line
Peter