History

Merge branch 'akpm' (patches from Andrew)

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 ...

Linus Torvalds committed 6 years ago

Commit 7eec11d2 parents ddaefe8 43e76af136 files · +2724 −1293Browse files

Showing the changes to include (18 of 136 files). Show all

Unified · Split

18 files
  1. include/linux/backing-dev.h +10 −0
  2. include/linux/bitops.h +1 −0
  3. include/linux/fs.h +5 −1
  4. include/linux/io-mapping.h +2 −3
  5. include/linux/memblock.h +3 −4
  6. include/linux/memory.h +0 −29
  7. include/linux/memory_hotplug.h +2 −1
  8. include/linux/mm.h +70 −34
  9. include/linux/mmzone.h +1 −1
  10. include/linux/page-isolation.h +2 −2
  11. include/linux/swab.h +1 −0
  12. include/linux/thermal.h +0 −11
  13. include/linux/units.h +84 −0
  14. include/linux/zlib.h +6 −0
  15. include/trace/events/kmem.h +2 −2
  16. include/trace/events/writeback.h +17 −20
  17. include/uapi/linux/swab.h +10 −0
  18. include/uapi/linux/sysctl.h +1 −1
include/linux/backing-dev.h+10−0
@@ -13,6 +13,7 @@ · 12 unmodified lines
1313 #include <linux/fs.h>
1414 #include <linux/sched.h>
1515 #include <linux/blkdev.h>
16+#include <linux/device.h>
1617 #include <linux/writeback.h>
1718 #include <linux/blk-cgroup.h>
1819 #include <linux/backing-dev-defs.h>
@@ -504,4 +505,13 @@ static inline int bdi_rw_congested(struct backing_dev_info *bdi) · 485 unmodified lines
504505 (1 << WB_async_congested));
505506 }
506507
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+
507517 #endif /* _LINUX_BACKING_DEV_H */
include/linux/bitops.h+1−0
@@ -13,6 +13,7 @@ · 12 unmodified lines
1313
1414 #define BITS_PER_TYPE(type) (sizeof(type) * BITS_PER_BYTE)
1515 #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))
1617
1718 extern unsigned int __sw_hweight8(unsigned int w);
1819 extern unsigned int __sw_hweight16(unsigned int w);
include/linux/fs.h+5−1
@@ -2737,7 +2737,6 @@ static inline int filemap_fdatawait(struct address_space *mapping) · 2736 unmodified lines
27372737
27382738 extern bool filemap_range_has_page(struct address_space *, loff_t lstart,
27392739 loff_t lend);
2740−extern int filemap_write_and_wait(struct address_space *mapping);
27412740 extern int filemap_write_and_wait_range(struct address_space *mapping,
27422741 loff_t lstart, loff_t lend);
27432742 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
27472746 extern int filemap_check_errors(struct address_space *mapping);
27482747 extern void __filemap_set_wb_err(struct address_space *mapping, int err);
27492748
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+
27502754 extern int __must_check file_fdatawait_range(struct file *file, loff_t lstart,
27512755 loff_t lend);
27522756 extern int __must_check file_check_and_advance_wb_err(struct file *file);
include/linux/io-mapping.h+2−3
@@ -28,6 +28,7 @@ struct io_mapping { · 27 unmodified lines
2828
2929 #ifdef CONFIG_HAVE_ATOMIC_IOMAP
3030
31+#include <linux/pfn.h>
3132 #include <asm/iomap.h>
3233 /*
3334 * For small address space machines, mapping large objects
@@ -64,12 +65,10 @@ io_mapping_map_atomic_wc(struct io_mapping *mapping, · 30 unmodified lines
6465 unsigned long offset)
6566 {
6667 resource_size_t phys_addr;
67− unsigned long pfn;
6868
6969 BUG_ON(offset >= mapping->size);
7070 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);
7372 }
7473
7574 static inline void
include/linux/memblock.h+3−4
@@ -113,6 +113,9 @@ int memblock_add(phys_addr_t base, phys_addr_t size); · 112 unmodified lines
113113 int memblock_remove(phys_addr_t base, phys_addr_t size);
114114 int memblock_free(phys_addr_t base, phys_addr_t size);
115115 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
116119 void memblock_trim_memory(phys_addr_t align);
117120 bool memblock_overlaps_region(struct memblock_type *type,
118121 phys_addr_t base, phys_addr_t size);
@@ -127,10 +130,6 @@ void reset_node_managed_pages(pg_data_t *pgdat); · 8 unmodified lines
127130 void reset_all_zones_managed_pages(void);
128131
129132 /* 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−
134133 void __next_mem_range(u64 *idx, int nid, enum memblock_flags flags,
135134 struct memblock_type *type_a,
136135 struct memblock_type *type_b, phys_addr_t *out_start,
include/linux/memory.h+0−29
@@ -29,8 +29,6 @@ struct memory_block { · 28 unmodified lines
2929 int section_count; /* serialized by mem_sysfs_mutex */
3030 int online_type; /* for passing data to online routine */
3131 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 *);
3432 struct device dev;
3533 int nid; /* NID for this memory block */
3634 };
@@ -55,19 +53,6 @@ struct memory_notify { · 18 unmodified lines
5553 int status_change_nid;
5654 };
5755
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−
7156 struct notifier_block;
7257 struct mem_section;
7358
@@ -94,27 +79,13 @@ static inline int memory_notify(unsigned long val, void *v) · 20 unmodified lines
9479 {
9580 return 0;
9681 }
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−}
10882 #else
10983 extern int register_memory_notifier(struct notifier_block *nb);
11084 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);
11385 int create_memory_block_devices(unsigned long start, unsigned long size);
11486 void remove_memory_block_devices(unsigned long start, unsigned long size);
11587 extern void memory_dev_init(void);
11688 extern int memory_notify(unsigned long val, void *v);
117−extern int memory_isolate_notify(unsigned long val, void *v);
11889 extern struct memory_block *find_memory_block(struct mem_section *);
11990 typedef int (*walk_memory_blocks_func_t)(struct memory_block *, void *);
12091 extern int walk_memory_blocks(unsigned long start, unsigned long size,
include/linux/memory_hotplug.h+2−1
@@ -94,7 +94,8 @@ extern int zone_grow_free_lists(struct zone *zone, unsigned long new_nr_pages); · 93 unmodified lines
9494 extern int zone_grow_waitqueues(struct zone *zone, unsigned long nr_pages);
9595 extern int add_one_highpage(struct page *page, int pfn, int bad_ppro);
9696 /* 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);
9899 extern int test_pages_in_a_zone(unsigned long start_pfn, unsigned long end_pfn,
99100 unsigned long *valid_start, unsigned long *valid_end);
100101 extern unsigned long __offline_isolated_pages(unsigned long start_pfn,
include/linux/mm.h+70−34
@@ -70,11 +70,6 @@ static inline void totalram_pages_add(long count) · 69 unmodified lines
7070 atomic_long_add(count, &_totalram_pages);
7171 }
7272
73−static inline void totalram_pages_set(long val)
74−{
75− atomic_long_set(&_totalram_pages, val);
76−}
77−
7873 extern void * high_memory;
7974 extern int page_cluster;
8075
@@ -916,10 +911,6 @@ vm_fault_t finish_mkwrite_fault(struct vm_fault *vmf); · 835 unmodified lines
916911
917912 #define ZONEID_PGSHIFT (ZONEID_PGOFF * (ZONEID_SHIFT != 0))
918913
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−
923914 #define ZONES_MASK ((1UL << ZONES_WIDTH) - 1)
924915 #define NODES_MASK ((1UL << NODES_WIDTH) - 1)
925916 #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
947938 #endif
948939
949940 #ifdef CONFIG_DEV_PAGEMAP_OPS
950−void __put_devmap_managed_page(struct page *page);
941+void free_devmap_managed_page(struct page *page);
951942 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)
953945 {
954946 if (!static_branch_unlikely(&devmap_managed_key))
955947 return false;
@@ -958,7 +950,6 @@ static inline bool put_devmap_managed_page(struct page *page) · 2 unmodified lines
958950 switch (page->pgmap->type) {
959951 case MEMORY_DEVICE_PRIVATE:
960952 case MEMORY_DEVICE_FS_DAX:
961− __put_devmap_managed_page(page);
962953 return true;
963954 default:
964955 break;
@@ -966,11 +957,17 @@ static inline bool put_devmap_managed_page(struct page *page) · 1 unmodified line
966957 return false;
967958 }
968959
960+void put_devmap_managed_page(struct page *page);
961+
969962 #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)
971964 {
972965 return false;
973966 }
967+
968+static inline void put_devmap_managed_page(struct page *page)
969+{
970+}
974971 #endif /* CONFIG_DEV_PAGEMAP_OPS */
975972
976973 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
10231020 * need to inform the device driver through callback. See
10241021 * include/linux/memremap.h and HMM for details.
10251022 */
1026− if (put_devmap_managed_page(page))
1023+ if (page_is_devmap_managed(page)) {
1024+ put_devmap_managed_page(page);
10271025 return;
1026+ }
10281027
10291028 if (put_page_testzero(page))
10301029 __put_page(page);
10311030 }
10321031
10331032 /**
1034− * put_user_page() - release a gup-pinned page
1033+ * unpin_user_page() - release a gup-pinned page
10351034 * @page: pointer to page to be released
10361035 *
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.
10431040 *
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.
10471044 */
1048−static inline void put_user_page(struct page *page)
1045+static inline void unpin_user_page(struct page *page)
10491046 {
10501047 put_page(page);
10511048 }
10521049
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);
10551052
1056−void put_user_pages(struct page **pages, unsigned long npages);
1053+void unpin_user_pages(struct page **pages, unsigned long npages);
10571054
10581055 #if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP)
10591056 #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
15011498 unsigned long start, unsigned long nr_pages,
15021499 unsigned int gup_flags, struct page **pages,
15031500 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);
15041505 long get_user_pages(unsigned long start, unsigned long nr_pages,
15051506 unsigned int gup_flags, struct page **pages,
15061507 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);
15071511 long get_user_pages_locked(unsigned long start, unsigned long nr_pages,
15081512 unsigned int gup_flags, struct page **pages, int *locked);
15091513 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
15111515
15121516 int get_user_pages_fast(unsigned long start, int nr_pages,
15131517 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);
15141520
15151521 int account_locked_vm(struct mm_struct *mm, unsigned long pages, bool inc);
15161522 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
25752581 #define FOLL_ANON 0x8000 /* don't do file mappings */
25762582 #define FOLL_LONGTERM 0x10000 /* mapping lifetime is indefinite: see below */
25772583 #define FOLL_SPLIT_PMD 0x20000 /* split huge pmd before returning */
2584+#define FOLL_PIN 0x40000 /* pages must be released via unpin_user_page */
25782585
25792586 /*
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:
25812589 *
25822590 * 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.
25852593 *
25862594 * FIXME: For pages which are part of a filesystem, mappings are subject to the
25872595 * 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
25962604 * Currently only get_user_pages() and get_user_pages_fast() support this flag
25972605 * and calls to get_user_pages_[un]locked are specifically not allowed. This
25982606 * is due to an incompatibility with the FS DAX check and
2599− * FAULT_FLAG_ALLOW_RETRY
2607+ * FAULT_FLAG_ALLOW_RETRY.
26002608 *
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
26032611 * 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.
26042640 */
26052641
26062642 static inline int vm_fault_to_errno(vm_fault_t vm_fault, int foll_flags)
include/linux/mmzone.h+1−1
@@ -758,7 +758,7 @@ typedef struct pglist_data { · 757 unmodified lines
758758
759759 #ifdef CONFIG_NUMA
760760 /*
761− * zone reclaim becomes active if more unmapped pages exist.
761+ * node reclaim becomes active if more unmapped pages exist.
762762 */
763763 unsigned long min_unmapped_pages;
764764 unsigned long min_slab_pages;
include/linux/page-isolation.h+2−2
@@ -33,8 +33,8 @@ static inline bool is_migrate_isolate(int migratetype) · 32 unmodified lines
3333 #define MEMORY_OFFLINE 0x1
3434 #define REPORT_FAILURE 0x2
3535
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);
3838 void set_pageblock_migratetype(struct page *page, int migratetype);
3939 int move_freepages_block(struct zone *zone, struct page *page,
4040 int migratetype, int *num_movable);
include/linux/swab.h+1−0
@@ -7,6 +7,7 @@ · 6 unmodified lines
77 # define swab16 __swab16
88 # define swab32 __swab32
99 # define swab64 __swab64
10+# define swab __swab
1011 # define swahw32 __swahw32
1112 # define swahb32 __swahb32
1213 # define swab16p __swab16p
include/linux/thermal.h+0−11
@@ -32,17 +32,6 @@ · 31 unmodified lines
3232 /* use value, which < 0K, to indicate an invalid/uninitialized temperature */
3333 #define THERMAL_TEMP_INVALID -274000
3434
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−
4635 /* Default Thermal Governor */
4736 #if defined(CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE)
4837 #define DEFAULT_THERMAL_GOVERNOR "step_wise"
include/linux/units.h+84−0
@@ -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 */
include/linux/zlib.h+6−0
@@ -191,6 +191,12 @@ extern int zlib_deflate_workspacesize (int windowBits, int memLevel); · 190 unmodified lines
191191 exceed those passed here.
192192 */
193193
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+
194200 /*
195201 extern int deflateInit (z_streamp strm, int level);
196202
include/trace/events/kmem.h+2−2
@@ -88,8 +88,8 @@ DECLARE_EVENT_CLASS(kmem_alloc_node, · 87 unmodified lines
8888 __entry->node = node;
8989 ),
9090
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,
9393 __entry->ptr,
9494 __entry->bytes_req,
9595 __entry->bytes_alloc,
include/trace/events/writeback.h+17−20
@@ -67,8 +67,8 @@ DECLARE_EVENT_CLASS(writeback_page_template, · 66 unmodified lines
6767
6868 TP_fast_assign(
6969 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);
7272 __entry->ino = mapping ? mapping->host->i_ino : 0;
7373 __entry->index = page->index;
7474 ),
@@ -111,8 +111,7 @@ DECLARE_EVENT_CLASS(writeback_dirty_inode_template, · 36 unmodified lines
111111 struct backing_dev_info *bdi = inode_to_bdi(inode);
112112
113113 /* 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);
116115 __entry->ino = inode->i_ino;
117116 __entry->state = inode->i_state;
118117 __entry->flags = flags;
@@ -193,7 +192,7 @@ TRACE_EVENT(inode_foreign_history, · 74 unmodified lines
193192 ),
194193
195194 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);
197196 __entry->ino = inode->i_ino;
198197 __entry->cgroup_ino = __trace_wbc_assign_cgroup(wbc);
199198 __entry->history = history;
@@ -222,7 +221,7 @@ TRACE_EVENT(inode_switch_wbs, · 22 unmodified lines
222221 ),
223222
224223 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);
226225 __entry->ino = inode->i_ino;
227226 __entry->old_cgroup_ino = __trace_wb_assign_cgroup(old_wb);
228227 __entry->new_cgroup_ino = __trace_wb_assign_cgroup(new_wb);
@@ -255,7 +254,7 @@ TRACE_EVENT(track_foreign_dirty, · 26 unmodified lines
255254 struct address_space *mapping = page_mapping(page);
256255 struct inode *inode = mapping ? mapping->host : NULL;
257256
258− strncpy(__entry->name, dev_name(wb->bdi->dev), 32);
257+ strncpy(__entry->name, bdi_dev_name(wb->bdi), 32);
259258 __entry->bdi_id = wb->bdi->id;
260259 __entry->ino = inode ? inode->i_ino : 0;
261260 __entry->memcg_id = wb->memcg_css->id;
@@ -288,7 +287,7 @@ TRACE_EVENT(flush_foreign, · 26 unmodified lines
288287 ),
289288
290289 TP_fast_assign(
291− strncpy(__entry->name, dev_name(wb->bdi->dev), 32);
290+ strncpy(__entry->name, bdi_dev_name(wb->bdi), 32);
292291 __entry->cgroup_ino = __trace_wb_assign_cgroup(wb);
293292 __entry->frn_bdi_id = frn_bdi_id;
294293 __entry->frn_memcg_id = frn_memcg_id;
@@ -318,7 +317,7 @@ DECLARE_EVENT_CLASS(writeback_write_inode_template, · 23 unmodified lines
318317
319318 TP_fast_assign(
320319 strscpy_pad(__entry->name,
321− dev_name(inode_to_bdi(inode)->dev), 32);
320+ bdi_dev_name(inode_to_bdi(inode)), 32);
322321 __entry->ino = inode->i_ino;
323322 __entry->sync_mode = wbc->sync_mode;
324323 __entry->cgroup_ino = __trace_wbc_assign_cgroup(wbc);
@@ -361,9 +360,7 @@ DECLARE_EVENT_CLASS(writeback_work_class, · 36 unmodified lines
361360 __field(ino_t, cgroup_ino)
362361 ),
363362 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);
367364 __entry->nr_pages = work->nr_pages;
368365 __entry->sb_dev = work->sb ? work->sb->s_dev : 0;
369366 __entry->sync_mode = work->sync_mode;
@@ -416,7 +413,7 @@ DECLARE_EVENT_CLASS(writeback_class, · 46 unmodified lines
416413 __field(ino_t, cgroup_ino)
417414 ),
418415 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);
420417 __entry->cgroup_ino = __trace_wb_assign_cgroup(wb);
421418 ),
422419 TP_printk("bdi %s: cgroup_ino=%lu",
@@ -438,7 +435,7 @@ TRACE_EVENT(writeback_bdi_register, · 15 unmodified lines
438435 __array(char, name, 32)
439436 ),
440437 TP_fast_assign(
441− strscpy_pad(__entry->name, dev_name(bdi->dev), 32);
438+ strscpy_pad(__entry->name, bdi_dev_name(bdi), 32);
442439 ),
443440 TP_printk("bdi %s",
444441 __entry->name
@@ -463,7 +460,7 @@ DECLARE_EVENT_CLASS(wbc_class, · 18 unmodified lines
463460 ),
464461
465462 TP_fast_assign(
466− strscpy_pad(__entry->name, dev_name(bdi->dev), 32);
463+ strscpy_pad(__entry->name, bdi_dev_name(bdi), 32);
467464 __entry->nr_to_write = wbc->nr_to_write;
468465 __entry->pages_skipped = wbc->pages_skipped;
469466 __entry->sync_mode = wbc->sync_mode;
@@ -514,7 +511,7 @@ TRACE_EVENT(writeback_queue_io, · 44 unmodified lines
514511 ),
515512 TP_fast_assign(
516513 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);
518515 __entry->older = older_than_this ? *older_than_this : 0;
519516 __entry->age = older_than_this ?
520517 (jiffies - *older_than_this) * 1000 / HZ : -1;
@@ -600,7 +597,7 @@ TRACE_EVENT(bdi_dirty_ratelimit, · 79 unmodified lines
600597 ),
601598
602599 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);
604601 __entry->write_bw = KBps(wb->write_bandwidth);
605602 __entry->avg_write_bw = KBps(wb->avg_write_bandwidth);
606603 __entry->dirty_rate = KBps(dirty_rate);
@@ -665,7 +662,7 @@ TRACE_EVENT(balance_dirty_pages, · 58 unmodified lines
665662
666663 TP_fast_assign(
667664 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);
669666
670667 __entry->limit = global_wb_domain.dirty_limit;
671668 __entry->setpoint = (global_wb_domain.dirty_limit +
@@ -726,7 +723,7 @@ TRACE_EVENT(writeback_sb_inodes_requeue, · 54 unmodified lines
726723
727724 TP_fast_assign(
728725 strscpy_pad(__entry->name,
729− dev_name(inode_to_bdi(inode)->dev), 32);
726+ bdi_dev_name(inode_to_bdi(inode)), 32);
730727 __entry->ino = inode->i_ino;
731728 __entry->state = inode->i_state;
732729 __entry->dirtied_when = inode->dirtied_when;
@@ -800,7 +797,7 @@ DECLARE_EVENT_CLASS(writeback_single_inode_template, · 67 unmodified lines
800797
801798 TP_fast_assign(
802799 strscpy_pad(__entry->name,
803− dev_name(inode_to_bdi(inode)->dev), 32);
800+ bdi_dev_name(inode_to_bdi(inode)), 32);
804801 __entry->ino = inode->i_ino;
805802 __entry->state = inode->i_state;
806803 __entry->dirtied_when = inode->dirtied_when;
include/uapi/linux/swab.h+10−0
@@ -4,6 +4,7 @@ · 3 unmodified lines
44
55 #include <linux/types.h>
66 #include <linux/compiler.h>
7+#include <asm/bitsperlong.h>
78 #include <asm/swab.h>
89
910 /*
@@ -132,6 +133,15 @@ static inline __attribute_const__ __u32 __fswahb32(__u32 val) · 122 unmodified lines
132133 __fswab64(x))
133134 #endif
134135
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+
135145 /**
136146 * __swahw32 - return a word-swapped 32-bit value
137147 * @x: value to wordswap
include/uapi/linux/sysctl.h+1−1
@@ -195,7 +195,7 @@ enum · 194 unmodified lines
195195 VM_MIN_UNMAPPED=32, /* Set min percent of unmapped pages */
196196 VM_PANIC_ON_OOM=33, /* panic at out-of-memory */
197197 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 */
199199 };
200200
201201