1/* SPDX-License-Identifier: GPL-2.0 */ 2#ifndef _LINUX_MM_TYPES_TASK_H 3#define _LINUX_MM_TYPES_TASK_H 4 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 11#include <linux/types.h> 12 13#include <asm/page.h> 14 15#ifdef CONFIG_ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH 16#include <asm/tlbbatch.h> 17#endif 18 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 24/* 25 * When updating this, please also update struct resident_page_types[] in 26 * kernel/fork.c 27 */ 28enum { 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 36struct page; 37 38struct 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 49/* Track pages that require TLB flushes */ 50struct tlbflush_unmap_batch { 51#ifdef CONFIG_ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH 52 /* 53 * The arch code makes the following promise: generic code can modify a 54 * PTE, then call arch_tlbbatch_add_pending() (which internally provides 55 * all needed barriers), then call arch_tlbbatch_flush(), and the entries 56 * will be flushed on all CPUs by the time that arch_tlbbatch_flush() 57 * returns. 58 */ 59 struct arch_tlbflush_unmap_batch arch; 60 61 /* True if a flush is needed. */ 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 73#endif /* _LINUX_MM_TYPES_TASK_H */ 74