Ядро Linux в комментариях

       

Mm/swap.c


37397 /* 37398 * linux/mm/swap.c 37399 * 37400 * Copyright (C) 1991, 1992, 1993, 1994 Linus Torvalds 37401 */ 37402 37403 /* This file contains the default values for the 37404 * opereation of the Linux VM subsystem. Fine-tuning 37405 * documentation can be found in 37406 * linux/Documentation/sysctl/vm.txt. 37407 * Started 18.12.91 37408 * Swap aging added 23.2.95, Stephen Tweedie. 37409 * Buffermem limits added 12.3.98, Rik van Riel. 37410 */ 37411 37412 #include <linux/mm.h> 37413 #include <linux/kernel_stat.h> 37414 #include <linux/swap.h> 37415 #include <linux/swapctl.h> 37416 #include <linux/pagemap.h> 37417 #include <linux/init.h> 37418 37419 #include <asm/dma.h> 37420 #include <asm/uaccess.h> /* for copy_to/from_user */ 37421 #include <asm/pgtable.h> 37422 37423 /* We identify three levels of free memory. We never let 37424 * free mem fall below the freepages.min except for 37425 * atomic allocations. We start background swapping if 37426 * we fall below freepages.high free pages, and we begin 37427 * intensive swapping below freepages.low. 37428 * 37429 * These values are there to keep GCC from 37430 * complaining. Actual initialization is done in 37431 * mm/page_alloc.c or arch/sparc(64)/mm/init.c. */ 37432 freepages_t freepages = { 37433 48, /* freepages.min */ 37434 96, /* freepages.low */ 37435 144 /* freepages.high */ 37436 }; 37437 37438 /* How many pages do we try to swap or page in/out 37439 * together? */ 37440 /* Default modified in swap_setup() */ 37441 int page_cluster = 4; 37442 37443 /* We track the number of pages currently being 37444 * asynchronously swapped out, so that we don't try to 37445 * swap TOO many pages out at once */ 37446 atomic_t nr_async_pages = ATOMIC_INIT(0); 37447 37448 buffer_mem_t buffer_mem = { 37449 2, /* minimum percent buffer */ 37450 10, /* borrow percent buffer */ 37451 60 /* maximum percent buffer */ 37452 }; 37453 37454 buffer_mem_t page_cache = { 37455 2, /* minimum percent page cache */ 37456 15, /* borrow percent page cache */ 37457 75 /* maximum */ 37458 }; 37459 37460 pager_daemon_t pager_daemon = { 37461 512, /* base # for calculating the number of tries */ 37462 SWAP_CLUSTER_MAX, /* minimum number of tries */ 37463 SWAP_CLUSTER_MAX, /* swap I/O in clusters of this sz */ 37464 }; 37465 37466 /* Perform any setup for the swap system */ 37467 37468 void __init swap_setup(void) 37469 { 37470 /* Use a smaller cluster for memory <16MB or <32MB */ 37471 if (num_physpages < ((16 * 1024 * 1024) >> PAGE_SHIFT)) 37472 page_cluster = 2; 37473 else if (num_physpages < 37474 ((32 * 1024 * 1024) >> PAGE_SHIFT)) 37475 page_cluster = 3; 37476 else 37477 page_cluster = 4; 37478 }



Содержание раздела