On Thu, 2007-06-28 at 15:24 +0200, Rob van der Heij wrote:
> A higher value of swappiness means that when Linux memory management
> needs some free memory, it is more willing to swap out a process than
> to purge data in cache.

The definition of swappiness is murky. The relevant code snippets and
comments from the source:

                /*
                 * `distress' is a measure of how much trouble we're having
                 * reclaiming pages.  0 -> no problems.  100 -> great trouble.
                 */
                distress = 100 >> min(zone->prev_priority, priority);

                /*
                 * The point of this algorithm is to decide when to start
                 * reclaiming mapped memory instead of just pagecache.  Work out
                 * how much memory
                 * is mapped.
                 */
                mapped_ratio = ((global_page_state(NR_FILE_MAPPED) +
                                global_page_state(NR_ANON_PAGES)) * 100) /
                                        vm_total_pages;
...
                /*
                 * Now decide how much we really want to unmap some pages.  The
                 * mapped ratio is downgraded - just because there's a lot of
                 * mapped memory doesn't necessarily mean that page reclaim
                 * isn't succeeding.
                 *
                 * The distress ratio is important - we don't want to start
                 * going oom.
                 *
                 * A 100% value of vm_swappiness overrides this algorithm
                 * altogether.
                 */
                swap_tendency = mapped_ratio / 2 + distress + sc->swappiness;
...
                /*
                 * Now use this metric to decide whether to start moving mapped
                 * memory onto the inactive list.
                 */
                if (swap_tendency >= 100)
force_reclaim_mapped:
                        reclaim_mapped = 1;


If the distress -- which is defined in terms of zone priorities --
reaches a certain limit, the system starts to swap. try_to_free_pages
repeatedly scans the active/inactive list with a priority value that
starts at 12. The priority is decreased from run to run if not enough
pages can be freed. Black magic.

--
blue skies,
  Martin.

"Reality continues to ruin my life." - Calvin.

----------------------------------------------------------------------
For LINUX-390 subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390

Reply via email to