2015년 10월 3일 토요일

[Linux Kernel] 118주차(2015.10.03) proc_caches_init();

ARM10C : 118 주차
일시 : 2015.10.03 (118 주차 스터디 진행)
모임명 : NAVER_개발자커뮤니티지원_10차ARM-C
장소 : 토즈 타워점
장소지원 : NAVER 개발자 커뮤니티 지원 프로그램
참여인원 : 3명

118 주차 진도

  • 9월 19일 진도로 다시 복습을 했습니다.
  • anon_vma_init();
    • anon vma 를 사용하기 위한 kmem_cache 할당자 초기화 수행
  • thread_info_cache_init();
    • // null function
  • cred_init();
    • // credentials 를 사용하기 위한 kmem_cache 할당자 초기화 수행
  • fork_init(totalram_pages);
    • // totalram_pages: 총 free된 page 수
    • // task_struct 를 사용하기 위한 kmem_cache 할당자 초기화 수행
    • // max_threads값을 계산하여 init_task에 threads값의 limit 값 설정함

main.c::start_kernel()

// ARM10C 20130824
asmlinkage void __init start_kernel(void)
{
    char * command_line;
    extern const struct kernel_param __start___param[], __stop___param[];
    // ATAG,DTB 정보로 사용
...

// 2015/09/19 시작

    anon_vma_init();
    // anon vma 를 사용하기 위한 kmem_cache 할당자 초기화 수행

#ifdef CONFIG_X86 // CONFIG_X86=n
    if (efi_enabled(EFI_RUNTIME_SERVICES))
        efi_enter_virtual_mode();
#endif
    thread_info_cache_init(); // null function
    cred_init();
    // credentials 를 사용하기 위한 kmem_cache 할당자 초기화 수행

    // totalram_pages: 총 free된 page 수
    fork_init(totalram_pages);
    // task_struct 를 사용하기 위한 kmem_cache 할당자 초기화 수행
    // max_threads값을 계산하여 init_task에 threads값의 limit 값 설정함

    proc_caches_init();

fork.c::proc_caches_init()

  • call :
    • start_kernel()->proc_caches_init()
  • struct sighand_struct 할당
// ARM10C 20150919
void __init proc_caches_init(void)
{
    // sizeof(struct sighand_struct): 1324 bytes,
    // SLAB_HWCACHE_ALIGN: 0x00002000UL, SLAB_PANIC: 0x00040000UL, SLAB_DESTROY_BY_RCU: 0x00080000UL, SLAB_NOTRACK: 0x00000000UL
    // kmem_cache_create("sighand_cache", 1324, 0, 0xc2000, sighand_ctor): kmem_cache#14
    sighand_cachep = kmem_cache_create("sighand_cache",
            sizeof(struct sighand_struct), 0,
            SLAB_HWCACHE_ALIGN|SLAB_PANIC|SLAB_DESTROY_BY_RCU|
            SLAB_NOTRACK, sighand_ctor);
// ARM10C 20150919
// "sighand_cache", sizeof(struct sighand_struct): 1324 bytes, 0, 0xc2000, sighand_ctor
struct kmem_cache *
kmem_cache_create(const char *name, size_t size, size_t align,
          unsigned long flags, void (*ctor)(void *))
{
    // name: "sighand_cache", size: 1324, align: 0, flags: 0xc2000, ctor: sighand_ctor
    // kmem_cache_create_memcg(NULL, "sighand_cache", 1324, 0, 0xc2000, sighand_ctor): kmem_cache#14
    return kmem_cache_create_memcg(NULL, name, size, align, flags, ctor, NULL);
    // return kmem_cache#14
  • signal_cache 할당
// ARM10C 20150919
void __init proc_caches_init(void)
{
    // sizeof(struct sighand_struct): 1324 bytes,
    // SLAB_HWCACHE_ALIGN: 0x00002000UL, SLAB_PANIC: 0x00040000UL, SLAB_DESTROY_BY_RCU: 0x00080000UL, SLAB_NOTRACK: 0x00000000UL
    // kmem_cache_create("sighand_cache", 1324, 0, 0xc2000, sighand_ctor): kmem_cache#14
    sighand_cachep = kmem_cache_create("sighand_cache",
            sizeof(struct sighand_struct), 0,
            SLAB_HWCACHE_ALIGN|SLAB_PANIC|SLAB_DESTROY_BY_RCU|
            SLAB_NOTRACK, sighand_ctor);
    // sighand_cachep: kmem_cache#14

    // sizeof(struct signal_struct): 536 bytes,
    // SLAB_HWCACHE_ALIGN: 0x00002000UL, SLAB_PANIC: 0x00040000UL, SLAB_NOTRACK: 0x00000000UL
    // kmem_cache_create("signal_cache", 536, 0, 0x42000, NULL): kmem_cache#13
    signal_cachep = kmem_cache_create("signal_cache",
            sizeof(struct signal_struct), 0,
            SLAB_HWCACHE_ALIGN|SLAB_PANIC|SLAB_NOTRACK, NULL);
// ARM10C 20150919
// sizeof(struct signal_struct): 536 bytes,
// SLAB_HWCACHE_ALIGN: 0x00002000UL, SLAB_PANIC: 0x00040000UL, SLAB_NOTRACK: 0x00000000UL
// kmem_cache_create("signal_cache", 536, 0, 0x42000, NULL): kmem_cache#13
struct kmem_cache *
kmem_cache_create(const char *name, size_t size, size_t align,
          unsigned long flags, void (*ctor)(void *))
{

    // sizeof(struct signal_struct): 536 bytes,
    // SLAB_HWCACHE_ALIGN: 0x00002000UL, SLAB_PANIC: 0x00040000UL, SLAB_NOTRACK: 0x00000000UL
    // kmem_cache_create("signal_cache", 536, 0, 0x42000, NULL): kmem_cache#13
    return kmem_cache_create_memcg(NULL, name, size, align, flags, ctor, NULL);
    // return kmem_cache#13
}
  • files_cache 할당
// ARM10C 20150919
void __init proc_caches_init(void)
{
    // sizeof(struct sighand_struct): 1324 bytes,
    // SLAB_HWCACHE_ALIGN: 0x00002000UL, SLAB_PANIC: 0x00040000UL, SLAB_DESTROY_BY_RCU: 0x00080000UL, SLAB_NOTRACK: 0x00000000UL
    // kmem_cache_create("sighand_cache", 1324, 0, 0xc2000, sighand_ctor): kmem_cache#14
    sighand_cachep = kmem_cache_create("sighand_cache",
            sizeof(struct sighand_struct), 0,
            SLAB_HWCACHE_ALIGN|SLAB_PANIC|SLAB_DESTROY_BY_RCU|
            SLAB_NOTRACK, sighand_ctor);
    // sighand_cachep: kmem_cache#14

    // sizeof(struct signal_struct): 536 bytes,
    // SLAB_HWCACHE_ALIGN: 0x00002000UL, SLAB_PANIC: 0x00040000UL, SLAB_NOTRACK: 0x00000000UL
    // kmem_cache_create("signal_cache", 536, 0, 0x42000, NULL): kmem_cache#13
    signal_cachep = kmem_cache_create("signal_cache",
            sizeof(struct signal_struct), 0,
            SLAB_HWCACHE_ALIGN|SLAB_PANIC|SLAB_NOTRACK, NULL);

    // sizeof(struct files_struct): 188 bytes,
    // SLAB_HWCACHE_ALIGN: 0x00002000UL, SLAB_PANIC: 0x00040000UL, SLAB_NOTRACK: 0x00000000UL
    // kmem_cache_create("files_cache", 188, 0, 0x42000, NULL): kmem_cache#12
    files_cachep = kmem_cache_create("files_cache",
            sizeof(struct files_struct), 0,
            SLAB_HWCACHE_ALIGN|SLAB_PANIC|SLAB_NOTRACK, NULL);
    // files_cachep: kmem_cache#12
// ARM10C 20150919
// "fs_cache", sizeof(struct fs_struct): 48 bytes, 0, 0x42000, NULL
struct kmem_cache *
kmem_cache_create(const char *name, size_t size, size_t align,
          unsigned long flags, void (*ctor)(void *))
{

    // name: "files_cache", size: 188, align: 0, flags: 0x42000, ctor: NULL
    // kmem_cache_create_memcg(NULL, "files_cache", 188, 0, 0x42000, NULL): kmem_cache#12
    return kmem_cache_create_memcg(NULL, name, size, align, flags, ctor, NULL);
    // return kmem_cache#12
}
  • fs_struct 할당
// ARM10C 20150919
void __init proc_caches_init(void)
{
    // sizeof(struct sighand_struct): 1324 bytes,
    // SLAB_HWCACHE_ALIGN: 0x00002000UL, SLAB_PANIC: 0x00040000UL, SLAB_DESTROY_BY_RCU: 0x00080000UL, SLAB_NOTRACK: 0x00000000UL
    // kmem_cache_create("sighand_cache", 1324, 0, 0xc2000, sighand_ctor): kmem_cache#14
    sighand_cachep = kmem_cache_create("sighand_cache",
            sizeof(struct sighand_struct), 0,
            SLAB_HWCACHE_ALIGN|SLAB_PANIC|SLAB_DESTROY_BY_RCU|
            SLAB_NOTRACK, sighand_ctor);
    // sighand_cachep: kmem_cache#14

    // sizeof(struct signal_struct): 536 bytes,
    // SLAB_HWCACHE_ALIGN: 0x00002000UL, SLAB_PANIC: 0x00040000UL, SLAB_NOTRACK: 0x00000000UL
    // kmem_cache_create("signal_cache", 536, 0, 0x42000, NULL): kmem_cache#13
    signal_cachep = kmem_cache_create("signal_cache",
            sizeof(struct signal_struct), 0,
            SLAB_HWCACHE_ALIGN|SLAB_PANIC|SLAB_NOTRACK, NULL);

    // sizeof(struct files_struct): 188 bytes,
    // SLAB_HWCACHE_ALIGN: 0x00002000UL, SLAB_PANIC: 0x00040000UL, SLAB_NOTRACK: 0x00000000UL
    // kmem_cache_create("files_cache", 188, 0, 0x42000, NULL): kmem_cache#12
    files_cachep = kmem_cache_create("files_cache",
            sizeof(struct files_struct), 0,
            SLAB_HWCACHE_ALIGN|SLAB_PANIC|SLAB_NOTRACK, NULL);
    // files_cachep: kmem_cache#12

    // sizeof(struct fs_struct): 48 bytes,
    // SLAB_HWCACHE_ALIGN: 0x00002000UL, SLAB_PANIC: 0x00040000UL, SLAB_NOTRACK: 0x00000000UL
    // kmem_cache_create("fs_cache", 48, 0, 0x42000, NULL): kmem_cache#11
    fs_cachep = kmem_cache_create("fs_cache",
            sizeof(struct fs_struct), 0,
            SLAB_HWCACHE_ALIGN|SLAB_PANIC|SLAB_NOTRACK, NULL);
// ARM10C 20150919
// "fs_cache", sizeof(struct fs_struct): 48 bytes, 0, 0x42000, NULL
struct kmem_cache *
kmem_cache_create(const char *name, size_t size, size_t align,
          unsigned long flags, void (*ctor)(void *))
{

    // name: "fs_cache", size: 48, align: 0, flags: 0x42000, ctor: NULL
    // kmem_cache_create_memcg(NULL, "fs_cache", 48, 0, 0x42000, NULL): kmem_cache#11
    return kmem_cache_create_memcg(NULL, name, size, align, flags, ctor, NULL);
    // return kmem_cache#11
}
  • mm_cache 할당
// ARM10C 20150919
void __init proc_caches_init(void)
{
    // sizeof(struct sighand_struct): 1324 bytes,
    // SLAB_HWCACHE_ALIGN: 0x00002000UL, SLAB_PANIC: 0x00040000UL, SLAB_DESTROY_BY_RCU: 0x00080000UL, SLAB_NOTRACK: 0x00000000UL
    // kmem_cache_create("sighand_cache", 1324, 0, 0xc2000, sighand_ctor): kmem_cache#14
    sighand_cachep = kmem_cache_create("sighand_cache",
            sizeof(struct sighand_struct), 0,
            SLAB_HWCACHE_ALIGN|SLAB_PANIC|SLAB_DESTROY_BY_RCU|
            SLAB_NOTRACK, sighand_ctor);
    // sighand_cachep: kmem_cache#14

    // sizeof(struct signal_struct): 536 bytes,
    // SLAB_HWCACHE_ALIGN: 0x00002000UL, SLAB_PANIC: 0x00040000UL, SLAB_NOTRACK: 0x00000000UL
    // kmem_cache_create("signal_cache", 536, 0, 0x42000, NULL): kmem_cache#13
    signal_cachep = kmem_cache_create("signal_cache",
            sizeof(struct signal_struct), 0,
            SLAB_HWCACHE_ALIGN|SLAB_PANIC|SLAB_NOTRACK, NULL);

    // sizeof(struct files_struct): 188 bytes,
    // SLAB_HWCACHE_ALIGN: 0x00002000UL, SLAB_PANIC: 0x00040000UL, SLAB_NOTRACK: 0x00000000UL
    // kmem_cache_create("files_cache", 188, 0, 0x42000, NULL): kmem_cache#12
    files_cachep = kmem_cache_create("files_cache",
            sizeof(struct files_struct), 0,
            SLAB_HWCACHE_ALIGN|SLAB_PANIC|SLAB_NOTRACK, NULL);
    // files_cachep: kmem_cache#12

    // sizeof(struct fs_struct): 48 bytes,
    // SLAB_HWCACHE_ALIGN: 0x00002000UL, SLAB_PANIC: 0x00040000UL, SLAB_NOTRACK: 0x00000000UL
    // kmem_cache_create("fs_cache", 48, 0, 0x42000, NULL): kmem_cache#11
    fs_cachep = kmem_cache_create("fs_cache",
            sizeof(struct fs_struct), 0,
            SLAB_HWCACHE_ALIGN|SLAB_PANIC|SLAB_NOTRACK, NULL);
    // fs_cachep: kmem_cache#11
    /*
     * FIXME! The "sizeof(struct mm_struct)" currently includes the
     * whole struct cpumask for the OFFSTACK case. We could change
     * this to *only* allocate as much of it as required by the
     * maximum number of CPU's we can ever have.  The cpumask_allocation
     * is at the end of the structure, exactly for that reason.
     */
    // sizeof(struct mm_struct): 428 bytes, ARCH_MIN_MMSTRUCT_ALIGN: 0
    // SLAB_HWCACHE_ALIGN: 0x00002000UL, SLAB_PANIC: 0x00040000UL, SLAB_NOTRACK: 0x00000000UL
    // kmem_cache_create("mm_struct", 428, 0, 0x42000, NULL): kmem_cache#10
    mm_cachep = kmem_cache_create("mm_struct",
            sizeof(struct mm_struct), ARCH_MIN_MMSTRUCT_ALIGN,
            SLAB_HWCACHE_ALIGN|SLAB_PANIC|SLAB_NOTRACK, NULL);
// ARM10C 20150919
// "mm_struct", sizeof(struct mm_struct): 428 bytes, 0, 0x42000, NULL
struct kmem_cache *
kmem_cache_create(const char *name, size_t size, size_t align,
          unsigned long flags, void (*ctor)(void *))
{

    // name: "mm_struct", size: 428, align: 0, flags: 0x42000, ctor: NULL
    // kmem_cache_create_memcg(NULL, "mm_struct", 428, 0, 0x42000, NULL): kmem_cache#10
    return kmem_cache_create_memcg(NULL, name, size, align, flags, ctor, NULL);
    // return kmem_cache#10
}
  • vm_area_cachep 할당
// ARM10C 20150919
void __init proc_caches_init(void)
{
    // sizeof(struct sighand_struct): 1324 bytes,
    // SLAB_HWCACHE_ALIGN: 0x00002000UL, SLAB_PANIC: 0x00040000UL, SLAB_DESTROY_BY_RCU: 0x00080000UL, SLAB_NOTRACK: 0x00000000UL
    // kmem_cache_create("sighand_cache", 1324, 0, 0xc2000, sighand_ctor): kmem_cache#14
    sighand_cachep = kmem_cache_create("sighand_cache",
            sizeof(struct sighand_struct), 0,
            SLAB_HWCACHE_ALIGN|SLAB_PANIC|SLAB_DESTROY_BY_RCU|
            SLAB_NOTRACK, sighand_ctor);
    // sighand_cachep: kmem_cache#14

    // sizeof(struct signal_struct): 536 bytes,
    // SLAB_HWCACHE_ALIGN: 0x00002000UL, SLAB_PANIC: 0x00040000UL, SLAB_NOTRACK: 0x00000000UL
    // kmem_cache_create("signal_cache", 536, 0, 0x42000, NULL): kmem_cache#13
    signal_cachep = kmem_cache_create("signal_cache",
            sizeof(struct signal_struct), 0,
            SLAB_HWCACHE_ALIGN|SLAB_PANIC|SLAB_NOTRACK, NULL);

    // sizeof(struct files_struct): 188 bytes,
    // SLAB_HWCACHE_ALIGN: 0x00002000UL, SLAB_PANIC: 0x00040000UL, SLAB_NOTRACK: 0x00000000UL
    // kmem_cache_create("files_cache", 188, 0, 0x42000, NULL): kmem_cache#12
    files_cachep = kmem_cache_create("files_cache",
            sizeof(struct files_struct), 0,
            SLAB_HWCACHE_ALIGN|SLAB_PANIC|SLAB_NOTRACK, NULL);
    // files_cachep: kmem_cache#12

    // sizeof(struct fs_struct): 48 bytes,
    // SLAB_HWCACHE_ALIGN: 0x00002000UL, SLAB_PANIC: 0x00040000UL, SLAB_NOTRACK: 0x00000000UL
    // kmem_cache_create("fs_cache", 48, 0, 0x42000, NULL): kmem_cache#11
    fs_cachep = kmem_cache_create("fs_cache",
            sizeof(struct fs_struct), 0,
            SLAB_HWCACHE_ALIGN|SLAB_PANIC|SLAB_NOTRACK, NULL);
    // fs_cachep: kmem_cache#11
    /*
     * FIXME! The "sizeof(struct mm_struct)" currently includes the
     * whole struct cpumask for the OFFSTACK case. We could change
     * this to *only* allocate as much of it as required by the
     * maximum number of CPU's we can ever have.  The cpumask_allocation
     * is at the end of the structure, exactly for that reason.
     */
    // sizeof(struct mm_struct): 428 bytes, ARCH_MIN_MMSTRUCT_ALIGN: 0
    // SLAB_HWCACHE_ALIGN: 0x00002000UL, SLAB_PANIC: 0x00040000UL, SLAB_NOTRACK: 0x00000000UL
    // kmem_cache_create("mm_struct", 428, 0, 0x42000, NULL): kmem_cache#10
    mm_cachep = kmem_cache_create("mm_struct",
            sizeof(struct mm_struct), ARCH_MIN_MMSTRUCT_ALIGN,
            SLAB_HWCACHE_ALIGN|SLAB_PANIC|SLAB_NOTRACK, NULL);
    // mm_cachep: kmem_cache#10

    // SLAB_PANIC: 0x00040000UL
    // KMEM_CACHE(vm_area_struct, 0x00040000):
    // kmem_cache_create("vm_area_struct", sizeof(struct vm_area_struct), __alignof__(struct vm_area_struct), (0x00040000), NULL): kmem_cache#9
    vm_area_cachep = KMEM_CACHE(vm_area_struct, SLAB_PANIC);
    // vm_area_cachep: kmem_cache#9
// ARM10C 20150919
// #define KMEM_CACHE(vm_area_struct, 0x00040000):
// kmem_cache_create("vm_area_struct", sizeof(struct vm_area_struct), __alignof__(struct vm_area_struct), (0x00040000), NULL)
#define KMEM_CACHE(__struct, __flags) kmem_cache_create(#__struct,\
        sizeof(struct __struct), __alignof__(struct __struct),\
        (__flags), NULL)
// ARM10C 20150919
// "vm_area_struct", sizeof(struct vm_area_struct): 84 bytes, __alignof__(struct vm_area_struct): 4, (0x00040000), NULL
struct kmem_cache *
kmem_cache_create(const char *name, size_t size, size_t align,
          unsigned long flags, void (*ctor)(void *))
{

    // name: "vm_area_struct", size: 84, align: 4, flags: 0x40000, ctor: NULL
    // kmem_cache_create_memcg(NULL, "vm_area_struct", 84, 4, 0x40000, NULL): kmem_cache#9
    return kmem_cache_create_memcg(NULL, name, size, align, flags, ctor, NULL);
    // return kmem_cache#09
}
  • mmap_init()
// ARM10C 20150919
void __init proc_caches_init(void)
{
    // sizeof(struct sighand_struct): 1324 bytes,
    // SLAB_HWCACHE_ALIGN: 0x00002000UL, SLAB_PANIC: 0x00040000UL, SLAB_DESTROY_BY_RCU: 0x00080000UL, SLAB_NOTRACK: 0x00000000UL
    // kmem_cache_create("sighand_cache", 1324, 0, 0xc2000, sighand_ctor): kmem_cache#14
    sighand_cachep = kmem_cache_create("sighand_cache",
            sizeof(struct sighand_struct), 0,
            SLAB_HWCACHE_ALIGN|SLAB_PANIC|SLAB_DESTROY_BY_RCU|
            SLAB_NOTRACK, sighand_ctor);
    // sighand_cachep: kmem_cache#14

    // sizeof(struct signal_struct): 536 bytes,
    // SLAB_HWCACHE_ALIGN: 0x00002000UL, SLAB_PANIC: 0x00040000UL, SLAB_NOTRACK: 0x00000000UL
    // kmem_cache_create("signal_cache", 536, 0, 0x42000, NULL): kmem_cache#13
    signal_cachep = kmem_cache_create("signal_cache",
            sizeof(struct signal_struct), 0,
            SLAB_HWCACHE_ALIGN|SLAB_PANIC|SLAB_NOTRACK, NULL);
    // signal_cachep: kmem_cache#13

    // sizeof(struct files_struct): 188 bytes,
    // SLAB_HWCACHE_ALIGN: 0x00002000UL, SLAB_PANIC: 0x00040000UL, SLAB_NOTRACK: 0x00000000UL
    // kmem_cache_create("files_cache", 188, 0, 0x42000, NULL): kmem_cache#12
    files_cachep = kmem_cache_create("files_cache",
            sizeof(struct files_struct), 0,
            SLAB_HWCACHE_ALIGN|SLAB_PANIC|SLAB_NOTRACK, NULL);
    // files_cachep: kmem_cache#12

    // sizeof(struct fs_struct): 48 bytes,
    // SLAB_HWCACHE_ALIGN: 0x00002000UL, SLAB_PANIC: 0x00040000UL, SLAB_NOTRACK: 0x00000000UL
    // kmem_cache_create("fs_cache", 48, 0, 0x42000, NULL): kmem_cache#11
    fs_cachep = kmem_cache_create("fs_cache",
            sizeof(struct fs_struct), 0,
            SLAB_HWCACHE_ALIGN|SLAB_PANIC|SLAB_NOTRACK, NULL);
    // fs_cachep: kmem_cache#11
    /*
     * FIXME! The "sizeof(struct mm_struct)" currently includes the
     * whole struct cpumask for the OFFSTACK case. We could change
     * this to *only* allocate as much of it as required by the
     * maximum number of CPU's we can ever have.  The cpumask_allocation
     * is at the end of the structure, exactly for that reason.
     */
    // sizeof(struct mm_struct): 428 bytes, ARCH_MIN_MMSTRUCT_ALIGN: 0
    // SLAB_HWCACHE_ALIGN: 0x00002000UL, SLAB_PANIC: 0x00040000UL, SLAB_NOTRACK: 0x00000000UL
    // kmem_cache_create("mm_struct", 428, 0, 0x42000, NULL): kmem_cache#10
    mm_cachep = kmem_cache_create("mm_struct",
            sizeof(struct mm_struct), ARCH_MIN_MMSTRUCT_ALIGN,
            SLAB_HWCACHE_ALIGN|SLAB_PANIC|SLAB_NOTRACK, NULL);
    // mm_cachep: kmem_cache#10

    // SLAB_PANIC: 0x00040000UL
    // KMEM_CACHE(vm_area_struct, 0x00040000):
    // kmem_cache_create("vm_area_struct", sizeof(struct vm_area_struct), __alignof__(struct vm_area_struct), (0x00040000), NULL): kmem_cache#9
    vm_area_cachep = KMEM_CACHE(vm_area_struct, SLAB_PANIC);
    // vm_area_cachep: kmem_cache#9

    mmap_init();

mmap.c::mmap_init()

  • call:
    • start_kernel()->proc_caches_init()
      • mmap_init()
// ARM10C 20150919
void __init mmap_init(void)
{
    int ret;

    // percpu_counter_init(&vm_committed_as, 0): 0
    ret = percpu_counter_init(&vm_committed_as, 0);
// ARM10C 20150919
// &vm_committed_as, 0
#define percpu_counter_init(fbc, value)                 \
    ({                              \
        static struct lock_class_key __key;         \
                                    \
        __percpu_counter_init(fbc, value, &__key);      \
    })
// ARM10C 20150919
// &vm_committed_as, 0, &__key
int __percpu_counter_init(struct percpu_counter *fbc, s64 amount,
              struct lock_class_key *key)
{
    // &fbc->lock: &(&vm_committed_as)->lock
    raw_spin_lock_init(&fbc->lock);

    // raw_spin_lock_init에서 한일:
    // (&(&(&(&vm_committed_as)->lock)->wait_lock)->rlock)->raw_lock: { { 0 } }
    // (&(&(&(&vm_committed_as)->lock)->wait_lock)->rlock)->magic: 0xdead4ead
    // (&(&(&(&vm_committed_as)->lock)->wait_lock)->rlock)->owner: 0xffffffff
    // (&(&(&(&vm_committed_as)->lock)->wait_lock)->rlock)->owner_cpu: 0xffffffff

    // &fbc->lock: &(&vm_committed_as)->lock, key: &__key
    lockdep_set_class(&fbc->lock, key); // null function

    // fbc->count: (&vm_committed_as)->count, amount: 0
    fbc->count = amount;
    // fbc->count: (&vm_committed_as)->count: 0

    // fbc->counters: (&vm_committed_as)->counters,
    // alloc_percpu(s32): kmem_cache#26-o0 에서 할당된 4 bytes 메모리 주소
    fbc->counters = alloc_percpu(s32);
    // fbc->counters: (&vm_committed_as)->counters: kmem_cache#26-o0 에서 할당된 4 bytes 메모리 주소

    // fbc->counters: (&vm_committed_as)->counters: kmem_cache#26-o0 에서 할당된 4 bytes 메모리 주소
    if (!fbc->counters)
        return -ENOMEM;

    // fbc: &vm_committed_as
    debug_percpu_counter_activate(fbc); // null function

#ifdef CONFIG_HOTPLUG_CPU // CONFIG_HOTPLUG_CPU=y
    // &fbc->list: &(&vm_committed_as)->list
    INIT_LIST_HEAD(&fbc->list);

    // INIT_LIST_HEAD에서 한일:
    // (&(&vm_committed_as)->list)->next: &(&vm_committed_as)->list
    // (&(&vm_committed_as)->list)->prev: &(&vm_committed_as)->list

    spin_lock(&percpu_counters_lock);

    // spin_lock에서 한일:
    // &percpu_counters_lock을 사용한 spin lock 수행

    // &fbc->list: &(&vm_committed_as)->list
    list_add(&fbc->list, &percpu_counters);

    // list_add에서 한일:
    // list head 인 &percpu_counters에 &(&vm_committed_as)->list를 연결함

    spin_unlock(&percpu_counters_lock);

    // spin_lock에서 한일:
    // &percpu_counters_lock을 사용한 spin unlock 수행
#endif
    return 0;
    // return 0
}
EXPORT_SYMBOL(__percpu_counter_init);
  • percpu_counter_init에서 한일:
    • (&(&(&(&vm_committed_as)->lock)->wait_lock)->rlock)->raw_lock: { { 0 } }
    • (&(&(&(&vm_committed_as)->lock)->wait_lock)->rlock)->magic: 0xdead4ead
    • (&(&(&(&vm_committed_as)->lock)->wait_lock)->rlock)->owner: 0xffffffff
    • (&(&(&(&vm_committed_as)->lock)->wait_lock)->rlock)->owner_cpu: 0xffffffff
    • (&(&vm_committed_as)->list)->next: &(&vm_committed_as)->list
    • (&(&vm_committed_as)->list)->prev: &(&vm_committed_as)->list
    • (&vm_committed_as)->count: 0
    • (&vm_committed_as)->counters: kmem_cache#26-o0 에서 할당된 4 bytes 메모리 주소
    • list head 인 &percpu_counters에 &(&vm_committed_as)->list를 연결함
// ARM10C 20150919
void __init mmap_init(void)
{
    int ret;

    // percpu_counter_init(&vm_committed_as, 0): 0
    ret = percpu_counter_init(&vm_committed_as, 0);
    // ret: 0

    // ret: 0
    VM_BUG_ON(ret);
}
  • mmap_init에서 한일:
    • (&(&(&(&vm_committed_as)->lock)->wait_lock)->rlock)->raw_lock: { { 0 } }
    • (&(&(&(&vm_committed_as)->lock)->wait_lock)->rlock)->magic: 0xdead4ead
    • (&(&(&(&vm_committed_as)->lock)->wait_lock)->rlock)->owner: 0xffffffff
    • (&(&(&(&vm_committed_as)->lock)->wait_lock)->rlock)->owner_cpu: 0xffffffff
    • (&(&vm_committed_as)->list)->next: &(&vm_committed_as)->list
    • (&(&vm_committed_as)->list)->prev: &(&vm_committed_as)->list
    • (&vm_committed_as)->count: 0
    • (&vm_committed_as)->counters: kmem_cache#26-o0 에서 할당된 4 bytes 메모리 주소
    • list head 인 &percpu_counters에 &(&vm_committed_as)->list를 연결함

log

  • 1st log
a53fe59..e356946  master     -> origin/master
Updating a53fe59..e356946
Fast-forward
arch/arm/include/asm/page.h       |  1 +
fs/dcache.c                       | 18 ++++++++++++++++++
fs/file.c                         |  5 +++++
fs/file_table.c                   | 19 +++++++++++++++++++
fs/inode.c                        |  3 +++
include/asm-generic/bitsperlong.h |  1 +
include/linux/fs.h                |  7 ++++---
include/linux/kernel.h            |  1 +
include/linux/key.h               |  3 ++-
include/linux/kgdb.h              |  3 ++-
include/linux/security.h          |  3 ++-
include/linux/slub_def.h          |  1 +
include/linux/swap.h              |  3 +++
include/linux/vmstat.h            |  6 ++++++
include/uapi/linux/fs.h           |  3 +++
init/main.c                       |  8 +++++---
kernel/fork.c                     |  1 +
mm/page_alloc.c                   |  1 +
mm/vmstat.c                       |  1 +
19 files changed, 79 insertions(+), 9 deletions(-)

댓글 없음:

댓글 쓰기