Pull updates from Andrew Morton: "Most of -mm and quite a number of other subsystems: hotfixes, scripts, ocfs2, misc, lib, binfmt, init, reiserfs, exec, dma-mapping, kcov. MM is fairly quiet this time. Holidays, I assume" * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (118 commits) kcov: ignore fault-inject and stacktrace include/linux/io-mapping.h-mapping: use PHYS_PFN() macro in io_mapping_map_atomic_wc() execve: warn if process starts with executable stack reiserfs: prevent NULL pointer dereference in reiserfs_insert_item() init/main.c: fix misleading "This architecture does not have kernel memory protection" message init/main.c: fix quoted value handling in unknown_bootoption init/main.c: remove unnecessary repair_env_string in do_initcall_level init/main.c: log arguments and environment passed to init fs/binfmt_elf.c: coredump: allow process with empty address space to coredump fs/binfmt_elf.c: coredump: delete duplicated overflow check fs/binfmt_elf.c: coredump: allocate core ELF header on stack fs/binfmt_elf.c: make BAD_ADDR() unlikely fs/binfmt_elf.c: better codegen around current->mm fs/binfmt_elf.c: don't copy ELF header around fs/binfmt_elf.c: fix ->start_code calculation fs/binfmt_elf.c: smaller code generation around auxv vector fill lib/find_bit.c: uninline helper _find_next_bit() lib/find_bit.c: join _find_next_bit{_le} uapi: rename ext2_swab() to swab() and share globally in swab.h lib/scatterlist.c: adjust indentation in __sg_alloc_table ...
Showing the changes to include (18 of 136 files). Show all
Unified · Split
| @@ -13,6 +13,7 @@ · 12 unmodified lines | ||
| 13 | 13 | #include <linux/fs.h> |
| 14 | 14 | #include <linux/sched.h> |
| 15 | 15 | #include <linux/blkdev.h> |
| 16 | +#include <linux/device.h> | |
| 16 | 17 | #include <linux/writeback.h> |
| 17 | 18 | #include <linux/blk-cgroup.h> |
| 18 | 19 | #include <linux/backing-dev-defs.h> |
| @@ -504,4 +505,13 @@ static inline int bdi_rw_congested(struct backing_dev_info *bdi) · 485 unmodified lines | ||
| 504 | 505 | (1 << WB_async_congested)); |
| 505 | 506 | } |
| 506 | 507 | |
| 508 | +extern const char *bdi_unknown_name; | |
| 509 | + | |
| 510 | +static inline const char *bdi_dev_name(struct backing_dev_info *bdi) | |
| 511 | +{ | |
| 512 | + if (!bdi || !bdi->dev) | |
| 513 | + return bdi_unknown_name; | |
| 514 | + return dev_name(bdi->dev); | |
| 515 | +} | |
| 516 | + | |
| 507 | 517 | #endif /* _LINUX_BACKING_DEV_H */ |
| @@ -13,6 +13,7 @@ · 12 unmodified lines | ||
| 13 | 13 | |
| 14 | 14 | #define BITS_PER_TYPE(type) (sizeof(type) * BITS_PER_BYTE) |
| 15 | 15 | #define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_TYPE(long)) |
| 16 | +#define BITS_TO_BYTES(nr) DIV_ROUND_UP(nr, BITS_PER_TYPE(char)) | |
| 16 | 17 | |
| 17 | 18 | extern unsigned int __sw_hweight8(unsigned int w); |
| 18 | 19 | extern unsigned int __sw_hweight16(unsigned int w); |
| @@ -2737,7 +2737,6 @@ static inline int filemap_fdatawait(struct address_space *mapping) · 2736 unmodified lines | ||
| 2737 | 2737 | |
| 2738 | 2738 | extern bool filemap_range_has_page(struct address_space *, loff_t lstart, |
| 2739 | 2739 | loff_t lend); |
| 2740 | −extern int filemap_write_and_wait(struct address_space *mapping); | |
| 2741 | 2740 | extern int filemap_write_and_wait_range(struct address_space *mapping, |
| 2742 | 2741 | loff_t lstart, loff_t lend); |
| 2743 | 2742 | extern int __filemap_fdatawrite_range(struct address_space *mapping, |
| @@ -2747,6 +2746,11 @@ extern int filemap_fdatawrite_range(struct address_space *mapping, · 3 unmodified lines | ||
| 2747 | 2746 | extern int filemap_check_errors(struct address_space *mapping); |
| 2748 | 2747 | extern void __filemap_set_wb_err(struct address_space *mapping, int err); |
| 2749 | 2748 | |
| 2749 | +static inline int filemap_write_and_wait(struct address_space *mapping) | |
| 2750 | +{ | |
| 2751 | + return filemap_write_and_wait_range(mapping, 0, LLONG_MAX); | |
| 2752 | +} | |
| 2753 | + | |
| 2750 | 2754 | extern int __must_check file_fdatawait_range(struct file *file, loff_t lstart, |
| 2751 | 2755 | loff_t lend); |
| 2752 | 2756 | extern int __must_check file_check_and_advance_wb_err(struct file *file); |
| @@ -28,6 +28,7 @@ struct io_mapping { · 27 unmodified lines | ||
| 28 | 28 | |
| 29 | 29 | #ifdef CONFIG_HAVE_ATOMIC_IOMAP |
| 30 | 30 | |
| 31 | +#include <linux/pfn.h> | |
| 31 | 32 | #include <asm/iomap.h> |
| 32 | 33 | /* |
| 33 | 34 | * For small address space machines, mapping large objects |
| @@ -64,12 +65,10 @@ io_mapping_map_atomic_wc(struct io_mapping *mapping, · 30 unmodified lines | ||
| 64 | 65 | unsigned long offset) |
| 65 | 66 | { |
| 66 | 67 | resource_size_t phys_addr; |
| 67 | − unsigned long pfn; | |
| 68 | 68 | |
| 69 | 69 | BUG_ON(offset >= mapping->size); |
| 70 | 70 | phys_addr = mapping->base + offset; |
| 71 | − pfn = (unsigned long) (phys_addr >> PAGE_SHIFT); | |
| 72 | − return iomap_atomic_prot_pfn(pfn, mapping->prot); | |
| 71 | + return iomap_atomic_prot_pfn(PHYS_PFN(phys_addr), mapping->prot); | |
| 73 | 72 | } |
| 74 | 73 | |
| 75 | 74 | static inline void |
| @@ -113,6 +113,9 @@ int memblock_add(phys_addr_t base, phys_addr_t size); · 112 unmodified lines | ||
| 113 | 113 | int memblock_remove(phys_addr_t base, phys_addr_t size); |
| 114 | 114 | int memblock_free(phys_addr_t base, phys_addr_t size); |
| 115 | 115 | int memblock_reserve(phys_addr_t base, phys_addr_t size); |
| 116 | +#ifdef CONFIG_HAVE_MEMBLOCK_PHYS_MAP | |
| 117 | +int memblock_physmem_add(phys_addr_t base, phys_addr_t size); | |
| 118 | +#endif | |
| 116 | 119 | void memblock_trim_memory(phys_addr_t align); |
| 117 | 120 | bool memblock_overlaps_region(struct memblock_type *type, |
| 118 | 121 | phys_addr_t base, phys_addr_t size); |
| @@ -127,10 +130,6 @@ void reset_node_managed_pages(pg_data_t *pgdat); · 8 unmodified lines | ||
| 127 | 130 | void reset_all_zones_managed_pages(void); |
| 128 | 131 | |
| 129 | 132 | /* Low level functions */ |
| 130 | −int memblock_add_range(struct memblock_type *type, | |
| 131 | − phys_addr_t base, phys_addr_t size, | |
| 132 | − int nid, enum memblock_flags flags); | |
| 133 | − | |
| 134 | 133 | void __next_mem_range(u64 *idx, int nid, enum memblock_flags flags, |
| 135 | 134 | struct memblock_type *type_a, |
| 136 | 135 | struct memblock_type *type_b, phys_addr_t *out_start, |
| @@ -29,8 +29,6 @@ struct memory_block { · 28 unmodified lines | ||
| 29 | 29 | int section_count; /* serialized by mem_sysfs_mutex */ |
| 30 | 30 | int online_type; /* for passing data to online routine */ |
| 31 | 31 | int phys_device; /* to which fru does this belong? */ |
| 32 | − void *hw; /* optional pointer to fw/hw data */ | |
| 33 | − int (*phys_callback)(struct memory_block *); | |
| 34 | 32 | struct device dev; |
| 35 | 33 | int nid; /* NID for this memory block */ |
| 36 | 34 | }; |
| @@ -55,19 +53,6 @@ struct memory_notify { · 18 unmodified lines | ||
| 55 | 53 | int status_change_nid; |
| 56 | 54 | }; |
| 57 | 55 | |
| 58 | −/* | |
| 59 | − * During pageblock isolation, count the number of pages within the | |
| 60 | − * range [start_pfn, start_pfn + nr_pages) which are owned by code | |
| 61 | − * in the notifier chain. | |
| 62 | − */ | |
| 63 | −#define MEM_ISOLATE_COUNT (1<<0) | |
| 64 | − | |
| 65 | −struct memory_isolate_notify { | |
| 66 | − unsigned long start_pfn; /* Start of range to check */ | |
| 67 | − unsigned int nr_pages; /* # pages in range to check */ | |
| 68 | − unsigned int pages_found; /* # pages owned found by callbacks */ | |
| 69 | −}; | |
| 70 | − | |
| 71 | 56 | struct notifier_block; |
| 72 | 57 | struct mem_section; |
| 73 | 58 | |
| @@ -94,27 +79,13 @@ static inline int memory_notify(unsigned long val, void *v) · 20 unmodified lines | ||
| 94 | 79 | { |
| 95 | 80 | return 0; |
| 96 | 81 | } |
| 97 | −static inline int register_memory_isolate_notifier(struct notifier_block *nb) | |
| 98 | −{ | |
| 99 | − return 0; | |
| 100 | −} | |
| 101 | −static inline void unregister_memory_isolate_notifier(struct notifier_block *nb) | |
| 102 | −{ | |
| 103 | −} | |
| 104 | −static inline int memory_isolate_notify(unsigned long val, void *v) | |
| 105 | −{ | |
| 106 | − return 0; | |
| 107 | −} | |
| 108 | 82 | #else |
| 109 | 83 | extern int register_memory_notifier(struct notifier_block *nb); |
| 110 | 84 | extern void unregister_memory_notifier(struct notifier_block *nb); |
| 111 | −extern int register_memory_isolate_notifier(struct notifier_block *nb); | |
| 112 | −extern void unregister_memory_isolate_notifier(struct notifier_block *nb); | |
| 113 | 85 | int create_memory_block_devices(unsigned long start, unsigned long size); |
| 114 | 86 | void remove_memory_block_devices(unsigned long start, unsigned long size); |
| 115 | 87 | extern void memory_dev_init(void); |
| 116 | 88 | extern int memory_notify(unsigned long val, void *v); |
| 117 | −extern int memory_isolate_notify(unsigned long val, void *v); | |
| 118 | 89 | extern struct memory_block *find_memory_block(struct mem_section *); |
| 119 | 90 | typedef int (*walk_memory_blocks_func_t)(struct memory_block *, void *); |
| 120 | 91 | extern int walk_memory_blocks(unsigned long start, unsigned long size, |
| @@ -94,7 +94,8 @@ extern int zone_grow_free_lists(struct zone *zone, unsigned long new_nr_pages); · 93 unmodified lines | ||
| 94 | 94 | extern int zone_grow_waitqueues(struct zone *zone, unsigned long nr_pages); |
| 95 | 95 | extern int add_one_highpage(struct page *page, int pfn, int bad_ppro); |
| 96 | 96 | /* VM interface that may be used by firmware interface */ |
| 97 | −extern int online_pages(unsigned long, unsigned long, int); | |
| 97 | +extern int online_pages(unsigned long pfn, unsigned long nr_pages, | |
| 98 | + int online_type, int nid); | |
| 98 | 99 | extern int test_pages_in_a_zone(unsigned long start_pfn, unsigned long end_pfn, |
| 99 | 100 | unsigned long *valid_start, unsigned long *valid_end); |
| 100 | 101 | extern unsigned long __offline_isolated_pages(unsigned long start_pfn, |
| @@ -70,11 +70,6 @@ static inline void totalram_pages_add(long count) · 69 unmodified lines | ||
| 70 | 70 | atomic_long_add(count, &_totalram_pages); |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | −static inline void totalram_pages_set(long val) | |
| 74 | −{ | |
| 75 | − atomic_long_set(&_totalram_pages, val); | |
| 76 | −} | |
| 77 | − | |
| 78 | 73 | extern void * high_memory; |
| 79 | 74 | extern int page_cluster; |
| 80 | 75 | |
| @@ -916,10 +911,6 @@ vm_fault_t finish_mkwrite_fault(struct vm_fault *vmf); · 835 unmodified lines | ||
| 916 | 911 | |
| 917 | 912 | #define ZONEID_PGSHIFT (ZONEID_PGOFF * (ZONEID_SHIFT != 0)) |
| 918 | 913 | |
| 919 | −#if SECTIONS_WIDTH+NODES_WIDTH+ZONES_WIDTH > BITS_PER_LONG - NR_PAGEFLAGS | |
| 920 | −#error SECTIONS_WIDTH+NODES_WIDTH+ZONES_WIDTH > BITS_PER_LONG - NR_PAGEFLAGS | |
| 921 | −#endif | |
| 922 | − | |
| 923 | 914 | #define ZONES_MASK ((1UL << ZONES_WIDTH) - 1) |
| 924 | 915 | #define NODES_MASK ((1UL << NODES_WIDTH) - 1) |
| 925 | 916 | #define SECTIONS_MASK ((1UL << SECTIONS_WIDTH) - 1) |
| @@ -947,9 +938,10 @@ static inline bool is_zone_device_page(const struct page *page) · 21 unmodified lines | ||
| 947 | 938 | #endif |
| 948 | 939 | |
| 949 | 940 | #ifdef CONFIG_DEV_PAGEMAP_OPS |
| 950 | −void __put_devmap_managed_page(struct page *page); | |
| 941 | +void free_devmap_managed_page(struct page *page); | |
| 951 | 942 | DECLARE_STATIC_KEY_FALSE(devmap_managed_key); |
| 952 | −static inline bool put_devmap_managed_page(struct page *page) | |
| 943 | + | |
| 944 | +static inline bool page_is_devmap_managed(struct page *page) | |
| 953 | 945 | { |
| 954 | 946 | if (!static_branch_unlikely(&devmap_managed_key)) |
| 955 | 947 | return false; |
| @@ -958,7 +950,6 @@ static inline bool put_devmap_managed_page(struct page *page) · 2 unmodified lines | ||
| 958 | 950 | switch (page->pgmap->type) { |
| 959 | 951 | case MEMORY_DEVICE_PRIVATE: |
| 960 | 952 | case MEMORY_DEVICE_FS_DAX: |
| 961 | − __put_devmap_managed_page(page); | |
| 962 | 953 | return true; |
| 963 | 954 | default: |
| 964 | 955 | break; |
| @@ -966,11 +957,17 @@ static inline bool put_devmap_managed_page(struct page *page) · 1 unmodified line | ||
| 966 | 957 | return false; |
| 967 | 958 | } |
| 968 | 959 | |
| 960 | +void put_devmap_managed_page(struct page *page); | |
| 961 | + | |
| 969 | 962 | #else /* CONFIG_DEV_PAGEMAP_OPS */ |
| 970 | −static inline bool put_devmap_managed_page(struct page *page) | |
| 963 | +static inline bool page_is_devmap_managed(struct page *page) | |
| 971 | 964 | { |
| 972 | 965 | return false; |
| 973 | 966 | } |
| 967 | + | |
| 968 | +static inline void put_devmap_managed_page(struct page *page) | |
| 969 | +{ | |
| 970 | +} | |
| 974 | 971 | #endif /* CONFIG_DEV_PAGEMAP_OPS */ |
| 975 | 972 | |
| 976 | 973 | static inline bool is_device_private_page(const struct page *page) |
| @@ -1023,37 +1020,37 @@ static inline void put_page(struct page *page) · 46 unmodified lines | ||
| 1023 | 1020 | * need to inform the device driver through callback. See |
| 1024 | 1021 | * include/linux/memremap.h and HMM for details. |
| 1025 | 1022 | */ |
| 1026 | − if (put_devmap_managed_page(page)) | |
| 1023 | + if (page_is_devmap_managed(page)) { | |
| 1024 | + put_devmap_managed_page(page); | |
| 1027 | 1025 | return; |
| 1026 | + } | |
| 1028 | 1027 | |
| 1029 | 1028 | if (put_page_testzero(page)) |
| 1030 | 1029 | __put_page(page); |
| 1031 | 1030 | } |
| 1032 | 1031 | |
| 1033 | 1032 | /** |
| 1034 | − * put_user_page() - release a gup-pinned page | |
| 1033 | + * unpin_user_page() - release a gup-pinned page | |
| 1035 | 1034 | * @page: pointer to page to be released |
| 1036 | 1035 | * |
| 1037 | − * Pages that were pinned via get_user_pages*() must be released via | |
| 1038 | − * either put_user_page(), or one of the put_user_pages*() routines | |
| 1039 | − * below. This is so that eventually, pages that are pinned via | |
| 1040 | − * get_user_pages*() can be separately tracked and uniquely handled. In | |
| 1041 | − * particular, interactions with RDMA and filesystems need special | |
| 1042 | − * handling. | |
| 1036 | + * Pages that were pinned via pin_user_pages*() must be released via either | |
| 1037 | + * unpin_user_page(), or one of the unpin_user_pages*() routines. This is so | |
| 1038 | + * that eventually such pages can be separately tracked and uniquely handled. In | |
| 1039 | + * particular, interactions with RDMA and filesystems need special handling. | |
| 1043 | 1040 | * |
| 1044 | − * put_user_page() and put_page() are not interchangeable, despite this early | |
| 1045 | − * implementation that makes them look the same. put_user_page() calls must | |
| 1046 | − * be perfectly matched up with get_user_page() calls. | |
| 1041 | + * unpin_user_page() and put_page() are not interchangeable, despite this early | |
| 1042 | + * implementation that makes them look the same. unpin_user_page() calls must | |
| 1043 | + * be perfectly matched up with pin*() calls. | |
| 1047 | 1044 | */ |
| 1048 | −static inline void put_user_page(struct page *page) | |
| 1045 | +static inline void unpin_user_page(struct page *page) | |
| 1049 | 1046 | { |
| 1050 | 1047 | put_page(page); |
| 1051 | 1048 | } |
| 1052 | 1049 | |
| 1053 | −void put_user_pages_dirty_lock(struct page **pages, unsigned long npages, | |
| 1054 | − bool make_dirty); | |
| 1050 | +void unpin_user_pages_dirty_lock(struct page **pages, unsigned long npages, | |
| 1051 | + bool make_dirty); | |
| 1055 | 1052 | |
| 1056 | −void put_user_pages(struct page **pages, unsigned long npages); | |
| 1053 | +void unpin_user_pages(struct page **pages, unsigned long npages); | |
| 1057 | 1054 | |
| 1058 | 1055 | #if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP) |
| 1059 | 1056 | #define SECTION_IN_PAGE_FLAGS |
| @@ -1501,9 +1498,16 @@ long get_user_pages_remote(struct task_struct *tsk, struct mm_struct *mm, · 441 unmodified lines | ||
| 1501 | 1498 | unsigned long start, unsigned long nr_pages, |
| 1502 | 1499 | unsigned int gup_flags, struct page **pages, |
| 1503 | 1500 | struct vm_area_struct **vmas, int *locked); |
| 1501 | +long pin_user_pages_remote(struct task_struct *tsk, struct mm_struct *mm, | |
| 1502 | + unsigned long start, unsigned long nr_pages, | |
| 1503 | + unsigned int gup_flags, struct page **pages, | |
| 1504 | + struct vm_area_struct **vmas, int *locked); | |
| 1504 | 1505 | long get_user_pages(unsigned long start, unsigned long nr_pages, |
| 1505 | 1506 | unsigned int gup_flags, struct page **pages, |
| 1506 | 1507 | struct vm_area_struct **vmas); |
| 1508 | +long pin_user_pages(unsigned long start, unsigned long nr_pages, | |
| 1509 | + unsigned int gup_flags, struct page **pages, | |
| 1510 | + struct vm_area_struct **vmas); | |
| 1507 | 1511 | long get_user_pages_locked(unsigned long start, unsigned long nr_pages, |
| 1508 | 1512 | unsigned int gup_flags, struct page **pages, int *locked); |
| 1509 | 1513 | long get_user_pages_unlocked(unsigned long start, unsigned long nr_pages, |
| @@ -1511,6 +1515,8 @@ long get_user_pages_unlocked(unsigned long start, unsigned long nr_pages, · 1 unmodified line | ||
| 1511 | 1515 | |
| 1512 | 1516 | int get_user_pages_fast(unsigned long start, int nr_pages, |
| 1513 | 1517 | unsigned int gup_flags, struct page **pages); |
| 1518 | +int pin_user_pages_fast(unsigned long start, int nr_pages, | |
| 1519 | + unsigned int gup_flags, struct page **pages); | |
| 1514 | 1520 | |
| 1515 | 1521 | int account_locked_vm(struct mm_struct *mm, unsigned long pages, bool inc); |
| 1516 | 1522 | int __account_locked_vm(struct mm_struct *mm, unsigned long pages, bool inc, |
| @@ -2575,13 +2581,15 @@ struct page *follow_page(struct vm_area_struct *vma, unsigned long address, · 1058 unmodified lines | ||
| 2575 | 2581 | #define FOLL_ANON 0x8000 /* don't do file mappings */ |
| 2576 | 2582 | #define FOLL_LONGTERM 0x10000 /* mapping lifetime is indefinite: see below */ |
| 2577 | 2583 | #define FOLL_SPLIT_PMD 0x20000 /* split huge pmd before returning */ |
| 2584 | +#define FOLL_PIN 0x40000 /* pages must be released via unpin_user_page */ | |
| 2578 | 2585 | |
| 2579 | 2586 | /* |
| 2580 | − * NOTE on FOLL_LONGTERM: | |
| 2587 | + * FOLL_PIN and FOLL_LONGTERM may be used in various combinations with each | |
| 2588 | + * other. Here is what they mean, and how to use them: | |
| 2581 | 2589 | * |
| 2582 | 2590 | * FOLL_LONGTERM indicates that the page will be held for an indefinite time |
| 2583 | − * period _often_ under userspace control. This is contrasted with | |
| 2584 | − * iov_iter_get_pages() where usages which are transient. | |
| 2591 | + * period _often_ under userspace control. This is in contrast to | |
| 2592 | + * iov_iter_get_pages(), whose usages are transient. | |
| 2585 | 2593 | * |
| 2586 | 2594 | * FIXME: For pages which are part of a filesystem, mappings are subject to the |
| 2587 | 2595 | * lifetime enforced by the filesystem and we need guarantees that longterm |
| @@ -2596,11 +2604,39 @@ struct page *follow_page(struct vm_area_struct *vma, unsigned long address, · 8 unmodified lines | ||
| 2596 | 2604 | * Currently only get_user_pages() and get_user_pages_fast() support this flag |
| 2597 | 2605 | * and calls to get_user_pages_[un]locked are specifically not allowed. This |
| 2598 | 2606 | * is due to an incompatibility with the FS DAX check and |
| 2599 | − * FAULT_FLAG_ALLOW_RETRY | |
| 2607 | + * FAULT_FLAG_ALLOW_RETRY. | |
| 2600 | 2608 | * |
| 2601 | − * In the CMA case: longterm pins in a CMA region would unnecessarily fragment | |
| 2602 | − * that region. And so CMA attempts to migrate the page before pinning when | |
| 2609 | + * In the CMA case: long term pins in a CMA region would unnecessarily fragment | |
| 2610 | + * that region. And so, CMA attempts to migrate the page before pinning, when | |
| 2603 | 2611 | * FOLL_LONGTERM is specified. |
| 2612 | + * | |
| 2613 | + * FOLL_PIN indicates that a special kind of tracking (not just page->_refcount, | |
| 2614 | + * but an additional pin counting system) will be invoked. This is intended for | |
| 2615 | + * anything that gets a page reference and then touches page data (for example, | |
| 2616 | + * Direct IO). This lets the filesystem know that some non-file-system entity is | |
| 2617 | + * potentially changing the pages' data. In contrast to FOLL_GET (whose pages | |
| 2618 | + * are released via put_page()), FOLL_PIN pages must be released, ultimately, by | |
| 2619 | + * a call to unpin_user_page(). | |
| 2620 | + * | |
| 2621 | + * FOLL_PIN is similar to FOLL_GET: both of these pin pages. They use different | |
| 2622 | + * and separate refcounting mechanisms, however, and that means that each has | |
| 2623 | + * its own acquire and release mechanisms: | |
| 2624 | + * | |
| 2625 | + * FOLL_GET: get_user_pages*() to acquire, and put_page() to release. | |
| 2626 | + * | |
| 2627 | + * FOLL_PIN: pin_user_pages*() to acquire, and unpin_user_pages to release. | |
| 2628 | + * | |
| 2629 | + * FOLL_PIN and FOLL_GET are mutually exclusive for a given function call. | |
| 2630 | + * (The underlying pages may experience both FOLL_GET-based and FOLL_PIN-based | |
| 2631 | + * calls applied to them, and that's perfectly OK. This is a constraint on the | |
| 2632 | + * callers, not on the pages.) | |
| 2633 | + * | |
| 2634 | + * FOLL_PIN should be set internally by the pin_user_pages*() APIs, never | |
| 2635 | + * directly by the caller. That's in order to help avoid mismatches when | |
| 2636 | + * releasing pages: get_user_pages*() pages must be released via put_page(), | |
| 2637 | + * while pin_user_pages*() pages must be released via unpin_user_page(). | |
| 2638 | + * | |
| 2639 | + * Please see Documentation/vm/pin_user_pages.rst for more information. | |
| 2604 | 2640 | */ |
| 2605 | 2641 | |
| 2606 | 2642 | static inline int vm_fault_to_errno(vm_fault_t vm_fault, int foll_flags) |
| @@ -758,7 +758,7 @@ typedef struct pglist_data { · 757 unmodified lines | ||
| 758 | 758 | |
| 759 | 759 | #ifdef CONFIG_NUMA |
| 760 | 760 | /* |
| 761 | − * zone reclaim becomes active if more unmapped pages exist. | |
| 761 | + * node reclaim becomes active if more unmapped pages exist. | |
| 762 | 762 | */ |
| 763 | 763 | unsigned long min_unmapped_pages; |
| 764 | 764 | unsigned long min_slab_pages; |
| @@ -33,8 +33,8 @@ static inline bool is_migrate_isolate(int migratetype) · 32 unmodified lines | ||
| 33 | 33 | #define MEMORY_OFFLINE 0x1 |
| 34 | 34 | #define REPORT_FAILURE 0x2 |
| 35 | 35 | |
| 36 | −bool has_unmovable_pages(struct zone *zone, struct page *page, int count, | |
| 37 | − int migratetype, int flags); | |
| 36 | +struct page *has_unmovable_pages(struct zone *zone, struct page *page, | |
| 37 | + int migratetype, int flags); | |
| 38 | 38 | void set_pageblock_migratetype(struct page *page, int migratetype); |
| 39 | 39 | int move_freepages_block(struct zone *zone, struct page *page, |
| 40 | 40 | int migratetype, int *num_movable); |
| @@ -7,6 +7,7 @@ · 6 unmodified lines | ||
| 7 | 7 | # define swab16 __swab16 |
| 8 | 8 | # define swab32 __swab32 |
| 9 | 9 | # define swab64 __swab64 |
| 10 | +# define swab __swab | |
| 10 | 11 | # define swahw32 __swahw32 |
| 11 | 12 | # define swahb32 __swahb32 |
| 12 | 13 | # define swab16p __swab16p |
| @@ -32,17 +32,6 @@ · 31 unmodified lines | ||
| 32 | 32 | /* use value, which < 0K, to indicate an invalid/uninitialized temperature */ |
| 33 | 33 | #define THERMAL_TEMP_INVALID -274000 |
| 34 | 34 | |
| 35 | −/* Unit conversion macros */ | |
| 36 | −#define DECI_KELVIN_TO_CELSIUS(t) ({ \ | |
| 37 | − long _t = (t); \ | |
| 38 | − ((_t-2732 >= 0) ? (_t-2732+5)/10 : (_t-2732-5)/10); \ | |
| 39 | −}) | |
| 40 | −#define CELSIUS_TO_DECI_KELVIN(t) ((t)*10+2732) | |
| 41 | −#define DECI_KELVIN_TO_MILLICELSIUS_WITH_OFFSET(t, off) (((t) - (off)) * 100) | |
| 42 | −#define DECI_KELVIN_TO_MILLICELSIUS(t) DECI_KELVIN_TO_MILLICELSIUS_WITH_OFFSET(t, 2732) | |
| 43 | −#define MILLICELSIUS_TO_DECI_KELVIN_WITH_OFFSET(t, off) (((t) / 100) + (off)) | |
| 44 | −#define MILLICELSIUS_TO_DECI_KELVIN(t) MILLICELSIUS_TO_DECI_KELVIN_WITH_OFFSET(t, 2732) | |
| 45 | − | |
| 46 | 35 | /* Default Thermal Governor */ |
| 47 | 36 | #if defined(CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE) |
| 48 | 37 | #define DEFAULT_THERMAL_GOVERNOR "step_wise" |
| @@ -0,0 +1,84 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | +#ifndef _LINUX_UNITS_H | |
| 3 | +#define _LINUX_UNITS_H | |
| 4 | + | |
| 5 | +#include <linux/kernel.h> | |
| 6 | + | |
| 7 | +#define ABSOLUTE_ZERO_MILLICELSIUS -273150 | |
| 8 | + | |
| 9 | +static inline long milli_kelvin_to_millicelsius(long t) | |
| 10 | +{ | |
| 11 | + return t + ABSOLUTE_ZERO_MILLICELSIUS; | |
| 12 | +} | |
| 13 | + | |
| 14 | +static inline long millicelsius_to_milli_kelvin(long t) | |
| 15 | +{ | |
| 16 | + return t - ABSOLUTE_ZERO_MILLICELSIUS; | |
| 17 | +} | |
| 18 | + | |
| 19 | +#define MILLIDEGREE_PER_DEGREE 1000 | |
| 20 | +#define MILLIDEGREE_PER_DECIDEGREE 100 | |
| 21 | + | |
| 22 | +static inline long kelvin_to_millicelsius(long t) | |
| 23 | +{ | |
| 24 | + return milli_kelvin_to_millicelsius(t * MILLIDEGREE_PER_DEGREE); | |
| 25 | +} | |
| 26 | + | |
| 27 | +static inline long millicelsius_to_kelvin(long t) | |
| 28 | +{ | |
| 29 | + t = millicelsius_to_milli_kelvin(t); | |
| 30 | + | |
| 31 | + return DIV_ROUND_CLOSEST(t, MILLIDEGREE_PER_DEGREE); | |
| 32 | +} | |
| 33 | + | |
| 34 | +static inline long deci_kelvin_to_celsius(long t) | |
| 35 | +{ | |
| 36 | + t = milli_kelvin_to_millicelsius(t * MILLIDEGREE_PER_DECIDEGREE); | |
| 37 | + | |
| 38 | + return DIV_ROUND_CLOSEST(t, MILLIDEGREE_PER_DEGREE); | |
| 39 | +} | |
| 40 | + | |
| 41 | +static inline long celsius_to_deci_kelvin(long t) | |
| 42 | +{ | |
| 43 | + t = millicelsius_to_milli_kelvin(t * MILLIDEGREE_PER_DEGREE); | |
| 44 | + | |
| 45 | + return DIV_ROUND_CLOSEST(t, MILLIDEGREE_PER_DECIDEGREE); | |
| 46 | +} | |
| 47 | + | |
| 48 | +/** | |
| 49 | + * deci_kelvin_to_millicelsius_with_offset - convert Kelvin to Celsius | |
| 50 | + * @t: temperature value in decidegrees Kelvin | |
| 51 | + * @offset: difference between Kelvin and Celsius in millidegrees | |
| 52 | + * | |
| 53 | + * Return: temperature value in millidegrees Celsius | |
| 54 | + */ | |
| 55 | +static inline long deci_kelvin_to_millicelsius_with_offset(long t, long offset) | |
| 56 | +{ | |
| 57 | + return t * MILLIDEGREE_PER_DECIDEGREE - offset; | |
| 58 | +} | |
| 59 | + | |
| 60 | +static inline long deci_kelvin_to_millicelsius(long t) | |
| 61 | +{ | |
| 62 | + return milli_kelvin_to_millicelsius(t * MILLIDEGREE_PER_DECIDEGREE); | |
| 63 | +} | |
| 64 | + | |
| 65 | +static inline long millicelsius_to_deci_kelvin(long t) | |
| 66 | +{ | |
| 67 | + t = millicelsius_to_milli_kelvin(t); | |
| 68 | + | |
| 69 | + return DIV_ROUND_CLOSEST(t, MILLIDEGREE_PER_DECIDEGREE); | |
| 70 | +} | |
| 71 | + | |
| 72 | +static inline long kelvin_to_celsius(long t) | |
| 73 | +{ | |
| 74 | + return t + DIV_ROUND_CLOSEST(ABSOLUTE_ZERO_MILLICELSIUS, | |
| 75 | + MILLIDEGREE_PER_DEGREE); | |
| 76 | +} | |
| 77 | + | |
| 78 | +static inline long celsius_to_kelvin(long t) | |
| 79 | +{ | |
| 80 | + return t - DIV_ROUND_CLOSEST(ABSOLUTE_ZERO_MILLICELSIUS, | |
| 81 | + MILLIDEGREE_PER_DEGREE); | |
| 82 | +} | |
| 83 | + | |
| 84 | +#endif /* _LINUX_UNITS_H */ | |
| @@ -191,6 +191,12 @@ extern int zlib_deflate_workspacesize (int windowBits, int memLevel); · 190 unmodified lines | ||
| 191 | 191 | exceed those passed here. |
| 192 | 192 | */ |
| 193 | 193 | |
| 194 | +extern int zlib_deflate_dfltcc_enabled (void); | |
| 195 | +/* | |
| 196 | + Returns 1 if Deflate-Conversion facility is installed and enabled, | |
| 197 | + otherwise 0. | |
| 198 | +*/ | |
| 199 | + | |
| 194 | 200 | /* |
| 195 | 201 | extern int deflateInit (z_streamp strm, int level); |
| 196 | 202 | |
| @@ -88,8 +88,8 @@ DECLARE_EVENT_CLASS(kmem_alloc_node, · 87 unmodified lines | ||
| 88 | 88 | __entry->node = node; |
| 89 | 89 | ), |
| 90 | 90 | |
| 91 | − TP_printk("call_site=%lx ptr=%p bytes_req=%zu bytes_alloc=%zu gfp_flags=%s node=%d", | |
| 92 | − __entry->call_site, | |
| 91 | + TP_printk("call_site=%pS ptr=%p bytes_req=%zu bytes_alloc=%zu gfp_flags=%s node=%d", | |
| 92 | + (void *)__entry->call_site, | |
| 93 | 93 | __entry->ptr, |
| 94 | 94 | __entry->bytes_req, |
| 95 | 95 | __entry->bytes_alloc, |
| @@ -67,8 +67,8 @@ DECLARE_EVENT_CLASS(writeback_page_template, · 66 unmodified lines | ||
| 67 | 67 | |
| 68 | 68 | TP_fast_assign( |
| 69 | 69 | strscpy_pad(__entry->name, |
| 70 | − mapping ? dev_name(inode_to_bdi(mapping->host)->dev) : "(unknown)", | |
| 71 | − 32); | |
| 70 | + bdi_dev_name(mapping ? inode_to_bdi(mapping->host) : | |
| 71 | + NULL), 32); | |
| 72 | 72 | __entry->ino = mapping ? mapping->host->i_ino : 0; |
| 73 | 73 | __entry->index = page->index; |
| 74 | 74 | ), |
| @@ -111,8 +111,7 @@ DECLARE_EVENT_CLASS(writeback_dirty_inode_template, · 36 unmodified lines | ||
| 111 | 111 | struct backing_dev_info *bdi = inode_to_bdi(inode); |
| 112 | 112 | |
| 113 | 113 | /* may be called for files on pseudo FSes w/ unregistered bdi */ |
| 114 | − strscpy_pad(__entry->name, | |
| 115 | − bdi->dev ? dev_name(bdi->dev) : "(unknown)", 32); | |
| 114 | + strscpy_pad(__entry->name, bdi_dev_name(bdi), 32); | |
| 116 | 115 | __entry->ino = inode->i_ino; |
| 117 | 116 | __entry->state = inode->i_state; |
| 118 | 117 | __entry->flags = flags; |
| @@ -193,7 +192,7 @@ TRACE_EVENT(inode_foreign_history, · 74 unmodified lines | ||
| 193 | 192 | ), |
| 194 | 193 | |
| 195 | 194 | TP_fast_assign( |
| 196 | − strncpy(__entry->name, dev_name(inode_to_bdi(inode)->dev), 32); | |
| 195 | + strncpy(__entry->name, bdi_dev_name(inode_to_bdi(inode)), 32); | |
| 197 | 196 | __entry->ino = inode->i_ino; |
| 198 | 197 | __entry->cgroup_ino = __trace_wbc_assign_cgroup(wbc); |
| 199 | 198 | __entry->history = history; |
| @@ -222,7 +221,7 @@ TRACE_EVENT(inode_switch_wbs, · 22 unmodified lines | ||
| 222 | 221 | ), |
| 223 | 222 | |
| 224 | 223 | TP_fast_assign( |
| 225 | − strncpy(__entry->name, dev_name(old_wb->bdi->dev), 32); | |
| 224 | + strncpy(__entry->name, bdi_dev_name(old_wb->bdi), 32); | |
| 226 | 225 | __entry->ino = inode->i_ino; |
| 227 | 226 | __entry->old_cgroup_ino = __trace_wb_assign_cgroup(old_wb); |
| 228 | 227 | __entry->new_cgroup_ino = __trace_wb_assign_cgroup(new_wb); |
| @@ -255,7 +254,7 @@ TRACE_EVENT(track_foreign_dirty, · 26 unmodified lines | ||
| 255 | 254 | struct address_space *mapping = page_mapping(page); |
| 256 | 255 | struct inode *inode = mapping ? mapping->host : NULL; |
| 257 | 256 | |
| 258 | − strncpy(__entry->name, dev_name(wb->bdi->dev), 32); | |
| 257 | + strncpy(__entry->name, bdi_dev_name(wb->bdi), 32); | |
| 259 | 258 | __entry->bdi_id = wb->bdi->id; |
| 260 | 259 | __entry->ino = inode ? inode->i_ino : 0; |
| 261 | 260 | __entry->memcg_id = wb->memcg_css->id; |
| @@ -288,7 +287,7 @@ TRACE_EVENT(flush_foreign, · 26 unmodified lines | ||
| 288 | 287 | ), |
| 289 | 288 | |
| 290 | 289 | TP_fast_assign( |
| 291 | − strncpy(__entry->name, dev_name(wb->bdi->dev), 32); | |
| 290 | + strncpy(__entry->name, bdi_dev_name(wb->bdi), 32); | |
| 292 | 291 | __entry->cgroup_ino = __trace_wb_assign_cgroup(wb); |
| 293 | 292 | __entry->frn_bdi_id = frn_bdi_id; |
| 294 | 293 | __entry->frn_memcg_id = frn_memcg_id; |
| @@ -318,7 +317,7 @@ DECLARE_EVENT_CLASS(writeback_write_inode_template, · 23 unmodified lines | ||
| 318 | 317 | |
| 319 | 318 | TP_fast_assign( |
| 320 | 319 | strscpy_pad(__entry->name, |
| 321 | − dev_name(inode_to_bdi(inode)->dev), 32); | |
| 320 | + bdi_dev_name(inode_to_bdi(inode)), 32); | |
| 322 | 321 | __entry->ino = inode->i_ino; |
| 323 | 322 | __entry->sync_mode = wbc->sync_mode; |
| 324 | 323 | __entry->cgroup_ino = __trace_wbc_assign_cgroup(wbc); |
| @@ -361,9 +360,7 @@ DECLARE_EVENT_CLASS(writeback_work_class, · 36 unmodified lines | ||
| 361 | 360 | __field(ino_t, cgroup_ino) |
| 362 | 361 | ), |
| 363 | 362 | TP_fast_assign( |
| 364 | − strscpy_pad(__entry->name, | |
| 365 | − wb->bdi->dev ? dev_name(wb->bdi->dev) : | |
| 366 | − "(unknown)", 32); | |
| 363 | + strscpy_pad(__entry->name, bdi_dev_name(wb->bdi), 32); | |
| 367 | 364 | __entry->nr_pages = work->nr_pages; |
| 368 | 365 | __entry->sb_dev = work->sb ? work->sb->s_dev : 0; |
| 369 | 366 | __entry->sync_mode = work->sync_mode; |
| @@ -416,7 +413,7 @@ DECLARE_EVENT_CLASS(writeback_class, · 46 unmodified lines | ||
| 416 | 413 | __field(ino_t, cgroup_ino) |
| 417 | 414 | ), |
| 418 | 415 | TP_fast_assign( |
| 419 | − strscpy_pad(__entry->name, dev_name(wb->bdi->dev), 32); | |
| 416 | + strscpy_pad(__entry->name, bdi_dev_name(wb->bdi), 32); | |
| 420 | 417 | __entry->cgroup_ino = __trace_wb_assign_cgroup(wb); |
| 421 | 418 | ), |
| 422 | 419 | TP_printk("bdi %s: cgroup_ino=%lu", |
| @@ -438,7 +435,7 @@ TRACE_EVENT(writeback_bdi_register, · 15 unmodified lines | ||
| 438 | 435 | __array(char, name, 32) |
| 439 | 436 | ), |
| 440 | 437 | TP_fast_assign( |
| 441 | − strscpy_pad(__entry->name, dev_name(bdi->dev), 32); | |
| 438 | + strscpy_pad(__entry->name, bdi_dev_name(bdi), 32); | |
| 442 | 439 | ), |
| 443 | 440 | TP_printk("bdi %s", |
| 444 | 441 | __entry->name |
| @@ -463,7 +460,7 @@ DECLARE_EVENT_CLASS(wbc_class, · 18 unmodified lines | ||
| 463 | 460 | ), |
| 464 | 461 | |
| 465 | 462 | TP_fast_assign( |
| 466 | − strscpy_pad(__entry->name, dev_name(bdi->dev), 32); | |
| 463 | + strscpy_pad(__entry->name, bdi_dev_name(bdi), 32); | |
| 467 | 464 | __entry->nr_to_write = wbc->nr_to_write; |
| 468 | 465 | __entry->pages_skipped = wbc->pages_skipped; |
| 469 | 466 | __entry->sync_mode = wbc->sync_mode; |
| @@ -514,7 +511,7 @@ TRACE_EVENT(writeback_queue_io, · 44 unmodified lines | ||
| 514 | 511 | ), |
| 515 | 512 | TP_fast_assign( |
| 516 | 513 | unsigned long *older_than_this = work->older_than_this; |
| 517 | − strscpy_pad(__entry->name, dev_name(wb->bdi->dev), 32); | |
| 514 | + strscpy_pad(__entry->name, bdi_dev_name(wb->bdi), 32); | |
| 518 | 515 | __entry->older = older_than_this ? *older_than_this : 0; |
| 519 | 516 | __entry->age = older_than_this ? |
| 520 | 517 | (jiffies - *older_than_this) * 1000 / HZ : -1; |
| @@ -600,7 +597,7 @@ TRACE_EVENT(bdi_dirty_ratelimit, · 79 unmodified lines | ||
| 600 | 597 | ), |
| 601 | 598 | |
| 602 | 599 | TP_fast_assign( |
| 603 | − strscpy_pad(__entry->bdi, dev_name(wb->bdi->dev), 32); | |
| 600 | + strscpy_pad(__entry->bdi, bdi_dev_name(wb->bdi), 32); | |
| 604 | 601 | __entry->write_bw = KBps(wb->write_bandwidth); |
| 605 | 602 | __entry->avg_write_bw = KBps(wb->avg_write_bandwidth); |
| 606 | 603 | __entry->dirty_rate = KBps(dirty_rate); |
| @@ -665,7 +662,7 @@ TRACE_EVENT(balance_dirty_pages, · 58 unmodified lines | ||
| 665 | 662 | |
| 666 | 663 | TP_fast_assign( |
| 667 | 664 | unsigned long freerun = (thresh + bg_thresh) / 2; |
| 668 | − strscpy_pad(__entry->bdi, dev_name(wb->bdi->dev), 32); | |
| 665 | + strscpy_pad(__entry->bdi, bdi_dev_name(wb->bdi), 32); | |
| 669 | 666 | |
| 670 | 667 | __entry->limit = global_wb_domain.dirty_limit; |
| 671 | 668 | __entry->setpoint = (global_wb_domain.dirty_limit + |
| @@ -726,7 +723,7 @@ TRACE_EVENT(writeback_sb_inodes_requeue, · 54 unmodified lines | ||
| 726 | 723 | |
| 727 | 724 | TP_fast_assign( |
| 728 | 725 | strscpy_pad(__entry->name, |
| 729 | − dev_name(inode_to_bdi(inode)->dev), 32); | |
| 726 | + bdi_dev_name(inode_to_bdi(inode)), 32); | |
| 730 | 727 | __entry->ino = inode->i_ino; |
| 731 | 728 | __entry->state = inode->i_state; |
| 732 | 729 | __entry->dirtied_when = inode->dirtied_when; |
| @@ -800,7 +797,7 @@ DECLARE_EVENT_CLASS(writeback_single_inode_template, · 67 unmodified lines | ||
| 800 | 797 | |
| 801 | 798 | TP_fast_assign( |
| 802 | 799 | strscpy_pad(__entry->name, |
| 803 | − dev_name(inode_to_bdi(inode)->dev), 32); | |
| 800 | + bdi_dev_name(inode_to_bdi(inode)), 32); | |
| 804 | 801 | __entry->ino = inode->i_ino; |
| 805 | 802 | __entry->state = inode->i_state; |
| 806 | 803 | __entry->dirtied_when = inode->dirtied_when; |
| @@ -4,6 +4,7 @@ · 3 unmodified lines | ||
| 4 | 4 | |
| 5 | 5 | #include <linux/types.h> |
| 6 | 6 | #include <linux/compiler.h> |
| 7 | +#include <asm/bitsperlong.h> | |
| 7 | 8 | #include <asm/swab.h> |
| 8 | 9 | |
| 9 | 10 | /* |
| @@ -132,6 +133,15 @@ static inline __attribute_const__ __u32 __fswahb32(__u32 val) · 122 unmodified lines | ||
| 132 | 133 | __fswab64(x)) |
| 133 | 134 | #endif |
| 134 | 135 | |
| 136 | +static __always_inline unsigned long __swab(const unsigned long y) | |
| 137 | +{ | |
| 138 | +#if BITS_PER_LONG == 64 | |
| 139 | + return __swab64(y); | |
| 140 | +#else /* BITS_PER_LONG == 32 */ | |
| 141 | + return __swab32(y); | |
| 142 | +#endif | |
| 143 | +} | |
| 144 | + | |
| 135 | 145 | /** |
| 136 | 146 | * __swahw32 - return a word-swapped 32-bit value |
| 137 | 147 | * @x: value to wordswap |
| @@ -195,7 +195,7 @@ enum · 194 unmodified lines | ||
| 195 | 195 | VM_MIN_UNMAPPED=32, /* Set min percent of unmapped pages */ |
| 196 | 196 | VM_PANIC_ON_OOM=33, /* panic at out-of-memory */ |
| 197 | 197 | VM_VDSO_ENABLED=34, /* map VDSO into new processes? */ |
| 198 | − VM_MIN_SLAB=35, /* Percent pages ignored by zone reclaim */ | |
| 198 | + VM_MIN_SLAB=35, /* Percent pages ignored by node reclaim */ | |
| 199 | 199 | }; |
| 200 | 200 | |
| 201 | 201 | |