Skip to contentSkip to conversation

NUMA: Patch for node based swapping

DISCUSSION Andi Kleen 2 participants 2 messages Oct 12, 2004 2 messages not in the archive Memory management

lore
Share & tools
lore

Andi Kleen

author
#2 lore raw
In reply to a message not in the archive
Quoted 8 lines · Rik van Riel
Quoted 3 lines · Christoph Lameter

The minimum may be controlled through /proc/sys/vm/node_swap. By default node_swap is set to 100 which means that kswapd will be run on a zone if less than 10% are available after allocation.

That sounds like an extraordinarily bad idea for eg. AMD64 systems, which have a very low numa factor.

As a optional sysctl it makes sense even on AMD64. On some benchmarks you see the differences between local and remote memory very clearly.

-Andi

#3 lore raw

This patch is a bad idea and should not be merged into the mainline.

(1) On bids for large SGI machines, we often see the requirement that

Quoted 1 line

90% of main memory be allocatable to user programs. If, as suggested,

one were to set the /proc/sys/vm/node_swap to 10%, then any allocation (e. g. alloction of a page cache page) will kick off kswapd when the customer has allocated > 90% of storage. The result is that kswapd will be more or less constantly running on every node in the system. Since that same 90% requirement is often used to size the amount of memory purchased to run the customers primary application, we have a recipe for providing poor performance for that principle application. Aa a result we will likely end up disabling this feature on those large SGI machines, were it to end up in one of our kernels.

Setting the node_swap limit to less than 10% would keep this from happening, of course, but in this case the improvement gained is marginal and likely not worth the effort.

(2) In HPC applications, it is not sufficient to get "mostly" local storage. Quite often such applications "settle in" on a set of nodes and sit there and compute for an extremely long time. Any imbalance in execution times between the threads of such an application (e. g. due to one thread having one or more pages located on a remote node) results in the entire application being slowed down (A parallel application often runs only as quickly as its slowest thread.)

The application people running benchmarks for our systems insist on getting
100% of the storage they request as local to be truly backed by local storage.
Getting 98% of that figure is not acceptable. Because this patch kicks off
kswapd asynchronously from the storage request, the current page being
allocated can still end up being allocated off node. If one tries to solve this problem by setting the threshold lower (say at 20% of main memory), then
when the benchmark allocates 90% of memory we end up back in a situation
described above where any storage allocation will cause kswapd to run.
(Remember that even in an idle system, Linux is constantly scribbling stuff
out to disk -- so there are always allocations going on via way of __alloc_pages()>) Even then there is no guarentee that kswapd will be able to free up storage quickly enough to keep ahead of allocations. (The real problem, here, of course is that clean page cache pages can fill up the node, and cause off node allocations to occur; and we would like to free those instead.)

I have patches that I am currently working on to do the latter instead of the approach of this patch, and once we get those working I'd prefer to see those included in the mainline instead of this solution.

Signature · 9 lines
Best Regards,
Ray
-----------------------------------------------
                  Ray Bryant
512-453-9679 (work)         512-507-7807 (cell)
[email protected]             [email protected]
The box said: "Requires Windows 98 or better",
           so I installed Linux.
-----------------------------------------------