aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/bits.h17
-rw-r--r--include/linux/coda.h3
-rw-r--r--include/linux/coda_psdev.h72
-rw-r--r--include/linux/compat.h3
-rw-r--r--include/linux/io.h1
-rw-r--r--include/linux/kernel.h2
-rw-r--r--include/linux/kprobes.h19
-rw-r--r--include/linux/lz4.h18
-rw-r--r--include/linux/memory_hotplug.h8
-rw-r--r--include/linux/mm.h45
-rw-r--r--include/linux/pfn_t.h4
-rw-r--r--include/linux/pid.h5
-rw-r--r--include/linux/poison.h2
-rw-r--r--include/linux/rbtree.h70
-rw-r--r--include/linux/rbtree_augmented.h27
-rw-r--r--include/linux/sched/signal.h16
-rw-r--r--include/linux/signal.h4
-rw-r--r--include/linux/swapops.h5
-rw-r--r--include/linux/tracehook.h9
19 files changed, 153 insertions, 177 deletions
diff --git a/include/linux/bits.h b/include/linux/bits.h
index 2b7b532c1d51..669d69441a62 100644
--- a/include/linux/bits.h
+++ b/include/linux/bits.h
@@ -1,13 +1,15 @@
1/* SPDX-License-Identifier: GPL-2.0 */ 1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __LINUX_BITS_H 2#ifndef __LINUX_BITS_H
3#define __LINUX_BITS_H 3#define __LINUX_BITS_H
4
5#include <linux/const.h>
4#include <asm/bitsperlong.h> 6#include <asm/bitsperlong.h>
5 7
6#define BIT(nr) (1UL << (nr)) 8#define BIT(nr) (UL(1) << (nr))
7#define BIT_ULL(nr) (1ULL << (nr)) 9#define BIT_ULL(nr) (ULL(1) << (nr))
8#define BIT_MASK(nr) (1UL << ((nr) % BITS_PER_LONG)) 10#define BIT_MASK(nr) (UL(1) << ((nr) % BITS_PER_LONG))
9#define BIT_WORD(nr) ((nr) / BITS_PER_LONG) 11#define BIT_WORD(nr) ((nr) / BITS_PER_LONG)
10#define BIT_ULL_MASK(nr) (1ULL << ((nr) % BITS_PER_LONG_LONG)) 12#define BIT_ULL_MASK(nr) (ULL(1) << ((nr) % BITS_PER_LONG_LONG))
11#define BIT_ULL_WORD(nr) ((nr) / BITS_PER_LONG_LONG) 13#define BIT_ULL_WORD(nr) ((nr) / BITS_PER_LONG_LONG)
12#define BITS_PER_BYTE 8 14#define BITS_PER_BYTE 8
13 15
@@ -17,10 +19,11 @@
17 * GENMASK_ULL(39, 21) gives us the 64bit vector 0x000000ffffe00000. 19 * GENMASK_ULL(39, 21) gives us the 64bit vector 0x000000ffffe00000.
18 */ 20 */
19#define GENMASK(h, l) \ 21#define GENMASK(h, l) \
20 (((~0UL) - (1UL << (l)) + 1) & (~0UL >> (BITS_PER_LONG - 1 - (h)))) 22 (((~UL(0)) - (UL(1) << (l)) + 1) & \
23 (~UL(0) >> (BITS_PER_LONG - 1 - (h))))
21 24
22#define GENMASK_ULL(h, l) \ 25#define GENMASK_ULL(h, l) \
23 (((~0ULL) - (1ULL << (l)) + 1) & \ 26 (((~ULL(0)) - (ULL(1) << (l)) + 1) & \
24 (~0ULL >> (BITS_PER_LONG_LONG - 1 - (h)))) 27 (~ULL(0) >> (BITS_PER_LONG_LONG - 1 - (h))))
25 28
26#endif /* __LINUX_BITS_H */ 29#endif /* __LINUX_BITS_H */
diff --git a/include/linux/coda.h b/include/linux/coda.h
index d30209b9cef8..0ca0c83fdb1c 100644
--- a/include/linux/coda.h
+++ b/include/linux/coda.h
@@ -58,8 +58,7 @@ Mellon the rights to redistribute these changes without encumbrance.
58#ifndef _CODA_HEADER_ 58#ifndef _CODA_HEADER_
59#define _CODA_HEADER_ 59#define _CODA_HEADER_
60 60
61#if defined(__linux__)
62typedef unsigned long long u_quad_t; 61typedef unsigned long long u_quad_t;
63#endif 62
64#include <uapi/linux/coda.h> 63#include <uapi/linux/coda.h>
65#endif 64#endif
diff --git a/include/linux/coda_psdev.h b/include/linux/coda_psdev.h
deleted file mode 100644
index 15170954aa2b..000000000000
--- a/include/linux/coda_psdev.h
+++ /dev/null
@@ -1,72 +0,0 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __CODA_PSDEV_H
3#define __CODA_PSDEV_H
4
5#include <linux/backing-dev.h>
6#include <linux/mutex.h>
7#include <uapi/linux/coda_psdev.h>
8
9struct kstatfs;
10
11/* communication pending/processing queues */
12struct venus_comm {
13 u_long vc_seq;
14 wait_queue_head_t vc_waitq; /* Venus wait queue */
15 struct list_head vc_pending;
16 struct list_head vc_processing;
17 int vc_inuse;
18 struct super_block *vc_sb;
19 struct mutex vc_mutex;
20};
21
22
23static inline struct venus_comm *coda_vcp(struct super_block *sb)
24{
25 return (struct venus_comm *)((sb)->s_fs_info);
26}
27
28/* upcalls */
29int venus_rootfid(struct super_block *sb, struct CodaFid *fidp);
30int venus_getattr(struct super_block *sb, struct CodaFid *fid,
31 struct coda_vattr *attr);
32int venus_setattr(struct super_block *, struct CodaFid *, struct coda_vattr *);
33int venus_lookup(struct super_block *sb, struct CodaFid *fid,
34 const char *name, int length, int *type,
35 struct CodaFid *resfid);
36int venus_close(struct super_block *sb, struct CodaFid *fid, int flags,
37 kuid_t uid);
38int venus_open(struct super_block *sb, struct CodaFid *fid, int flags,
39 struct file **f);
40int venus_mkdir(struct super_block *sb, struct CodaFid *dirfid,
41 const char *name, int length,
42 struct CodaFid *newfid, struct coda_vattr *attrs);
43int venus_create(struct super_block *sb, struct CodaFid *dirfid,
44 const char *name, int length, int excl, int mode,
45 struct CodaFid *newfid, struct coda_vattr *attrs) ;
46int venus_rmdir(struct super_block *sb, struct CodaFid *dirfid,
47 const char *name, int length);
48int venus_remove(struct super_block *sb, struct CodaFid *dirfid,
49 const char *name, int length);
50int venus_readlink(struct super_block *sb, struct CodaFid *fid,
51 char *buffer, int *length);
52int venus_rename(struct super_block *, struct CodaFid *new_fid,
53 struct CodaFid *old_fid, size_t old_length,
54 size_t new_length, const char *old_name,
55 const char *new_name);
56int venus_link(struct super_block *sb, struct CodaFid *fid,
57 struct CodaFid *dirfid, const char *name, int len );
58int venus_symlink(struct super_block *sb, struct CodaFid *fid,
59 const char *name, int len, const char *symname, int symlen);
60int venus_access(struct super_block *sb, struct CodaFid *fid, int mask);
61int venus_pioctl(struct super_block *sb, struct CodaFid *fid,
62 unsigned int cmd, struct PioctlData *data);
63int coda_downcall(struct venus_comm *vcp, int opcode, union outputArgs *out);
64int venus_fsync(struct super_block *sb, struct CodaFid *fid);
65int venus_statfs(struct dentry *dentry, struct kstatfs *sfs);
66
67/*
68 * Statistics
69 */
70
71extern struct venus_comm coda_comms[];
72#endif
diff --git a/include/linux/compat.h b/include/linux/compat.h
index ebddcb6cfcf8..16dafd9f4b86 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -138,8 +138,7 @@ typedef struct {
138 compat_sigset_word sig[_COMPAT_NSIG_WORDS]; 138 compat_sigset_word sig[_COMPAT_NSIG_WORDS];
139} compat_sigset_t; 139} compat_sigset_t;
140 140
141int set_compat_user_sigmask(const compat_sigset_t __user *usigmask, 141int set_compat_user_sigmask(const compat_sigset_t __user *umask,
142 sigset_t *set, sigset_t *oldset,
143 size_t sigsetsize); 142 size_t sigsetsize);
144 143
145struct compat_sigaction { 144struct compat_sigaction {
diff --git a/include/linux/io.h b/include/linux/io.h
index 9876e5801a9d..accac822336a 100644
--- a/include/linux/io.h
+++ b/include/linux/io.h
@@ -33,6 +33,7 @@ static inline int ioremap_page_range(unsigned long addr, unsigned long end,
33 33
34#ifdef CONFIG_HAVE_ARCH_HUGE_VMAP 34#ifdef CONFIG_HAVE_ARCH_HUGE_VMAP
35void __init ioremap_huge_init(void); 35void __init ioremap_huge_init(void);
36int arch_ioremap_p4d_supported(void);
36int arch_ioremap_pud_supported(void); 37int arch_ioremap_pud_supported(void);
37int arch_ioremap_pmd_supported(void); 38int arch_ioremap_pmd_supported(void);
38#else 39#else
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 0c9bc231107f..4fa360a13c1e 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -88,6 +88,8 @@
88 */ 88 */
89#define FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f)) 89#define FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f))
90 90
91#define typeof_member(T, m) typeof(((T*)0)->m)
92
91#define DIV_ROUND_UP __KERNEL_DIV_ROUND_UP 93#define DIV_ROUND_UP __KERNEL_DIV_ROUND_UP
92 94
93#define DIV_ROUND_DOWN_ULL(ll, d) \ 95#define DIV_ROUND_DOWN_ULL(ll, d) \
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h
index 443d9800ca3f..04bdaf01112c 100644
--- a/include/linux/kprobes.h
+++ b/include/linux/kprobes.h
@@ -458,4 +458,23 @@ static inline bool is_kprobe_optinsn_slot(unsigned long addr)
458} 458}
459#endif 459#endif
460 460
461/* Returns true if kprobes handled the fault */
462static nokprobe_inline bool kprobe_page_fault(struct pt_regs *regs,
463 unsigned int trap)
464{
465 if (!kprobes_built_in())
466 return false;
467 if (user_mode(regs))
468 return false;
469 /*
470 * To be potentially processing a kprobe fault and to be allowed
471 * to call kprobe_running(), we have to be non-preemptible.
472 */
473 if (preemptible())
474 return false;
475 if (!kprobe_running())
476 return false;
477 return kprobe_fault_handler(regs, trap);
478}
479
461#endif /* _LINUX_KPROBES_H */ 480#endif /* _LINUX_KPROBES_H */
diff --git a/include/linux/lz4.h b/include/linux/lz4.h
index 394e3d9213b8..b16e15b9587a 100644
--- a/include/linux/lz4.h
+++ b/include/linux/lz4.h
@@ -278,7 +278,7 @@ int LZ4_decompress_fast(const char *source, char *dest, int originalSize);
278 * @compressedSize: is the precise full size of the compressed block 278 * @compressedSize: is the precise full size of the compressed block
279 * @maxDecompressedSize: is the size of 'dest' buffer 279 * @maxDecompressedSize: is the size of 'dest' buffer
280 * 280 *
281 * Decompresses data fom 'source' into 'dest'. 281 * Decompresses data from 'source' into 'dest'.
282 * If the source stream is detected malformed, the function will 282 * If the source stream is detected malformed, the function will
283 * stop decoding and return a negative result. 283 * stop decoding and return a negative result.
284 * This function is protected against buffer overflow exploits, 284 * This function is protected against buffer overflow exploits,
@@ -522,7 +522,7 @@ int LZ4_setStreamDecode(LZ4_streamDecode_t *LZ4_streamDecode,
522 const char *dictionary, int dictSize); 522 const char *dictionary, int dictSize);
523 523
524/** 524/**
525 * LZ4_decompress_fast_continue() - Decompress blocks in streaming mode 525 * LZ4_decompress_safe_continue() - Decompress blocks in streaming mode
526 * @LZ4_streamDecode: the 'LZ4_streamDecode_t' structure 526 * @LZ4_streamDecode: the 'LZ4_streamDecode_t' structure
527 * @source: source address of the compressed data 527 * @source: source address of the compressed data
528 * @dest: output buffer address of the uncompressed data 528 * @dest: output buffer address of the uncompressed data
@@ -530,7 +530,7 @@ int LZ4_setStreamDecode(LZ4_streamDecode_t *LZ4_streamDecode,
530 * @compressedSize: is the precise full size of the compressed block 530 * @compressedSize: is the precise full size of the compressed block
531 * @maxDecompressedSize: is the size of 'dest' buffer 531 * @maxDecompressedSize: is the size of 'dest' buffer
532 * 532 *
533 * These decoding function allows decompression of multiple blocks 533 * This decoding function allows decompression of multiple blocks
534 * in "streaming" mode. 534 * in "streaming" mode.
535 * Previously decoded blocks *must* remain available at the memory position 535 * Previously decoded blocks *must* remain available at the memory position
536 * where they were decoded (up to 64 KB) 536 * where they were decoded (up to 64 KB)
@@ -569,7 +569,7 @@ int LZ4_decompress_safe_continue(LZ4_streamDecode_t *LZ4_streamDecode,
569 * which must be already allocated with 'originalSize' bytes 569 * which must be already allocated with 'originalSize' bytes
570 * @originalSize: is the original and therefore uncompressed size 570 * @originalSize: is the original and therefore uncompressed size
571 * 571 *
572 * These decoding function allows decompression of multiple blocks 572 * This decoding function allows decompression of multiple blocks
573 * in "streaming" mode. 573 * in "streaming" mode.
574 * Previously decoded blocks *must* remain available at the memory position 574 * Previously decoded blocks *must* remain available at the memory position
575 * where they were decoded (up to 64 KB) 575 * where they were decoded (up to 64 KB)
@@ -610,10 +610,10 @@ int LZ4_decompress_fast_continue(LZ4_streamDecode_t *LZ4_streamDecode,
610 * @dictStart: pointer to the start of the dictionary in memory 610 * @dictStart: pointer to the start of the dictionary in memory
611 * @dictSize: size of dictionary 611 * @dictSize: size of dictionary
612 * 612 *
613 * These decoding function works the same as 613 * This decoding function works the same as
614 * a combination of LZ4_setStreamDecode() followed by 614 * a combination of LZ4_setStreamDecode() followed by
615 * LZ4_decompress_safe_continue() 615 * LZ4_decompress_safe_continue()
616 * It is stand-alone, and don'tn eed a LZ4_streamDecode_t structure. 616 * It is stand-alone, and doesn't need an LZ4_streamDecode_t structure.
617 * 617 *
618 * Return: number of bytes decompressed into destination buffer 618 * Return: number of bytes decompressed into destination buffer
619 * (necessarily <= maxDecompressedSize) 619 * (necessarily <= maxDecompressedSize)
@@ -633,10 +633,10 @@ int LZ4_decompress_safe_usingDict(const char *source, char *dest,
633 * @dictStart: pointer to the start of the dictionary in memory 633 * @dictStart: pointer to the start of the dictionary in memory
634 * @dictSize: size of dictionary 634 * @dictSize: size of dictionary
635 * 635 *
636 * These decoding function works the same as 636 * This decoding function works the same as
637 * a combination of LZ4_setStreamDecode() followed by 637 * a combination of LZ4_setStreamDecode() followed by
638 * LZ4_decompress_safe_continue() 638 * LZ4_decompress_fast_continue()
639 * It is stand-alone, and don'tn eed a LZ4_streamDecode_t structure. 639 * It is stand-alone, and doesn't need an LZ4_streamDecode_t structure.
640 * 640 *
641 * Return: number of bytes decompressed into destination buffer 641 * Return: number of bytes decompressed into destination buffer
642 * (necessarily <= maxDecompressedSize) 642 * (necessarily <= maxDecompressedSize)
diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h
index ae892eef8b82..988fde33cd7f 100644
--- a/include/linux/memory_hotplug.h
+++ b/include/linux/memory_hotplug.h
@@ -324,7 +324,7 @@ static inline void pgdat_resize_init(struct pglist_data *pgdat) {}
324extern bool is_mem_section_removable(unsigned long pfn, unsigned long nr_pages); 324extern bool is_mem_section_removable(unsigned long pfn, unsigned long nr_pages);
325extern void try_offline_node(int nid); 325extern void try_offline_node(int nid);
326extern int offline_pages(unsigned long start_pfn, unsigned long nr_pages); 326extern int offline_pages(unsigned long start_pfn, unsigned long nr_pages);
327extern void remove_memory(int nid, u64 start, u64 size); 327extern int remove_memory(int nid, u64 start, u64 size);
328extern void __remove_memory(int nid, u64 start, u64 size); 328extern void __remove_memory(int nid, u64 start, u64 size);
329 329
330#else 330#else
@@ -341,7 +341,11 @@ static inline int offline_pages(unsigned long start_pfn, unsigned long nr_pages)
341 return -EINVAL; 341 return -EINVAL;
342} 342}
343 343
344static inline void remove_memory(int nid, u64 start, u64 size) {} 344static inline int remove_memory(int nid, u64 start, u64 size)
345{
346 return -EBUSY;
347}
348
345static inline void __remove_memory(int nid, u64 start, u64 size) {} 349static inline void __remove_memory(int nid, u64 start, u64 size) {}
346#endif /* CONFIG_MEMORY_HOTREMOVE */ 350#endif /* CONFIG_MEMORY_HOTREMOVE */
347 351
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 0389c34ac529..bd6512559bed 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -547,7 +547,7 @@ static inline void vma_set_anonymous(struct vm_area_struct *vma)
547struct mmu_gather; 547struct mmu_gather;
548struct inode; 548struct inode;
549 549
550#if !defined(__HAVE_ARCH_PTE_DEVMAP) || !defined(CONFIG_TRANSPARENT_HUGEPAGE) 550#if !defined(CONFIG_ARCH_HAS_PTE_DEVMAP) || !defined(CONFIG_TRANSPARENT_HUGEPAGE)
551static inline int pmd_devmap(pmd_t pmd) 551static inline int pmd_devmap(pmd_t pmd)
552{ 552{
553 return 0; 553 return 0;
@@ -956,41 +956,28 @@ static inline bool put_devmap_managed_page(struct page *page)
956 return false; 956 return false;
957} 957}
958 958
959static inline bool is_device_private_page(const struct page *page)
960{
961 return is_zone_device_page(page) &&
962 page->pgmap->type == MEMORY_DEVICE_PRIVATE;
963}
964
965#ifdef CONFIG_PCI_P2PDMA
966static inline bool is_pci_p2pdma_page(const struct page *page)
967{
968 return is_zone_device_page(page) &&
969 page->pgmap->type == MEMORY_DEVICE_PCI_P2PDMA;
970}
971#else /* CONFIG_PCI_P2PDMA */
972static inline bool is_pci_p2pdma_page(const struct page *page)
973{
974 return false;
975}
976#endif /* CONFIG_PCI_P2PDMA */
977
978#else /* CONFIG_DEV_PAGEMAP_OPS */ 959#else /* CONFIG_DEV_PAGEMAP_OPS */
979static inline bool put_devmap_managed_page(struct page *page) 960static inline bool put_devmap_managed_page(struct page *page)
980{ 961{
981 return false; 962 return false;
982} 963}
964#endif /* CONFIG_DEV_PAGEMAP_OPS */
983 965
984static inline bool is_device_private_page(const struct page *page) 966static inline bool is_device_private_page(const struct page *page)
985{ 967{
986 return false; 968 return IS_ENABLED(CONFIG_DEV_PAGEMAP_OPS) &&
969 IS_ENABLED(CONFIG_DEVICE_PRIVATE) &&
970 is_zone_device_page(page) &&
971 page->pgmap->type == MEMORY_DEVICE_PRIVATE;
987} 972}
988 973
989static inline bool is_pci_p2pdma_page(const struct page *page) 974static inline bool is_pci_p2pdma_page(const struct page *page)
990{ 975{
991 return false; 976 return IS_ENABLED(CONFIG_DEV_PAGEMAP_OPS) &&
977 IS_ENABLED(CONFIG_PCI_P2PDMA) &&
978 is_zone_device_page(page) &&
979 page->pgmap->type == MEMORY_DEVICE_PCI_P2PDMA;
992} 980}
993#endif /* CONFIG_DEV_PAGEMAP_OPS */
994 981
995/* 127: arbitrary random number, small enough to assemble well */ 982/* 127: arbitrary random number, small enough to assemble well */
996#define page_ref_zero_or_close_to_overflow(page) \ 983#define page_ref_zero_or_close_to_overflow(page) \
@@ -1556,6 +1543,10 @@ long get_user_pages_unlocked(unsigned long start, unsigned long nr_pages,
1556int get_user_pages_fast(unsigned long start, int nr_pages, 1543int get_user_pages_fast(unsigned long start, int nr_pages,
1557 unsigned int gup_flags, struct page **pages); 1544 unsigned int gup_flags, struct page **pages);
1558 1545
1546int account_locked_vm(struct mm_struct *mm, unsigned long pages, bool inc);
1547int __account_locked_vm(struct mm_struct *mm, unsigned long pages, bool inc,
1548 struct task_struct *task, bool bypass_rlim);
1549
1559/* Container for pinned pfns / pages */ 1550/* Container for pinned pfns / pages */
1560struct frame_vector { 1551struct frame_vector {
1561 unsigned int nr_allocated; /* Number of frames we have space for */ 1552 unsigned int nr_allocated; /* Number of frames we have space for */
@@ -1763,7 +1754,7 @@ static inline void sync_mm_rss(struct mm_struct *mm)
1763} 1754}
1764#endif 1755#endif
1765 1756
1766#ifndef __HAVE_ARCH_PTE_DEVMAP 1757#ifndef CONFIG_ARCH_HAS_PTE_DEVMAP
1767static inline int pte_devmap(pte_t pte) 1758static inline int pte_devmap(pte_t pte)
1768{ 1759{
1769 return 0; 1760 return 0;
@@ -2767,7 +2758,13 @@ extern int randomize_va_space;
2767#endif 2758#endif
2768 2759
2769const char * arch_vma_name(struct vm_area_struct *vma); 2760const char * arch_vma_name(struct vm_area_struct *vma);
2761#ifdef CONFIG_MMU
2770void print_vma_addr(char *prefix, unsigned long rip); 2762void print_vma_addr(char *prefix, unsigned long rip);
2763#else
2764static inline void print_vma_addr(char *prefix, unsigned long rip)
2765{
2766}
2767#endif
2771 2768
2772void *sparse_buffer_alloc(unsigned long size); 2769void *sparse_buffer_alloc(unsigned long size);
2773struct page *sparse_mem_map_populate(unsigned long pnum, int nid, 2770struct page *sparse_mem_map_populate(unsigned long pnum, int nid,
diff --git a/include/linux/pfn_t.h b/include/linux/pfn_t.h
index 01e8037023f7..2d9148221e9a 100644
--- a/include/linux/pfn_t.h
+++ b/include/linux/pfn_t.h
@@ -97,7 +97,7 @@ static inline pud_t pfn_t_pud(pfn_t pfn, pgprot_t pgprot)
97#endif 97#endif
98#endif 98#endif
99 99
100#ifdef __HAVE_ARCH_PTE_DEVMAP 100#ifdef CONFIG_ARCH_HAS_PTE_DEVMAP
101static inline bool pfn_t_devmap(pfn_t pfn) 101static inline bool pfn_t_devmap(pfn_t pfn)
102{ 102{
103 const u64 flags = PFN_DEV|PFN_MAP; 103 const u64 flags = PFN_DEV|PFN_MAP;
@@ -115,7 +115,7 @@ pmd_t pmd_mkdevmap(pmd_t pmd);
115 defined(CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD) 115 defined(CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD)
116pud_t pud_mkdevmap(pud_t pud); 116pud_t pud_mkdevmap(pud_t pud);
117#endif 117#endif
118#endif /* __HAVE_ARCH_PTE_DEVMAP */ 118#endif /* CONFIG_ARCH_HAS_PTE_DEVMAP */
119 119
120#ifdef CONFIG_ARCH_HAS_PTE_SPECIAL 120#ifdef CONFIG_ARCH_HAS_PTE_SPECIAL
121static inline bool pfn_t_special(pfn_t pfn) 121static inline bool pfn_t_special(pfn_t pfn)
diff --git a/include/linux/pid.h b/include/linux/pid.h
index 1484db6ca8d1..2a83e434db9d 100644
--- a/include/linux/pid.h
+++ b/include/linux/pid.h
@@ -4,6 +4,7 @@
4 4
5#include <linux/rculist.h> 5#include <linux/rculist.h>
6#include <linux/wait.h> 6#include <linux/wait.h>
7#include <linux/refcount.h>
7 8
8enum pid_type 9enum pid_type
9{ 10{
@@ -57,7 +58,7 @@ struct upid {
57 58
58struct pid 59struct pid
59{ 60{
60 atomic_t count; 61 refcount_t count;
61 unsigned int level; 62 unsigned int level;
62 /* lists of tasks that use this pid */ 63 /* lists of tasks that use this pid */
63 struct hlist_head tasks[PIDTYPE_MAX]; 64 struct hlist_head tasks[PIDTYPE_MAX];
@@ -74,7 +75,7 @@ extern const struct file_operations pidfd_fops;
74static inline struct pid *get_pid(struct pid *pid) 75static inline struct pid *get_pid(struct pid *pid)
75{ 76{
76 if (pid) 77 if (pid)
77 atomic_inc(&pid->count); 78 refcount_inc(&pid->count);
78 return pid; 79 return pid;
79} 80}
80 81
diff --git a/include/linux/poison.h b/include/linux/poison.h
index d6d980a681c7..df34330b4e34 100644
--- a/include/linux/poison.h
+++ b/include/linux/poison.h
@@ -21,7 +21,7 @@
21 * non-initialized list entries. 21 * non-initialized list entries.
22 */ 22 */
23#define LIST_POISON1 ((void *) 0x100 + POISON_POINTER_DELTA) 23#define LIST_POISON1 ((void *) 0x100 + POISON_POINTER_DELTA)
24#define LIST_POISON2 ((void *) 0x200 + POISON_POINTER_DELTA) 24#define LIST_POISON2 ((void *) 0x122 + POISON_POINTER_DELTA)
25 25
26/********** include/linux/timer.h **********/ 26/********** include/linux/timer.h **********/
27/* 27/*
diff --git a/include/linux/rbtree.h b/include/linux/rbtree.h
index e6337fce08f2..1fd61a9af45c 100644
--- a/include/linux/rbtree.h
+++ b/include/linux/rbtree.h
@@ -32,25 +32,9 @@ struct rb_root {
32 struct rb_node *rb_node; 32 struct rb_node *rb_node;
33}; 33};
34 34
35/*
36 * Leftmost-cached rbtrees.
37 *
38 * We do not cache the rightmost node based on footprint
39 * size vs number of potential users that could benefit
40 * from O(1) rb_last(). Just not worth it, users that want
41 * this feature can always implement the logic explicitly.
42 * Furthermore, users that want to cache both pointers may
43 * find it a bit asymmetric, but that's ok.
44 */
45struct rb_root_cached {
46 struct rb_root rb_root;
47 struct rb_node *rb_leftmost;
48};
49
50#define rb_parent(r) ((struct rb_node *)((r)->__rb_parent_color & ~3)) 35#define rb_parent(r) ((struct rb_node *)((r)->__rb_parent_color & ~3))
51 36
52#define RB_ROOT (struct rb_root) { NULL, } 37#define RB_ROOT (struct rb_root) { NULL, }
53#define RB_ROOT_CACHED (struct rb_root_cached) { {NULL, }, NULL }
54#define rb_entry(ptr, type, member) container_of(ptr, type, member) 38#define rb_entry(ptr, type, member) container_of(ptr, type, member)
55 39
56#define RB_EMPTY_ROOT(root) (READ_ONCE((root)->rb_node) == NULL) 40#define RB_EMPTY_ROOT(root) (READ_ONCE((root)->rb_node) == NULL)
@@ -72,12 +56,6 @@ extern struct rb_node *rb_prev(const struct rb_node *);
72extern struct rb_node *rb_first(const struct rb_root *); 56extern struct rb_node *rb_first(const struct rb_root *);
73extern struct rb_node *rb_last(const struct rb_root *); 57extern struct rb_node *rb_last(const struct rb_root *);
74 58
75extern void rb_insert_color_cached(struct rb_node *,
76 struct rb_root_cached *, bool);
77extern void rb_erase_cached(struct rb_node *node, struct rb_root_cached *);
78/* Same as rb_first(), but O(1) */
79#define rb_first_cached(root) (root)->rb_leftmost
80
81/* Postorder iteration - always visit the parent after its children */ 59/* Postorder iteration - always visit the parent after its children */
82extern struct rb_node *rb_first_postorder(const struct rb_root *); 60extern struct rb_node *rb_first_postorder(const struct rb_root *);
83extern struct rb_node *rb_next_postorder(const struct rb_node *); 61extern struct rb_node *rb_next_postorder(const struct rb_node *);
@@ -87,8 +65,6 @@ extern void rb_replace_node(struct rb_node *victim, struct rb_node *new,
87 struct rb_root *root); 65 struct rb_root *root);
88extern void rb_replace_node_rcu(struct rb_node *victim, struct rb_node *new, 66extern void rb_replace_node_rcu(struct rb_node *victim, struct rb_node *new,
89 struct rb_root *root); 67 struct rb_root *root);
90extern void rb_replace_node_cached(struct rb_node *victim, struct rb_node *new,
91 struct rb_root_cached *root);
92 68
93static inline void rb_link_node(struct rb_node *node, struct rb_node *parent, 69static inline void rb_link_node(struct rb_node *node, struct rb_node *parent,
94 struct rb_node **rb_link) 70 struct rb_node **rb_link)
@@ -136,4 +112,50 @@ static inline void rb_link_node_rcu(struct rb_node *node, struct rb_node *parent
136 typeof(*pos), field); 1; }); \ 112 typeof(*pos), field); 1; }); \
137 pos = n) 113 pos = n)
138 114
115/*
116 * Leftmost-cached rbtrees.
117 *
118 * We do not cache the rightmost node based on footprint
119 * size vs number of potential users that could benefit
120 * from O(1) rb_last(). Just not worth it, users that want
121 * this feature can always implement the logic explicitly.
122 * Furthermore, users that want to cache both pointers may
123 * find it a bit asymmetric, but that's ok.
124 */
125struct rb_root_cached {
126 struct rb_root rb_root;
127 struct rb_node *rb_leftmost;
128};
129
130#define RB_ROOT_CACHED (struct rb_root_cached) { {NULL, }, NULL }
131
132/* Same as rb_first(), but O(1) */
133#define rb_first_cached(root) (root)->rb_leftmost
134
135static inline void rb_insert_color_cached(struct rb_node *node,
136 struct rb_root_cached *root,
137 bool leftmost)
138{
139 if (leftmost)
140 root->rb_leftmost = node;
141 rb_insert_color(node, &root->rb_root);
142}
143
144static inline void rb_erase_cached(struct rb_node *node,
145 struct rb_root_cached *root)
146{
147 if (root->rb_leftmost == node)
148 root->rb_leftmost = rb_next(node);
149 rb_erase(node, &root->rb_root);
150}
151
152static inline void rb_replace_node_cached(struct rb_node *victim,
153 struct rb_node *new,
154 struct rb_root_cached *root)
155{
156 if (root->rb_leftmost == victim)
157 root->rb_leftmost = new;
158 rb_replace_node(victim, new, &root->rb_root);
159}
160
139#endif /* _LINUX_RBTREE_H */ 161#endif /* _LINUX_RBTREE_H */
diff --git a/include/linux/rbtree_augmented.h b/include/linux/rbtree_augmented.h
index 0f902ccb48b0..179faab29f52 100644
--- a/include/linux/rbtree_augmented.h
+++ b/include/linux/rbtree_augmented.h
@@ -30,10 +30,9 @@ struct rb_augment_callbacks {
30 void (*rotate)(struct rb_node *old, struct rb_node *new); 30 void (*rotate)(struct rb_node *old, struct rb_node *new);
31}; 31};
32 32
33extern void __rb_insert_augmented(struct rb_node *node, 33extern void __rb_insert_augmented(struct rb_node *node, struct rb_root *root,
34 struct rb_root *root,
35 bool newleft, struct rb_node **leftmost,
36 void (*augment_rotate)(struct rb_node *old, struct rb_node *new)); 34 void (*augment_rotate)(struct rb_node *old, struct rb_node *new));
35
37/* 36/*
38 * Fixup the rbtree and update the augmented information when rebalancing. 37 * Fixup the rbtree and update the augmented information when rebalancing.
39 * 38 *
@@ -48,7 +47,7 @@ static inline void
48rb_insert_augmented(struct rb_node *node, struct rb_root *root, 47rb_insert_augmented(struct rb_node *node, struct rb_root *root,
49 const struct rb_augment_callbacks *augment) 48 const struct rb_augment_callbacks *augment)
50{ 49{
51 __rb_insert_augmented(node, root, false, NULL, augment->rotate); 50 __rb_insert_augmented(node, root, augment->rotate);
52} 51}
53 52
54static inline void 53static inline void
@@ -56,8 +55,9 @@ rb_insert_augmented_cached(struct rb_node *node,
56 struct rb_root_cached *root, bool newleft, 55 struct rb_root_cached *root, bool newleft,
57 const struct rb_augment_callbacks *augment) 56 const struct rb_augment_callbacks *augment)
58{ 57{
59 __rb_insert_augmented(node, &root->rb_root, 58 if (newleft)
60 newleft, &root->rb_leftmost, augment->rotate); 59 root->rb_leftmost = node;
60 rb_insert_augmented(node, &root->rb_root, augment);
61} 61}
62 62
63#define RB_DECLARE_CALLBACKS(rbstatic, rbname, rbstruct, rbfield, \ 63#define RB_DECLARE_CALLBACKS(rbstatic, rbname, rbstruct, rbfield, \
@@ -150,7 +150,6 @@ extern void __rb_erase_color(struct rb_node *parent, struct rb_root *root,
150 150
151static __always_inline struct rb_node * 151static __always_inline struct rb_node *
152__rb_erase_augmented(struct rb_node *node, struct rb_root *root, 152__rb_erase_augmented(struct rb_node *node, struct rb_root *root,
153 struct rb_node **leftmost,
154 const struct rb_augment_callbacks *augment) 153 const struct rb_augment_callbacks *augment)
155{ 154{
156 struct rb_node *child = node->rb_right; 155 struct rb_node *child = node->rb_right;
@@ -158,9 +157,6 @@ __rb_erase_augmented(struct rb_node *node, struct rb_root *root,
158 struct rb_node *parent, *rebalance; 157 struct rb_node *parent, *rebalance;
159 unsigned long pc; 158 unsigned long pc;
160 159
161 if (leftmost && node == *leftmost)
162 *leftmost = rb_next(node);
163
164 if (!tmp) { 160 if (!tmp) {
165 /* 161 /*
166 * Case 1: node to erase has no more than 1 child (easy!) 162 * Case 1: node to erase has no more than 1 child (easy!)
@@ -260,8 +256,7 @@ static __always_inline void
260rb_erase_augmented(struct rb_node *node, struct rb_root *root, 256rb_erase_augmented(struct rb_node *node, struct rb_root *root,
261 const struct rb_augment_callbacks *augment) 257 const struct rb_augment_callbacks *augment)
262{ 258{
263 struct rb_node *rebalance = __rb_erase_augmented(node, root, 259 struct rb_node *rebalance = __rb_erase_augmented(node, root, augment);
264 NULL, augment);
265 if (rebalance) 260 if (rebalance)
266 __rb_erase_color(rebalance, root, augment->rotate); 261 __rb_erase_color(rebalance, root, augment->rotate);
267} 262}
@@ -270,11 +265,9 @@ static __always_inline void
270rb_erase_augmented_cached(struct rb_node *node, struct rb_root_cached *root, 265rb_erase_augmented_cached(struct rb_node *node, struct rb_root_cached *root,
271 const struct rb_augment_callbacks *augment) 266 const struct rb_augment_callbacks *augment)
272{ 267{
273 struct rb_node *rebalance = __rb_erase_augmented(node, &root->rb_root, 268 if (root->rb_leftmost == node)
274 &root->rb_leftmost, 269 root->rb_leftmost = rb_next(node);
275 augment); 270 rb_erase_augmented(node, &root->rb_root, augment);
276 if (rebalance)
277 __rb_erase_color(rebalance, &root->rb_root, augment->rotate);
278} 271}
279 272
280#endif /* _LINUX_RBTREE_AUGMENTED_H */ 273#endif /* _LINUX_RBTREE_AUGMENTED_H */
diff --git a/include/linux/sched/signal.h b/include/linux/sched/signal.h
index 532458698bde..efd8ce7675ed 100644
--- a/include/linux/sched/signal.h
+++ b/include/linux/sched/signal.h
@@ -15,10 +15,10 @@
15 */ 15 */
16 16
17struct sighand_struct { 17struct sighand_struct {
18 refcount_t count;
19 struct k_sigaction action[_NSIG];
20 spinlock_t siglock; 18 spinlock_t siglock;
19 refcount_t count;
21 wait_queue_head_t signalfd_wqh; 20 wait_queue_head_t signalfd_wqh;
21 struct k_sigaction action[_NSIG];
22}; 22};
23 23
24/* 24/*
@@ -420,7 +420,6 @@ void task_join_group_stop(struct task_struct *task);
420static inline void set_restore_sigmask(void) 420static inline void set_restore_sigmask(void)
421{ 421{
422 set_thread_flag(TIF_RESTORE_SIGMASK); 422 set_thread_flag(TIF_RESTORE_SIGMASK);
423 WARN_ON(!test_thread_flag(TIF_SIGPENDING));
424} 423}
425 424
426static inline void clear_tsk_restore_sigmask(struct task_struct *task) 425static inline void clear_tsk_restore_sigmask(struct task_struct *task)
@@ -451,7 +450,6 @@ static inline bool test_and_clear_restore_sigmask(void)
451static inline void set_restore_sigmask(void) 450static inline void set_restore_sigmask(void)
452{ 451{
453 current->restore_sigmask = true; 452 current->restore_sigmask = true;
454 WARN_ON(!test_thread_flag(TIF_SIGPENDING));
455} 453}
456static inline void clear_tsk_restore_sigmask(struct task_struct *task) 454static inline void clear_tsk_restore_sigmask(struct task_struct *task)
457{ 455{
@@ -484,6 +482,16 @@ static inline void restore_saved_sigmask(void)
484 __set_current_blocked(&current->saved_sigmask); 482 __set_current_blocked(&current->saved_sigmask);
485} 483}
486 484
485extern int set_user_sigmask(const sigset_t __user *umask, size_t sigsetsize);
486
487static inline void restore_saved_sigmask_unless(bool interrupted)
488{
489 if (interrupted)
490 WARN_ON(!test_thread_flag(TIF_SIGPENDING));
491 else
492 restore_saved_sigmask();
493}
494
487static inline sigset_t *sigmask_to_save(void) 495static inline sigset_t *sigmask_to_save(void)
488{ 496{
489 sigset_t *res = &current->blocked; 497 sigset_t *res = &current->blocked;
diff --git a/include/linux/signal.h b/include/linux/signal.h
index 78c2bb376954..b5d99482d3fe 100644
--- a/include/linux/signal.h
+++ b/include/linux/signal.h
@@ -273,10 +273,6 @@ extern int group_send_sig_info(int sig, struct kernel_siginfo *info,
273 struct task_struct *p, enum pid_type type); 273 struct task_struct *p, enum pid_type type);
274extern int __group_send_sig_info(int, struct kernel_siginfo *, struct task_struct *); 274extern int __group_send_sig_info(int, struct kernel_siginfo *, struct task_struct *);
275extern int sigprocmask(int, sigset_t *, sigset_t *); 275extern int sigprocmask(int, sigset_t *, sigset_t *);
276extern int set_user_sigmask(const sigset_t __user *usigmask, sigset_t *set,
277 sigset_t *oldset, size_t sigsetsize);
278extern void restore_user_sigmask(const void __user *usigmask,
279 sigset_t *sigsaved, bool interrupted);
280extern void set_current_blocked(sigset_t *); 276extern void set_current_blocked(sigset_t *);
281extern void __set_current_blocked(const sigset_t *); 277extern void __set_current_blocked(const sigset_t *);
282extern int show_unhandled_signals; 278extern int show_unhandled_signals;
diff --git a/include/linux/swapops.h b/include/linux/swapops.h
index 15bdb6fe71e5..877fd239b6ff 100644
--- a/include/linux/swapops.h
+++ b/include/linux/swapops.h
@@ -6,6 +6,8 @@
6#include <linux/bug.h> 6#include <linux/bug.h>
7#include <linux/mm_types.h> 7#include <linux/mm_types.h>
8 8
9#ifdef CONFIG_MMU
10
9/* 11/*
10 * swapcache pages are stored in the swapper_space radix tree. We want to 12 * swapcache pages are stored in the swapper_space radix tree. We want to
11 * get good packing density in that tree, so the index should be dense in 13 * get good packing density in that tree, so the index should be dense in
@@ -50,13 +52,11 @@ static inline pgoff_t swp_offset(swp_entry_t entry)
50 return entry.val & SWP_OFFSET_MASK; 52 return entry.val & SWP_OFFSET_MASK;
51} 53}
52 54
53#ifdef CONFIG_MMU
54/* check whether a pte points to a swap entry */ 55/* check whether a pte points to a swap entry */
55static inline int is_swap_pte(pte_t pte) 56static inline int is_swap_pte(pte_t pte)
56{ 57{
57 return !pte_none(pte) && !pte_present(pte); 58 return !pte_none(pte) && !pte_present(pte);
58} 59}
59#endif
60 60
61/* 61/*
62 * Convert the arch-dependent pte representation of a swp_entry_t into an 62 * Convert the arch-dependent pte representation of a swp_entry_t into an
@@ -360,4 +360,5 @@ static inline int non_swap_entry(swp_entry_t entry)
360} 360}
361#endif 361#endif
362 362
363#endif /* CONFIG_MMU */
363#endif /* _LINUX_SWAPOPS_H */ 364#endif /* _LINUX_SWAPOPS_H */
diff --git a/include/linux/tracehook.h b/include/linux/tracehook.h
index 8446573cc682..36fb3bbed6b2 100644
--- a/include/linux/tracehook.h
+++ b/include/linux/tracehook.h
@@ -54,13 +54,15 @@ struct linux_binprm;
54/* 54/*
55 * ptrace report for syscall entry and exit looks identical. 55 * ptrace report for syscall entry and exit looks identical.
56 */ 56 */
57static inline int ptrace_report_syscall(struct pt_regs *regs) 57static inline int ptrace_report_syscall(struct pt_regs *regs,
58 unsigned long message)
58{ 59{
59 int ptrace = current->ptrace; 60 int ptrace = current->ptrace;
60 61
61 if (!(ptrace & PT_PTRACED)) 62 if (!(ptrace & PT_PTRACED))
62 return 0; 63 return 0;
63 64
65 current->ptrace_message = message;
64 ptrace_notify(SIGTRAP | ((ptrace & PT_TRACESYSGOOD) ? 0x80 : 0)); 66 ptrace_notify(SIGTRAP | ((ptrace & PT_TRACESYSGOOD) ? 0x80 : 0));
65 67
66 /* 68 /*
@@ -73,6 +75,7 @@ static inline int ptrace_report_syscall(struct pt_regs *regs)
73 current->exit_code = 0; 75 current->exit_code = 0;
74 } 76 }
75 77
78 current->ptrace_message = 0;
76 return fatal_signal_pending(current); 79 return fatal_signal_pending(current);
77} 80}
78 81
@@ -98,7 +101,7 @@ static inline int ptrace_report_syscall(struct pt_regs *regs)
98static inline __must_check int tracehook_report_syscall_entry( 101static inline __must_check int tracehook_report_syscall_entry(
99 struct pt_regs *regs) 102 struct pt_regs *regs)
100{ 103{
101 return ptrace_report_syscall(regs); 104 return ptrace_report_syscall(regs, PTRACE_EVENTMSG_SYSCALL_ENTRY);
102} 105}
103 106
104/** 107/**
@@ -123,7 +126,7 @@ static inline void tracehook_report_syscall_exit(struct pt_regs *regs, int step)
123 if (step) 126 if (step)
124 user_single_step_report(regs); 127 user_single_step_report(regs);
125 else 128 else
126 ptrace_report_syscall(regs); 129 ptrace_report_syscall(regs, PTRACE_EVENTMSG_SYSCALL_EXIT);
127} 130}
128 131
129/** 132/**