Commit | Line | Data |
---|---|---|
b2441318 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
2e58f173 IM |
2 | #ifndef _LINUX_MM_TYPES_TASK_H |
3 | #define _LINUX_MM_TYPES_TASK_H | |
4 | ||
9e7d2e44 IM |
5 | /* |
6 | * Here are the definitions of the MM data types that are embedded in 'struct task_struct'. | |
7 | * | |
8 | * (These are defined separately to decouple sched.h from mm_types.h as much as possible.) | |
9 | */ | |
10 | ||
2e58f173 | 11 | #include <linux/types.h> |
2e58f173 IM |
12 | |
13 | #include <asm/page.h> | |
14 | ||
e73ad5ff AL |
15 | #ifdef CONFIG_ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH |
16 | #include <asm/tlbbatch.h> | |
17 | #endif | |
18 | ||
9e7d2e44 IM |
19 | #define USE_SPLIT_PTE_PTLOCKS (NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS) |
20 | #define USE_SPLIT_PMD_PTLOCKS (USE_SPLIT_PTE_PTLOCKS && \ | |
21 | IS_ENABLED(CONFIG_ARCH_ENABLE_SPLIT_PMD_PTLOCK)) | |
22 | #define ALLOC_SPLIT_PTLOCKS (SPINLOCK_SIZE > BITS_PER_LONG/8) | |
23 | ||
8495f7e6 SPP |
24 | /* |
25 | * When updating this, please also update struct resident_page_types[] in | |
26 | * kernel/fork.c | |
27 | */ | |
9e7d2e44 IM |
28 | enum { |
29 | MM_FILEPAGES, /* Resident file mapping pages */ | |
30 | MM_ANONPAGES, /* Resident anonymous pages */ | |
31 | MM_SWAPENTS, /* Anonymous swap entries */ | |
32 | MM_SHMEMPAGES, /* Resident shared memory pages */ | |
33 | NR_MM_COUNTERS | |
34 | }; | |
35 | ||
959d8dc8 KO |
36 | struct page; |
37 | ||
9e7d2e44 IM |
38 | struct page_frag { |
39 | struct page *page; | |
40 | #if (BITS_PER_LONG > 32) || (PAGE_SIZE >= 65536) | |
41 | __u32 offset; | |
42 | __u32 size; | |
43 | #else | |
44 | __u16 offset; | |
45 | __u16 size; | |
46 | #endif | |
47 | }; | |
48 | ||
dcc2dc45 IM |
49 | /* Track pages that require TLB flushes */ |
50 | struct tlbflush_unmap_batch { | |
51 | #ifdef CONFIG_ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH | |
52 | /* | |
e73ad5ff | 53 | * The arch code makes the following promise: generic code can modify a |
f73419bb BS |
54 | * PTE, then call arch_tlbbatch_add_pending() (which internally provides |
55 | * all needed barriers), then call arch_tlbbatch_flush(), and the entries | |
e73ad5ff AL |
56 | * will be flushed on all CPUs by the time that arch_tlbbatch_flush() |
57 | * returns. | |
dcc2dc45 | 58 | */ |
e73ad5ff | 59 | struct arch_tlbflush_unmap_batch arch; |
dcc2dc45 | 60 | |
e73ad5ff | 61 | /* True if a flush is needed. */ |
dcc2dc45 IM |
62 | bool flush_required; |
63 | ||
64 | /* | |
65 | * If true then the PTE was dirty when unmapped. The entry must be | |
66 | * flushed before IO is initiated or a stale TLB entry potentially | |
67 | * allows an update without redirtying the page. | |
68 | */ | |
69 | bool writable; | |
70 | #endif | |
71 | }; | |
72 | ||
2e58f173 | 73 | #endif /* _LINUX_MM_TYPES_TASK_H */ |