linux kernel - Where to find vma->fault()? -
i understand vma->fault() take 2 arguments vma , vmf. not sure vma->fault() inside of because cannot find code or document talks initialization of field in vm_area_struct->vm_ops->fault().
if understand correctly, looking implementation vma->fault(), being executed in mm/memory.c in __do_fault() function:
ret = vma->vm_ops->fault(vma, &vmf); tl;dr
short answer: special_mapping_fault() function set .fault callback.
long story
when trying find thing this, 1 shouldn't underestimate power of simple unix tools, grep. knowing .fault callback belongs memory management, know should mm/ directory. here answer:
$ grep -sirhn '\.fault = ' mm/* and output next:
mm/hugetlb.c:2594: .fault = hugetlb_vm_op_fault, mm/mmap.c:3001: .fault = special_mapping_fault, mm/mmap.c:3007: .fault = special_mapping_fault, investigating further can figure out mm/hugetlb.c part of hugetlb fs implemetation, hence has nothing case.
for both other cases can see special_mapping_fault() function using .fault callback.
Comments
Post a Comment