1 / 5

numa_policy_init

CONFIG_NUMA 가 정의되어 있을 경우 수행 1. 메모리 정책과 , SPREAD NODE 관련 슬랩을 생성 2. Interleave node 에 대한 mempolicy 를 만들어 현 task_struct->mempolicy 에 연결해줌. init/main.c. numa_policy_init. numa_policy 와 shared_policy_node 에 대한 slab 을 생성. kmem_cache_create ().

london
Télécharger la présentation

numa_policy_init

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CONFIG_NUMA가 정의되어 있을 경우 수행 1.메모리 정책과, SPREAD NODE관련 슬랩을 생성 2. Interleave node에 대한 mempolicy를 만들어 현 task_struct->mempolicy에 연결해줌 init/main.c numa_policy_init numa_policy와 shared_policy_node 에 대한 slab을 생성 kmem_cache_create() HIGHMEM영역을 갖는 노드를 순회하여 가장 큰 노드의 번호(prefered nid)와 총페이지수를 기억해두고 각 노드에 대해서 16MB이상의 크기를 갖는다면 interleave_nodes비트맵에 해당 노드번호를 1로 세팅함. 만약 모든 노드의 크기가 16MB보다 작다면 순회한 노드중 가장 큰 페이지수를 갖는 노드(prefered nid)를 interleave_nodes 비트맵에 세팅함 node_present_pages() node_set MPOL_INTERLEAVE정책(struct mempolicy)을 생성하여 현재 태스크의 메모리 정책(current->mempolicy)으로 지정하고flag를 PF_MEMPOLICY로 설정해둠 (PF_MEMPOLICY: NON-Default NUMA Memory Policy) do_set_mempolicy

  2. init/main.c Architecture 별로 override됨 late_time_init BoGo mips값을 관리하여 1 jiffy동안 얼마나 많은 cpu 사이클이 소요되는지 측정하여 loops_per_jiffy값을 구해냄 calibrate_delay • Kernel이 BogoMIPS값을 결정하기위한 함수 • BogoMIPS • MIPS는 Millons of Instruction Per Second의 약자이다. 계산 능력을 나타내는 지표로 사용된다. BogoMIPS는 리누즈 토발즈가 만들어낸 것으로서, 커널은 부팅시에 현 시스템에서 busy loop이 얼마나 빠른지에 대해 기록한 값이며 Bogo 는 bogus(가짜)를 의미한다. • 이렇게 측정된 bogoMIPS를 가지고 프로세서의 속도를 하며이것은 전혀 과학적이값은 아니다. • 리누즈에 의하면 이 BogoMIPS값은 다음의 유용성이 있다. • 디버깅에 유용 • Computer cache와 turbo button 이 제대로 작동하는지 확인할수 있음. • 실제적으로 BogoMIPS는 cpu 가 1 jiffy 동안 수행하는 empty loop의 횟수 값이다.

  3. init_pid_ns namespace에서 pid 0이 사용할 페이지를 Pidmap배열의 0번 index에서 page를 할당받고 pid 0을 사용중으로 표시한 후 pid 구조체의 슬랩캐시(pid_cachep)를 생성함 PID namespace PID namespace는 태스크들의 집합을 만들도록 해준다. 즉 다른 namespace의 태스크들이 같은 ID를 가질수 있다. 이 특징은 hosts사이의 이주를 위해 필수조건이다. PID namespace를 가짐으로써 프로세스는 PID값을 유지하면서 다른 host로 이동할 수 있다. 이특징이 없다면 호스트간 태스크 이주는 빈번히 실패할 것이다. 같은 ID를 가지는 프로세스가 존재할 수 있기 때문이다. init/main.c pidmap_init Structpidmap { atomic_tnr_free; void *page; } struct pid_namespace { .. struct pidmap pidmap[PIDMAP_ENTRIES]; struct task_struct *child_reaper; struct kmem_cache *pid_cachep; unsigned int level; .. } Structupid { int nr; structpid_namespace *ns; structhlist_nodepid_chain; } struct task_struct { .. pid_t pid; pid_t tgid; struct pid_link pids[PIDTYPE_MAX]; struct list_head thread_group; .. } structpid_link { structhlist_node node; structpid *pid; } Struct pid { ... Struct hlist_head tasks[PIDTYPE_MAX] struct upid numbers[1]; … }

  4. Index_bit_to_maxindex배열에 PST의 index_bits에서 저장될 수 있는 heap_index를 0부터 1,3,7,15… 2^31-1, 2^32값으로 세팅함으로써 maximum heap index를 구하는데 사용할 수 있도록 해줌. init/main.c prio_tree_init PST(radix priority search tree)는 Interval을 저장하는데 쓸모있으며 heap tree와 radix tree를 잘 혼합한 형태이다. 사용되는 예를 보자면 vma를 file pages의 closed interval[offset_begin,offset_end] 로 생각해봤을 때 file에 맵된 모든 vma를 PST에 저장함으로써 O(log n + m) 시간에 주어진 interval(연속적인 파일페이지)을 선택할 수 있다. log n :PST 트리의 높이, m : 저장된 interval의 개수 anon_vma 구조체의슬랩캐시 생성 anon_vma_init page->mapping ( if page mapped as anonymous memory, it points to anon_vma_object) page Reverse-mapping virtual memory(“rmap“) rmap은 swapping이 요구될때 커널이 메모리를 free하는 것을 쉽게 만드는 목적이였다. 이를 위해 reverse pointer chain에서 각 포인터는 페이지를 참조하는 페이지테이블을 가리킨다. rmap chain에 의해 커널은 빠르게 주어진 페이지의 모든 매핑을 찾을수 있고 unmap 이후 page를 swap out할수 있다. anonymous page를 참조하는 다수의 VMA를 anon_vma를 통해 연결시키는데 이것은 page->mapping 포인터가 anon_vma를 가리킴으로써 커널은 list를 순회하여 연관된 VMA structure를 찾을 수 있다. anon_vma vm_area_struct vm_area_struct vm_area_struct

  5. init/main.c LSM(Linux Security Module)에서 사용될 cache를 위해 struct cred구조체로 슬랩캐시를 생성함 cred_init LSM(Linux Security Modules)는 리눅스 커널이 적재가능한 커널모듈로서 구현되어야 하는 다양한 access-control-model을 허용하기 위해 경량의 다목적 접근 제어 프레임워크로 구현되었다. 그 중에는 Security-Enhanced Linux(SELinux), Domain and Type Enforcement(DTE), Linux Intrusion Detection System(LIDS)가 있으며. LSM은 향상된 보안 정책을 커널 모듈로 적재가능하다.

More Related