2011-02-13 3 views
2

Documentation/sysctl/vm.txt에서 설명을 읽음으로써 "lowmem_reserve_ratio"변수의 의미를 이해할 수 없습니다. 나는 또한 구글을 시도했지만, 발견 된 모든 설명은 vm.txt에있는 것과 정확히 똑같다./proc/sys/vm/lowmem_reserve_ratio 이해

sb가 설명하거나 링크를 언급하면 ​​정말 도움이 될 것입니다. 다음은 원래의 설명을 간다 : -

The lowmem_reserve_ratio is an array. You can see them by reading this file. 
- 
% cat /proc/sys/vm/lowmem_reserve_ratio 
256  256  32 
- 
Note: # of this elements is one fewer than number of zones. Because the highest 
     zone's value is not necessary for following calculation. 

But, these values are not used directly. The kernel calculates # of protection 
pages for each zones from them. These are shown as array of protection pages 
in /proc/zoneinfo like followings. (This is an example of x86-64 box). 
Each zone has an array of protection pages like this. 

- 
Node 0, zone  DMA 
    pages free  1355 
     min  3 
     low  3 
     high  4 
     : 
     : 
    numa_other 0 
     protection: (0, 2004, 2004, 2004) 
     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 
    pagesets 
    cpu: 0 pcp: 0 
     : 
- 
These protections are added to score to judge whether this zone should be used 
for page allocation or should be reclaimed. 

In this example, if normal pages (index=2) are required to this DMA zone and 
watermark[WMARK_HIGH] is used for watermark, the kernel judges this zone should 
not be used because pages_free(1355) is smaller than watermark + protection[2] 
(4 + 2004 = 2008). If this protection value is 0, this zone would be used for 
normal page requirement. If requirement is DMA zone(index=0), protection[0] 
(=0) is used. 
zone[i]'s protection[j] is calculated by following expression. 

(i < j): 
    zone[i]->protection[j] 
    = (total sums of present_pages from zone[i+1] to zone[j] on the node) 
    /lowmem_reserve_ratio[i]; 
(i = j): 
    (should not be protected. = 0; 
(i > j): 
    (not necessary, but looks 0) 

The default values of lowmem_reserve_ratio[i] are 
    256 (if zone[i] means DMA or DMA32 zone) 
    32 (others). 
As above expression, they are reciprocal number of ratio. 
256 means 1/256. # of protection pages becomes about "0.39%" of total present 
pages of higher zones on the node. 

If you would like to protect more pages, smaller values are effective. 
The minimum value is 1 (1/1 -> 100%). 

답변

2

당신이, 내가 (많이) 인터넷 검색 및 (또는 그렇지 않을 수도) 커널 문서보다 더 이해할 수 있습니다 this page APON 발견과 같은 문제가.

은 (는 읽을 수 있기 때문에 내가 여기 인용하지 않음)

1

정말 너무 혼란 해당 문서의 표현을 발견했다. 에있는 출처를 살펴보면보다 직접적인 설명을 해보겠습니다.

인용 한 페이지에서 말했듯이이 숫자는 "비율의 역수"입니다. 다르게 말하면 :이 수는 약수입니다. 따라서 노드의 특정 영역에 대한 예약 페이지를 계산할 때 해당 노드의 페이지 합계를 해당 영역보다 높게 설정하고 제공된 약수로 나누면 해당 영역에 대해 예약 할 페이지 수가 제한됩니다.

예 : Zone Normal에 768 MiB가 있고 Zone HighMem에 256 MiB가있는 1 GiB 노드 (영역 DMA가 없다고 가정)를 가정 해 봅니다. 기본 highmem reserve "ratio"(제수)가 32라고 가정합시다. 그리고 전형적인 4 KiB 페이지 크기를 가정합시다. 지역 일반 (단지 Highmem라는)에 비해 "더 높은"영역의

  1. 합계 : 이제 우리는 정상 영역에 대한 예비 영역을 계산할 수 256 MiB 크기 = (1,024 킬로바이트/1은 MIB) * (1 페이지/4 킬로바이트) = 65536 페이지
  2. 이 노드의 영역 표준에 예약 된 영역 : 65536 페이지/32 = 2048 페이지 = 8 MiB.

영역과 노드를 추가 할 때 개념은 동일하게 유지됩니다. 예약 된 크기는 페이지에 있음을 기억하십시오. 페이지의 일부를 예약하지 마십시오.