요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
=====================
Free Page Reporting
=====================
Free page reporting is an API by which a device can register to receive
lists of pages that are currently unused by the system. This is useful in
the case of virtualization where a guest is then able to use this data to
notify the hypervisor that it is no longer using certain pages in memory.
For the driver, typically a balloon driver, to use of this functionality
it will allocate and initialize a page_reporting_dev_info structure. The
field within the structure it will populate is the "report" function
pointer used to process the scatterlist. It must also guarantee that it can
handle at least PAGE_REPORTING_CAPACITY worth of scatterlist entries per
call to the function. A call to page_reporting_register will register the
page reporting interface with the reporting framework assuming no other
page reporting devices are already registered.
Once registered the page reporting API will begin reporting batches of
pages to the driver. The API will start reporting pages 2 seconds after
the interface is registered and will continue to do so 2 seconds after any
page of a sufficiently high order is freed.
Pages reported will be stored in the scatterlist passed to the reporting
function with the final entry having the end bit set in entry nent - 1.
While pages are being processed by the report function they will not be
accessible to the allocator. Once the report function has been completed
the pages will be returned to the free area from which they were obtained.
Prior to removing a driver that is making use of free page reporting it
is necessary to call page_reporting_unregister to have the
page_reporting_dev_info structure that is currently in use by free page
reporting removed. Doing this will prevent further reports from being
issued via the interface. If another driver or the same driver is
registered it is possible for it to resume where the previous driver had
left off in terms of reporting free pages.
Alexander Duyck, Dec 04, 2019
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
Free page reporting 개요
1-8Free page reporting은 장치가 시스템에서 현재 사용하지 않는 page 목록을 받도록 등록하는 API입니다. 가상화 환경에서는 guest가 이 정보를 이용해 더 이상 사용하지 않는 메모리 page를 hypervisor에 알릴 수 있습니다.
=====================
Free Page Reporting
=====================
Free page reporting is an API by which a device can register to receive
lists of pages that are currently unused by the system. This is useful in
the case of virtualization where a guest is then able to use this data to
notify the hypervisor that it is no longer using certain pages in memory.
Driver 등록
9-17이 기능을 사용하는 driver는 보통 balloon driver이며, `page_reporting_dev_info` 구조체를 할당하고 초기화합니다. 구조체의 `report` 함수 pointer를 채워 scatterlist를 처리하게 합니다.
Driver는 함수 호출 한 번마다 적어도 `PAGE_REPORTING_CAPACITY`개의 scatterlist entry를 처리할 수 있어야 합니다. 이미 등록된 다른 page reporting device가 없다면 `page_reporting_register()` 호출이 reporting framework에 interface를 등록합니다.
For the driver, typically a balloon driver, to use of this functionality
it will allocate and initialize a page_reporting_dev_info structure. The
field within the structure it will populate is the "report" function
pointer used to process the scatterlist. It must also guarantee that it can
handle at least PAGE_REPORTING_CAPACITY worth of scatterlist entries per
call to the function. A call to page_reporting_register will register the
page reporting interface with the reporting framework assuming no other
page reporting devices are already registered.
Page batch 보고와 allocator 격리
18-28등록이 끝나면 page reporting API가 driver에 page batch를 보고하기 시작합니다. Interface 등록 2초 뒤 첫 보고를 시작하며, 충분히 높은 order의 page가 해제될 때마다 2초 뒤 다시 보고합니다.
보고되는 page는 reporting 함수에 전달되는 scatterlist에 저장되고 마지막 entry인 `nent - 1`에는 end bit가 설정됩니다. `report` 함수가 page를 처리하는 동안 allocator는 그 page에 접근할 수 없습니다. 함수가 끝나면 page는 가져온 free area로 반환됩니다.
Once registered the page reporting API will begin reporting batches of
pages to the driver. The API will start reporting pages 2 seconds after
the interface is registered and will continue to do so 2 seconds after any
page of a sufficiently high order is freed.
Pages reported will be stored in the scatterlist passed to the reporting
function with the final entry having the end bit set in entry nent - 1.
While pages are being processed by the report function they will not be
accessible to the allocator. Once the report function has been completed
the pages will be returned to the free area from which they were obtained.
Driver 제거와 등록 해제
29-38Free page reporting을 사용하는 driver를 제거하기 전에 `page_reporting_unregister()`를 호출해 현재 사용 중인 `page_reporting_dev_info` 구조체를 제거해야 합니다. 그러면 interface를 통한 추가 보고가 중단됩니다.
다른 driver 또는 같은 driver가 다시 등록되면 이전 driver가 free page 보고를 중단한 지점부터 재개할 수 있습니다. 이 문서는 Alexander Duyck가 2019년 12월 4일 작성했습니다.
Prior to removing a driver that is making use of free page reporting it
is necessary to call page_reporting_unregister to have the
page_reporting_dev_info structure that is currently in use by free page
reporting removed. Doing this will prevent further reports from being
issued via the interface. If another driver or the same driver is
registered it is possible for it to resume where the previous driver had
left off in terms of reporting free pages.
Alexander Duyck, Dec 04, 2019
요약·해설
free_page_reporting.rst:1-38Free page reporting은 allocator의 free page를 잠시 격리해 device에 scatterlist batch로 전달하고, 처리 뒤 원래 free area로 돌려놓습니다. 가상화에서는 guest가 더 이상 사용하지 않는 page를 hypervisor에 알려 메모리를 효율적으로 회수하게 합니다.
등록된 driver가 batch를 처리하는 동안 page는 allocator에서 보이지 않습니다.