History

Merge branch 'akpm' (patches from Andrew)

Merge yet more updates from Andrew Morton: - More MM work. 100ish more to go. Mike Rapoport's "mm: remove __ARCH_HAS_5LEVEL_HACK" series should fix the current ppc issue - Various other little subsystems * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (127 commits) lib/ubsan.c: fix gcc-10 warnings tools/testing/selftests/vm: remove duplicate headers selftests: vm: pkeys: fix multilib builds for x86 selftests: vm: pkeys: use the correct page size on powerpc selftests/vm/pkeys: override access right definitions on powerpc selftests/vm/pkeys: test correct behaviour of pkey-0 selftests/vm/pkeys: introduce a sub-page allocator selftests/vm/pkeys: detect write violation on a mapped access-denied-key page selftests/vm/pkeys: associate key on a mapped page and detect write violation selftests/vm/pkeys: associate key on a mapped page and detect access violation selftests/vm/pkeys: improve checks to determine pkey support selftests/vm/pkeys: fix assertion in test_pkey_alloc_exhaust() selftests/vm/pkeys: fix number of reserved powerpc pkeys selftests/vm/pkeys: introduce powerpc support selftests/vm/pkeys: introduce generic pkey abstractions selftests: vm: pkeys: use the correct huge page size selftests/vm/pkeys: fix alloc_random_pkey() to make it really random selftests/vm/pkeys: fix assertion in pkey_disable_set/clear() selftests/vm/pkeys: fix pkey_disable_clear() selftests: vm: pkeys: add helpers for pkey bits ...

Linus Torvalds committed 6 years ago

Commit 886d7de2 parents 5bfea2d 469cbd0199 files · +3312 −2163Browse files

Showing the changes to include/linux (9 of 199 files). Show all

Unified · Split

9 files
  1. include/linux/binfmts.h +1 −2
  2. include/linux/bitops.h +1 −1
  3. include/linux/elfnote.h +1 −1
  4. include/linux/highmem.h +75 −6
  5. include/linux/ioport.h +1 −0
  6. include/linux/memory_hotplug.h +2 −7
  7. include/linux/mm.h +3 −9
  8. include/linux/sched.h +3 −0
  9. include/linux/seq_file.h +19 −0
include/linux/binfmts.h+1−2
@@ -130,8 +130,7 @@ extern int setup_arg_pages(struct linux_binprm * bprm, · 129 unmodified lines
130extern int transfer_args_to_stack(struct linux_binprm *bprm,130extern int transfer_args_to_stack(struct linux_binprm *bprm,
131 unsigned long *sp_location);131 unsigned long *sp_location);
132extern int bprm_change_interp(const char *interp, struct linux_binprm *bprm);132extern int bprm_change_interp(const char *interp, struct linux_binprm *bprm);
133extern int copy_strings_kernel(int argc, const char *const *argv,133int copy_string_kernel(const char *arg, struct linux_binprm *bprm);
134 struct linux_binprm *bprm);
135extern void set_binfmt(struct linux_binfmt *new);134extern void set_binfmt(struct linux_binfmt *new);
136extern ssize_t read_code(struct file *, unsigned long, loff_t, size_t);135extern ssize_t read_code(struct file *, unsigned long, loff_t, size_t);
137 136
include/linux/bitops.h+1−1
@@ -72,7 +72,7 @@ static inline int get_bitmask_order(unsigned int count) · 71 unmodified lines
72 72
73static __always_inline unsigned long hweight_long(unsigned long w)73static __always_inline unsigned long hweight_long(unsigned long w)
74{74{
75 return sizeof(w) == 4 ? hweight32(w) : hweight64(w);75 return sizeof(w) == 4 ? hweight32(w) : hweight64((__u64)w);
76}76}
77 77
78/**78/**
include/linux/elfnote.h+1−1
@@ -54,7 +54,7 @@ · 53 unmodified lines
54.popsection ;54.popsection ;
55 55
56#define ELFNOTE(name, type, desc) \56#define ELFNOTE(name, type, desc) \
57 ELFNOTE_START(name, type, "") \57 ELFNOTE_START(name, type, "a") \
58 desc ; \58 desc ; \
59 ELFNOTE_END59 ELFNOTE_END
60 60
include/linux/highmem.h+75−6
@@ -32,8 +32,65 @@ static inline void invalidate_kernel_vmap_range(void *vaddr, int size) · 31 unmodified lines
32#include <asm/kmap_types.h>32#include <asm/kmap_types.h>
33 33
34#ifdef CONFIG_HIGHMEM34#ifdef CONFIG_HIGHMEM
35extern void *kmap_atomic_high_prot(struct page *page, pgprot_t prot);
36extern void kunmap_atomic_high(void *kvaddr);
35#include <asm/highmem.h>37#include <asm/highmem.h>
36 38
39#ifndef ARCH_HAS_KMAP_FLUSH_TLB
40static inline void kmap_flush_tlb(unsigned long addr) { }
41#endif
42
43#ifndef kmap_prot
44#define kmap_prot PAGE_KERNEL
45#endif
46
47void *kmap_high(struct page *page);
48static inline void *kmap(struct page *page)
49{
50 void *addr;
51
52 might_sleep();
53 if (!PageHighMem(page))
54 addr = page_address(page);
55 else
56 addr = kmap_high(page);
57 kmap_flush_tlb((unsigned long)addr);
58 return addr;
59}
60
61void kunmap_high(struct page *page);
62
63static inline void kunmap(struct page *page)
64{
65 might_sleep();
66 if (!PageHighMem(page))
67 return;
68 kunmap_high(page);
69}
70
71/*
72 * kmap_atomic/kunmap_atomic is significantly faster than kmap/kunmap because
73 * no global lock is needed and because the kmap code must perform a global TLB
74 * invalidation when the kmap pool wraps.
75 *
76 * However when holding an atomic kmap is is not legal to sleep, so atomic
77 * kmaps are appropriate for short, tight code paths only.
78 *
79 * The use of kmap_atomic/kunmap_atomic is discouraged - kmap/kunmap
80 * gives a more generic (and caching) interface. But kmap_atomic can
81 * be used in IRQ contexts, so in some (very limited) cases we need
82 * it.
83 */
84static inline void *kmap_atomic_prot(struct page *page, pgprot_t prot)
85{
86 preempt_disable();
87 pagefault_disable();
88 if (!PageHighMem(page))
89 return page_address(page);
90 return kmap_atomic_high_prot(page, prot);
91}
92#define kmap_atomic(page) kmap_atomic_prot(page, kmap_prot)
93
37/* declarations for linux/mm/highmem.c */94/* declarations for linux/mm/highmem.c */
38unsigned int nr_free_highpages(void);95unsigned int nr_free_highpages(void);
39extern atomic_long_t _totalhigh_pages;96extern atomic_long_t _totalhigh_pages;
@@ -77,15 +134,21 @@ static inline struct page *kmap_to_page(void *addr) · 37 unmodified lines
77 134
78static inline unsigned long totalhigh_pages(void) { return 0UL; }135static inline unsigned long totalhigh_pages(void) { return 0UL; }
79 136
80#ifndef ARCH_HAS_KMAP
81static inline void *kmap(struct page *page)137static inline void *kmap(struct page *page)
82{138{
83 might_sleep();139 might_sleep();
84 return page_address(page);140 return page_address(page);
85}141}
86 142
143static inline void kunmap_high(struct page *page)
144{
145}
146
87static inline void kunmap(struct page *page)147static inline void kunmap(struct page *page)
88{148{
149#ifdef ARCH_HAS_FLUSH_ON_KUNMAP
150 kunmap_flush_on_unmap(page_address(page));
151#endif
89}152}
90 153
91static inline void *kmap_atomic(struct page *page)154static inline void *kmap_atomic(struct page *page)
@@ -96,16 +159,20 @@ static inline void *kmap_atomic(struct page *page) · 4 unmodified lines
96}159}
97#define kmap_atomic_prot(page, prot) kmap_atomic(page)160#define kmap_atomic_prot(page, prot) kmap_atomic(page)
98 161
99static inline void __kunmap_atomic(void *addr)162static inline void kunmap_atomic_high(void *addr)
100{163{
101 pagefault_enable();164 /*
102 preempt_enable();165 * Mostly nothing to do in the CONFIG_HIGHMEM=n case as kunmap_atomic()
166 * handles re-enabling faults + preemption
167 */
168#ifdef ARCH_HAS_FLUSH_ON_KUNMAP
169 kunmap_flush_on_unmap(addr);
170#endif
103}171}
104 172
105#define kmap_atomic_pfn(pfn) kmap_atomic(pfn_to_page(pfn))173#define kmap_atomic_pfn(pfn) kmap_atomic(pfn_to_page(pfn))
106 174
107#define kmap_flush_unused() do {} while(0)175#define kmap_flush_unused() do {} while(0)
108#endif
109 176
110#endif /* CONFIG_HIGHMEM */177#endif /* CONFIG_HIGHMEM */
111 178
@@ -149,7 +216,9 @@ static inline void kmap_atomic_idx_pop(void) · 37 unmodified lines
149#define kunmap_atomic(addr) \216#define kunmap_atomic(addr) \
150do { \217do { \
151 BUILD_BUG_ON(__same_type((addr), struct page *)); \218 BUILD_BUG_ON(__same_type((addr), struct page *)); \
152 __kunmap_atomic(addr); \219 kunmap_atomic_high(addr); \
220 pagefault_enable(); \
221 preempt_enable(); \
153} while (0)222} while (0)
154 223
155 224
include/linux/ioport.h+1−0
@@ -103,6 +103,7 @@ struct resource { · 102 unmodified lines
103#define IORESOURCE_MEM_32BIT (3<<3)103#define IORESOURCE_MEM_32BIT (3<<3)
104#define IORESOURCE_MEM_SHADOWABLE (1<<5) /* dup: IORESOURCE_SHADOWABLE */104#define IORESOURCE_MEM_SHADOWABLE (1<<5) /* dup: IORESOURCE_SHADOWABLE */
105#define IORESOURCE_MEM_EXPANSIONROM (1<<6)105#define IORESOURCE_MEM_EXPANSIONROM (1<<6)
106#define IORESOURCE_MEM_DRIVER_MANAGED (1<<7)
106 107
107/* PnP I/O specific bits (IORESOURCE_BITS) */108/* PnP I/O specific bits (IORESOURCE_BITS) */
108#define IORESOURCE_IO_16BIT_ADDR (1<<0)109#define IORESOURCE_IO_16BIT_ADDR (1<<0)
include/linux/memory_hotplug.h+2−7
@@ -314,19 +314,12 @@ static inline void pgdat_resize_init(struct pglist_data *pgdat) {} · 313 unmodified lines
314 314
315#ifdef CONFIG_MEMORY_HOTREMOVE315#ifdef CONFIG_MEMORY_HOTREMOVE
316 316
317extern bool is_mem_section_removable(unsigned long pfn, unsigned long nr_pages);
318extern void try_offline_node(int nid);317extern void try_offline_node(int nid);
319extern int offline_pages(unsigned long start_pfn, unsigned long nr_pages);318extern int offline_pages(unsigned long start_pfn, unsigned long nr_pages);
320extern int remove_memory(int nid, u64 start, u64 size);319extern int remove_memory(int nid, u64 start, u64 size);
321extern void __remove_memory(int nid, u64 start, u64 size);320extern void __remove_memory(int nid, u64 start, u64 size);
322 321
323#else322#else
324static inline bool is_mem_section_removable(unsigned long pfn,
325 unsigned long nr_pages)
326{
327 return false;
328}
329
330static inline void try_offline_node(int nid) {}323static inline void try_offline_node(int nid) {}
331 324
332static inline int offline_pages(unsigned long start_pfn, unsigned long nr_pages)325static inline int offline_pages(unsigned long start_pfn, unsigned long nr_pages)
@@ -349,6 +342,8 @@ extern void __ref free_area_init_core_hotplug(int nid); · 16 unmodified lines
349extern int __add_memory(int nid, u64 start, u64 size);342extern int __add_memory(int nid, u64 start, u64 size);
350extern int add_memory(int nid, u64 start, u64 size);343extern int add_memory(int nid, u64 start, u64 size);
351extern int add_memory_resource(int nid, struct resource *resource);344extern int add_memory_resource(int nid, struct resource *resource);
345extern int add_memory_driver_managed(int nid, u64 start, u64 size,
346 const char *resource_name);
352extern void move_pfn_range_to_zone(struct zone *zone, unsigned long start_pfn,347extern void move_pfn_range_to_zone(struct zone *zone, unsigned long start_pfn,
353 unsigned long nr_pages, struct vmem_altmap *altmap);348 unsigned long nr_pages, struct vmem_altmap *altmap);
354extern void remove_pfn_range_from_zone(struct zone *zone,349extern void remove_pfn_range_from_zone(struct zone *zone,
include/linux/mm.h+3−9
@@ -776,6 +776,7 @@ static inline void *kvcalloc(size_t n, size_t size, gfp_t flags) · 775 unmodified lines
776}776}
777 777
778extern void kvfree(const void *addr);778extern void kvfree(const void *addr);
779extern void kvfree_sensitive(const void *addr, size_t len);
779 780
780/*781/*
781 * Mapcount of compound page as a whole, does not include mapped sub-pages.782 * Mapcount of compound page as a whole, does not include mapped sub-pages.
@@ -1372,7 +1373,7 @@ static inline int cpu_pid_to_cpupid(int nid, int pid) · 590 unmodified lines
1372 1373
1373static inline bool cpupid_pid_unset(int cpupid)1374static inline bool cpupid_pid_unset(int cpupid)
1374{1375{
1375 return 1;1376 return true;
1376}1377}
1377 1378
1378static inline void page_cpupid_reset_last(struct page *page)1379static inline void page_cpupid_reset_last(struct page *page)
@@ -1725,7 +1726,7 @@ struct frame_vector { · 346 unmodified lines
1725 unsigned int nr_frames; /* Number of frames stored in ptrs array */1726 unsigned int nr_frames; /* Number of frames stored in ptrs array */
1726 bool got_ref; /* Did we pin pages by getting page ref? */1727 bool got_ref; /* Did we pin pages by getting page ref? */
1727 bool is_pfns; /* Does array contain pages or pfns? */1728 bool is_pfns; /* Does array contain pages or pfns? */
1728 void *ptrs[0]; /* Array of pinned pfns / pages. Use1729 void *ptrs[]; /* Array of pinned pfns / pages. Use
1729 * pfns_vector_pages() or pfns_vector_pfns()1730 * pfns_vector_pages() or pfns_vector_pfns()
1730 * for access */1731 * for access */
1731};1732};
@@ -2069,11 +2070,6 @@ int __pte_alloc_kernel(pmd_t *pmd); · 337 unmodified lines
2069 2070
2070#if defined(CONFIG_MMU)2071#if defined(CONFIG_MMU)
2071 2072
2072/*
2073 * The following ifdef needed to get the 5level-fixup.h header to work.
2074 * Remove it when 5level-fixup.h has been removed.
2075 */
2076#ifndef __ARCH_HAS_5LEVEL_HACK
2077static inline p4d_t *p4d_alloc(struct mm_struct *mm, pgd_t *pgd,2073static inline p4d_t *p4d_alloc(struct mm_struct *mm, pgd_t *pgd,
2078 unsigned long address)2074 unsigned long address)
2079{2075{
@@ -2102,8 +2098,6 @@ static inline p4d_t *p4d_alloc_track(struct mm_struct *mm, pgd_t *pgd, · 22 unmodified lines
2102 return p4d_offset(pgd, address);2098 return p4d_offset(pgd, address);
2103}2099}
2104 2100
2105#endif /* !__ARCH_HAS_5LEVEL_HACK */
2106
2107static inline pud_t *pud_alloc_track(struct mm_struct *mm, p4d_t *p4d,2101static inline pud_t *pud_alloc_track(struct mm_struct *mm, p4d_t *p4d,
2108 unsigned long address,2102 unsigned long address,
2109 pgtbl_mod_mask *mod_mask)2103 pgtbl_mod_mask *mod_mask)
include/linux/sched.h+3−0
@@ -1247,6 +1247,9 @@ struct task_struct { · 1246 unmodified lines
1247 1247
1248 /* KCOV sequence number: */1248 /* KCOV sequence number: */
1249 int kcov_sequence;1249 int kcov_sequence;
1250
1251 /* Collect coverage from softirq context: */
1252 unsigned int kcov_softirq;
1250#endif1253#endif
1251 1254
1252#ifdef CONFIG_MEMCG1255#ifdef CONFIG_MEMCG
include/linux/seq_file.h+19−0
@@ -145,6 +145,25 @@ void *__seq_open_private(struct file *, const struct seq_operations *, int); · 144 unmodified lines
145int seq_open_private(struct file *, const struct seq_operations *, int);145int seq_open_private(struct file *, const struct seq_operations *, int);
146int seq_release_private(struct inode *, struct file *);146int seq_release_private(struct inode *, struct file *);
147 147
148#define DEFINE_SEQ_ATTRIBUTE(__name) \
149static int __name ## _open(struct inode *inode, struct file *file) \
150{ \
151 int ret = seq_open(file, &__name ## _sops); \
152 if (!ret && inode->i_private) { \
153 struct seq_file *seq_f = file->private_data; \
154 seq_f->private = inode->i_private; \
155 } \
156 return ret; \
157} \
158 \
159static const struct file_operations __name ## _fops = { \
160 .owner = THIS_MODULE, \
161 .open = __name ## _open, \
162 .read = seq_read, \
163 .llseek = seq_lseek, \
164 .release = seq_release, \
165}
166
148#define DEFINE_SHOW_ATTRIBUTE(__name) \167#define DEFINE_SHOW_ATTRIBUTE(__name) \
149static int __name ## _open(struct inode *inode, struct file *file) \168static int __name ## _open(struct inode *inode, struct file *file) \
150{ \169{ \