Re: Is swap really needed when RAM's aplenty



On 08/19/2010 03:22 PM, Michael Hennebry wrote:
On Thu, 19 Aug 2010, Gregory Hosler wrote:

If the memory gets fragged and the kernel wants to defrag, e.g. for a memory
request from an application, in order to defrag any "dirty" data portions (those
pages that have been written to), the kernel *requires* there to be swap.
Otherwise there is no place to write the dirty pages out, in order to read them
in elsewhere.

I didn't realize that memory could get fragged.
I'd thought that one reason for virtual memory
was allowing pages to be renumbered at will,
the kernel's will, of course.


Virtual memory allows us to present a simple, linear address space to
running processes even though the physical memory backing it may be
highly non-contiguous (or not even present).

Unfortunately someone still has to manage the pool of available physical
memory pages ("page frames") and it is possible for this space to become
fragmented over time as repeated allocation/deallocation cycles create
"holes" in the available memory.

The kernel implements the buddy algorithm in the page allocator to try
to minimize external fragmentation but some workloads can still lead to
a lot of pages on the low-order free lists and no larger blocks to
satisfy bigger requests.

Forcing everything out to swap and then pulling it back in is one crude
way of forcing a level of de-fragmentation. There was some discussion on
linux-mm.org of implementing novel de-fragmentation and fragmentation
avoidance techniques a while back but I'm not sure where those
initiatives are at the moment.

Regards,
Bryn.
--
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines



Relevant Pages

  • Re: How does Debian load the kernel modules
    ... Windows stupidly swaps the System memory by default. ... Does linux force the modules to stay in RAM or does it try to swap them when it's RAM-hungry? ... I think linux does not swap kernel memory due to its "monolitic kernel" ...
    (Debian-User)
  • Re: Kernel option: SWAP
    ... > recompiling the kernel. ... > for socalled swap devices or swap files in your kernel that are ... Linux uses is paging space) is space on the hard drive for the memory ...
    (Fedora)
  • Re: swap on large-mem boxes
    ... of a server's physical memory (yes, limiting user memory can help here, ... the OOM killer eventually anyway. ... If you have 32GB of swap (if you ... in the kernel, and ought to be fairly straightforward to write. ...
    (comp.os.linux.misc)
  • Re: limitiation on memory allocation
    ... arrays that are considerably bigger than the physical memory size? ... Yes, upto kernel limits... ... swap space is completely separate from the rest of the equation. ... GB of memory total (for obvious reasons). ...
    (freebsd-questions)
  • Re: [ck] Re: 2.6.20-ck1
    ... > Has anyone tried booting a kernel with the various patches in question ... > when the kernel thinks it has relatively little memory ... performance improvements for these machines are based on numbers, ... Is it possible to command a program's memory usage be put into swap on ...
    (Linux-Kernel)