|
22 | 22 | #endif
|
23 | 23 | #define AT_VECTOR_SIZE (2*(AT_VECTOR_SIZE_ARCH + AT_VECTOR_SIZE_BASE + 1))
|
24 | 24 |
|
25 |
| -typedef int vm_fault_t; |
26 | 25 |
|
27 | 26 | struct address_space;
|
28 | 27 | struct mem_cgroup;
|
@@ -621,6 +620,78 @@ static inline bool mm_tlb_flush_nested(struct mm_struct *mm)
|
621 | 620 |
|
622 | 621 | struct vm_fault;
|
623 | 622 |
|
| 623 | +/** |
| 624 | + * typedef vm_fault_t - Return type for page fault handlers. |
| 625 | + * |
| 626 | + * Page fault handlers return a bitmask of %VM_FAULT values. |
| 627 | + */ |
| 628 | +typedef __bitwise unsigned int vm_fault_t; |
| 629 | + |
| 630 | +/** |
| 631 | + * enum vm_fault_reason - Page fault handlers return a bitmask of |
| 632 | + * these values to tell the core VM what happened when handling the |
| 633 | + * fault. Used to decide whether a process gets delivered SIGBUS or |
| 634 | + * just gets major/minor fault counters bumped up. |
| 635 | + * |
| 636 | + * @VM_FAULT_OOM: Out Of Memory |
| 637 | + * @VM_FAULT_SIGBUS: Bad access |
| 638 | + * @VM_FAULT_MAJOR: Page read from storage |
| 639 | + * @VM_FAULT_WRITE: Special case for get_user_pages |
| 640 | + * @VM_FAULT_HWPOISON: Hit poisoned small page |
| 641 | + * @VM_FAULT_HWPOISON_LARGE: Hit poisoned large page. Index encoded |
| 642 | + * in upper bits |
| 643 | + * @VM_FAULT_SIGSEGV: segmentation fault |
| 644 | + * @VM_FAULT_NOPAGE: ->fault installed the pte, not return page |
| 645 | + * @VM_FAULT_LOCKED: ->fault locked the returned page |
| 646 | + * @VM_FAULT_RETRY: ->fault blocked, must retry |
| 647 | + * @VM_FAULT_FALLBACK: huge page fault failed, fall back to small |
| 648 | + * @VM_FAULT_DONE_COW: ->fault has fully handled COW |
| 649 | + * @VM_FAULT_NEEDDSYNC: ->fault did not modify page tables and needs |
| 650 | + * fsync() to complete (for synchronous page faults |
| 651 | + * in DAX) |
| 652 | + * @VM_FAULT_HINDEX_MASK: mask HINDEX value |
| 653 | + * |
| 654 | + */ |
| 655 | +enum vm_fault_reason { |
| 656 | + VM_FAULT_OOM = (__force vm_fault_t)0x000001, |
| 657 | + VM_FAULT_SIGBUS = (__force vm_fault_t)0x000002, |
| 658 | + VM_FAULT_MAJOR = (__force vm_fault_t)0x000004, |
| 659 | + VM_FAULT_WRITE = (__force vm_fault_t)0x000008, |
| 660 | + VM_FAULT_HWPOISON = (__force vm_fault_t)0x000010, |
| 661 | + VM_FAULT_HWPOISON_LARGE = (__force vm_fault_t)0x000020, |
| 662 | + VM_FAULT_SIGSEGV = (__force vm_fault_t)0x000040, |
| 663 | + VM_FAULT_NOPAGE = (__force vm_fault_t)0x000100, |
| 664 | + VM_FAULT_LOCKED = (__force vm_fault_t)0x000200, |
| 665 | + VM_FAULT_RETRY = (__force vm_fault_t)0x000400, |
| 666 | + VM_FAULT_FALLBACK = (__force vm_fault_t)0x000800, |
| 667 | + VM_FAULT_DONE_COW = (__force vm_fault_t)0x001000, |
| 668 | + VM_FAULT_NEEDDSYNC = (__force vm_fault_t)0x002000, |
| 669 | + VM_FAULT_HINDEX_MASK = (__force vm_fault_t)0x0f0000, |
| 670 | +}; |
| 671 | + |
| 672 | +/* Encode hstate index for a hwpoisoned large page */ |
| 673 | +#define VM_FAULT_SET_HINDEX(x) ((__force vm_fault_t)((x) << 16)) |
| 674 | +#define VM_FAULT_GET_HINDEX(x) (((x) >> 16) & 0xf) |
| 675 | + |
| 676 | +#define VM_FAULT_ERROR (VM_FAULT_OOM | VM_FAULT_SIGBUS | \ |
| 677 | + VM_FAULT_SIGSEGV | VM_FAULT_HWPOISON | \ |
| 678 | + VM_FAULT_HWPOISON_LARGE | VM_FAULT_FALLBACK) |
| 679 | + |
| 680 | +#define VM_FAULT_RESULT_TRACE \ |
| 681 | + { VM_FAULT_OOM, "OOM" }, \ |
| 682 | + { VM_FAULT_SIGBUS, "SIGBUS" }, \ |
| 683 | + { VM_FAULT_MAJOR, "MAJOR" }, \ |
| 684 | + { VM_FAULT_WRITE, "WRITE" }, \ |
| 685 | + { VM_FAULT_HWPOISON, "HWPOISON" }, \ |
| 686 | + { VM_FAULT_HWPOISON_LARGE, "HWPOISON_LARGE" }, \ |
| 687 | + { VM_FAULT_SIGSEGV, "SIGSEGV" }, \ |
| 688 | + { VM_FAULT_NOPAGE, "NOPAGE" }, \ |
| 689 | + { VM_FAULT_LOCKED, "LOCKED" }, \ |
| 690 | + { VM_FAULT_RETRY, "RETRY" }, \ |
| 691 | + { VM_FAULT_FALLBACK, "FALLBACK" }, \ |
| 692 | + { VM_FAULT_DONE_COW, "DONE_COW" }, \ |
| 693 | + { VM_FAULT_NEEDDSYNC, "NEEDDSYNC" } |
| 694 | + |
624 | 695 | struct vm_special_mapping {
|
625 | 696 | const char *name; /* The name, e.g. "[vdso]". */
|
626 | 697 |
|
|
0 commit comments