Skip to content

Commit cbafe18

Browse files
committed
Merge branch 'akpm' (patches from Andrew)
Merge more updates from Andrew Morton: - almost all of the rest of -mm - various other subsystems Subsystems affected by this patch series: memcg, misc, core-kernel, lib, checkpatch, reiserfs, fat, fork, cpumask, kexec, uaccess, kconfig, kgdb, bug, ipc, lzo, kasan, madvise, cleanups, pagemap * emailed patches from Andrew Morton <[email protected]>: (77 commits) arch/sparc/include/asm/pgtable_64.h: fix build mm: treewide: clarify pgtable_page_{ctor,dtor}() naming ntfs: remove (un)?likely() from IS_ERR() conditions IB/hfi1: remove unlikely() from IS_ERR*() condition xfs: remove unlikely() from WARN_ON() condition wimax/i2400m: remove unlikely() from WARN*() condition fs: remove unlikely() from WARN_ON() condition xen/events: remove unlikely() from WARN() condition checkpatch: check for nested (un)?likely() calls hexagon: drop empty and unused free_initrd_mem mm: factor out common parts between MADV_COLD and MADV_PAGEOUT mm: introduce MADV_PAGEOUT mm: change PAGEREF_RECLAIM_CLEAN with PAGE_REFRECLAIM mm: introduce MADV_COLD mm: untag user pointers in mmap/munmap/mremap/brk vfio/type1: untag user pointers in vaddr_get_pfn tee/shm: untag user pointers in tee_shm_register media/v4l2-core: untag user pointers in videobuf_dma_contig_user_get drm/radeon: untag user pointers in radeon_gem_userptr_ioctl drm/amdgpu: untag user pointers ...
2 parents f41def3 + a22fea9 commit cbafe18

File tree

114 files changed

+1005
-564
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+1005
-564
lines changed

Documentation/core-api/kernel-api.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ String Manipulation
4242
.. kernel-doc:: lib/string.c
4343
:export:
4444

45+
.. kernel-doc:: include/linux/string.h
46+
:internal:
47+
4548
.. kernel-doc:: mm/util.c
4649
:functions: kstrdup kstrdup_const kstrndup kmemdup kmemdup_nul memdup_user
4750
vmemdup_user strndup_user memdup_user_nul

Documentation/vm/split_page_table_lock.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ Hugetlb-specific helpers:
5454
Support of split page table lock by an architecture
5555
===================================================
5656

57-
There's no need in special enabling of PTE split page table lock:
58-
everything required is done by pgtable_page_ctor() and pgtable_page_dtor(),
59-
which must be called on PTE table allocation / freeing.
57+
There's no need in special enabling of PTE split page table lock: everything
58+
required is done by pgtable_pte_page_ctor() and pgtable_pte_page_dtor(), which
59+
must be called on PTE table allocation / freeing.
6060

6161
Make sure the architecture doesn't use slab allocator for page table
6262
allocation: slab uses page->slab_cache for its pages.
@@ -74,7 +74,7 @@ paths: i.e X86_PAE preallocate few PMDs on pgd_alloc().
7474

7575
With everything in place you can set CONFIG_ARCH_ENABLE_SPLIT_PMD_PTLOCK.
7676

77-
NOTE: pgtable_page_ctor() and pgtable_pmd_page_ctor() can fail -- it must
77+
NOTE: pgtable_pte_page_ctor() and pgtable_pmd_page_ctor() can fail -- it must
7878
be handled properly.
7979

8080
page->ptl
@@ -94,7 +94,7 @@ trick:
9494
split lock with enabled DEBUG_SPINLOCK or DEBUG_LOCK_ALLOC, but costs
9595
one more cache line for indirect access;
9696

97-
The spinlock_t allocated in pgtable_page_ctor() for PTE table and in
97+
The spinlock_t allocated in pgtable_pte_page_ctor() for PTE table and in
9898
pgtable_pmd_page_ctor() for PMD table.
9999

100100
Please, never access page->ptl directly -- use appropriate helper.

arch/alpha/include/uapi/asm/mman.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@
6868
#define MADV_WIPEONFORK 18 /* Zero memory on fork, child only */
6969
#define MADV_KEEPONFORK 19 /* Undo MADV_WIPEONFORK */
7070

71+
#define MADV_COLD 20 /* deactivate these pages */
72+
#define MADV_PAGEOUT 21 /* reclaim these pages */
73+
7174
/* compatibility flags */
7275
#define MAP_FILE 0
7376

arch/arc/include/asm/pgalloc.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ pte_alloc_one(struct mm_struct *mm)
108108
return 0;
109109
memzero((void *)pte_pg, PTRS_PER_PTE * sizeof(pte_t));
110110
page = virt_to_page(pte_pg);
111-
if (!pgtable_page_ctor(page)) {
111+
if (!pgtable_pte_page_ctor(page)) {
112112
__free_page(page);
113113
return 0;
114114
}
@@ -123,7 +123,7 @@ static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
123123

124124
static inline void pte_free(struct mm_struct *mm, pgtable_t ptep)
125125
{
126-
pgtable_page_dtor(virt_to_page(ptep));
126+
pgtable_pte_page_dtor(virt_to_page(ptep));
127127
free_pages((unsigned long)ptep, __get_order_pte());
128128
}
129129

arch/arm/include/asm/tlb.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ static inline void __tlb_remove_table(void *_table)
4444
static inline void
4545
__pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte, unsigned long addr)
4646
{
47-
pgtable_page_dtor(pte);
47+
pgtable_pte_page_dtor(pte);
4848

4949
#ifndef CONFIG_ARM_LPAE
5050
/*

arch/arm/mm/mmu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -731,7 +731,7 @@ static void *__init late_alloc(unsigned long sz)
731731
{
732732
void *ptr = (void *)__get_free_pages(GFP_PGTABLE_KERNEL, get_order(sz));
733733

734-
if (!ptr || !pgtable_page_ctor(virt_to_page(ptr)))
734+
if (!ptr || !pgtable_pte_page_ctor(virt_to_page(ptr)))
735735
BUG();
736736
return ptr;
737737
}

arch/arm64/include/asm/tlb.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ static inline void tlb_flush(struct mmu_gather *tlb)
4444
static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte,
4545
unsigned long addr)
4646
{
47-
pgtable_page_dtor(pte);
47+
pgtable_pte_page_dtor(pte);
4848
tlb_remove_table(tlb, pte);
4949
}
5050

arch/arm64/mm/mmu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ static phys_addr_t pgd_pgtable_alloc(int shift)
384384
* folded, and if so pgtable_pmd_page_ctor() becomes nop.
385385
*/
386386
if (shift == PAGE_SHIFT)
387-
BUG_ON(!pgtable_page_ctor(phys_to_page(pa)));
387+
BUG_ON(!pgtable_pte_page_ctor(phys_to_page(pa)));
388388
else if (shift == PMD_SHIFT)
389389
BUG_ON(!pgtable_pmd_page_ctor(phys_to_page(pa)));
390390

arch/csky/include/asm/pgalloc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ static inline pgd_t *pgd_alloc(struct mm_struct *mm)
7171

7272
#define __pte_free_tlb(tlb, pte, address) \
7373
do { \
74-
pgtable_page_dtor(pte); \
74+
pgtable_pte_page_dtor(pte); \
7575
tlb_remove_page(tlb, pte); \
7676
} while (0)
7777

arch/hexagon/include/asm/pgalloc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd,
9494

9595
#define __pte_free_tlb(tlb, pte, addr) \
9696
do { \
97-
pgtable_page_dtor((pte)); \
97+
pgtable_pte_page_dtor((pte)); \
9898
tlb_remove_page((tlb), (pte)); \
9999
} while (0)
100100

arch/hexagon/mm/init.c

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -71,19 +71,6 @@ void __init mem_init(void)
7171
init_mm.context.ptbase = __pa(init_mm.pgd);
7272
}
7373

74-
/*
75-
* free_initrd_mem - frees... initrd memory.
76-
* @start - start of init memory
77-
* @end - end of init memory
78-
*
79-
* Apparently has to be passed the address of the initrd memory.
80-
*
81-
* Wrapped by #ifdef CONFIG_BLKDEV_INITRD
82-
*/
83-
void free_initrd_mem(unsigned long start, unsigned long end)
84-
{
85-
}
86-
8774
void sync_icache_dcache(pte_t pte)
8875
{
8976
unsigned long addr;

arch/m68k/include/asm/mcf_pgalloc.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ extern inline pmd_t *pmd_alloc_kernel(pgd_t *pgd, unsigned long address)
4141
static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t page,
4242
unsigned long address)
4343
{
44-
pgtable_page_dtor(page);
44+
pgtable_pte_page_dtor(page);
4545
__free_page(page);
4646
}
4747

@@ -54,7 +54,7 @@ static inline struct page *pte_alloc_one(struct mm_struct *mm)
5454

5555
if (!page)
5656
return NULL;
57-
if (!pgtable_page_ctor(page)) {
57+
if (!pgtable_pte_page_ctor(page)) {
5858
__free_page(page);
5959
return NULL;
6060
}
@@ -73,7 +73,7 @@ static inline struct page *pte_alloc_one(struct mm_struct *mm)
7373

7474
static inline void pte_free(struct mm_struct *mm, struct page *page)
7575
{
76-
pgtable_page_dtor(page);
76+
pgtable_pte_page_dtor(page);
7777
__free_page(page);
7878
}
7979

arch/m68k/include/asm/motorola_pgalloc.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ static inline pgtable_t pte_alloc_one(struct mm_struct *mm)
3636
page = alloc_pages(GFP_KERNEL|__GFP_ZERO, 0);
3737
if(!page)
3838
return NULL;
39-
if (!pgtable_page_ctor(page)) {
39+
if (!pgtable_pte_page_ctor(page)) {
4040
__free_page(page);
4141
return NULL;
4242
}
@@ -51,7 +51,7 @@ static inline pgtable_t pte_alloc_one(struct mm_struct *mm)
5151

5252
static inline void pte_free(struct mm_struct *mm, pgtable_t page)
5353
{
54-
pgtable_page_dtor(page);
54+
pgtable_pte_page_dtor(page);
5555
cache_page(kmap(page));
5656
kunmap(page);
5757
__free_page(page);
@@ -60,7 +60,7 @@ static inline void pte_free(struct mm_struct *mm, pgtable_t page)
6060
static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t page,
6161
unsigned long address)
6262
{
63-
pgtable_page_dtor(page);
63+
pgtable_pte_page_dtor(page);
6464
cache_page(kmap(page));
6565
kunmap(page);
6666
__free_page(page);

arch/m68k/include/asm/sun3_pgalloc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ extern const char bad_pmd_string[];
2121

2222
#define __pte_free_tlb(tlb,pte,addr) \
2323
do { \
24-
pgtable_page_dtor(pte); \
24+
pgtable_pte_page_dtor(pte); \
2525
tlb_remove_page((tlb), pte); \
2626
} while (0)
2727

arch/mips/include/asm/pgalloc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
5454

5555
#define __pte_free_tlb(tlb,pte,address) \
5656
do { \
57-
pgtable_page_dtor(pte); \
57+
pgtable_pte_page_dtor(pte); \
5858
tlb_remove_page((tlb), pte); \
5959
} while (0)
6060

arch/mips/include/uapi/asm/mman.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@
9595
#define MADV_WIPEONFORK 18 /* Zero memory on fork, child only */
9696
#define MADV_KEEPONFORK 19 /* Undo MADV_WIPEONFORK */
9797

98+
#define MADV_COLD 20 /* deactivate these pages */
99+
#define MADV_PAGEOUT 21 /* reclaim these pages */
100+
98101
/* compatibility flags */
99102
#define MAP_FILE 0
100103

arch/nios2/include/asm/pgalloc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
4141

4242
#define __pte_free_tlb(tlb, pte, addr) \
4343
do { \
44-
pgtable_page_dtor(pte); \
44+
pgtable_pte_page_dtor(pte); \
4545
tlb_remove_page((tlb), (pte)); \
4646
} while (0)
4747

arch/openrisc/include/asm/pgalloc.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ static inline struct page *pte_alloc_one(struct mm_struct *mm)
7575
if (!pte)
7676
return NULL;
7777
clear_page(page_address(pte));
78-
if (!pgtable_page_ctor(pte)) {
78+
if (!pgtable_pte_page_ctor(pte)) {
7979
__free_page(pte);
8080
return NULL;
8181
}
@@ -89,13 +89,13 @@ static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
8989

9090
static inline void pte_free(struct mm_struct *mm, struct page *pte)
9191
{
92-
pgtable_page_dtor(pte);
92+
pgtable_pte_page_dtor(pte);
9393
__free_page(pte);
9494
}
9595

9696
#define __pte_free_tlb(tlb, pte, addr) \
9797
do { \
98-
pgtable_page_dtor(pte); \
98+
pgtable_pte_page_dtor(pte); \
9999
tlb_remove_page((tlb), (pte)); \
100100
} while (0)
101101

arch/parisc/include/uapi/asm/mman.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@
4848
#define MADV_DONTFORK 10 /* don't inherit across fork */
4949
#define MADV_DOFORK 11 /* do inherit across fork */
5050

51+
#define MADV_COLD 20 /* deactivate these pages */
52+
#define MADV_PAGEOUT 21 /* reclaim these pages */
53+
5154
#define MADV_MERGEABLE 65 /* KSM may merge identical pages */
5255
#define MADV_UNMERGEABLE 66 /* KSM may not merge identical pages */
5356

arch/powerpc/mm/pgtable-frag.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ void pte_frag_destroy(void *pte_frag)
2525
count = ((unsigned long)pte_frag & ~PAGE_MASK) >> PTE_FRAG_SIZE_SHIFT;
2626
/* We allow PTE_FRAG_NR fragments from a PTE page */
2727
if (atomic_sub_and_test(PTE_FRAG_NR - count, &page->pt_frag_refcount)) {
28-
pgtable_page_dtor(page);
28+
pgtable_pte_page_dtor(page);
2929
__free_page(page);
3030
}
3131
}
@@ -61,7 +61,7 @@ static pte_t *__alloc_for_ptecache(struct mm_struct *mm, int kernel)
6161
page = alloc_page(PGALLOC_GFP | __GFP_ACCOUNT);
6262
if (!page)
6363
return NULL;
64-
if (!pgtable_page_ctor(page)) {
64+
if (!pgtable_pte_page_ctor(page)) {
6565
__free_page(page);
6666
return NULL;
6767
}
@@ -113,7 +113,7 @@ void pte_fragment_free(unsigned long *table, int kernel)
113113
BUG_ON(atomic_read(&page->pt_frag_refcount) <= 0);
114114
if (atomic_dec_and_test(&page->pt_frag_refcount)) {
115115
if (!kernel)
116-
pgtable_page_dtor(page);
116+
pgtable_pte_page_dtor(page);
117117
__free_page(page);
118118
}
119119
}

arch/riscv/include/asm/pgalloc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
7878

7979
#define __pte_free_tlb(tlb, pte, buf) \
8080
do { \
81-
pgtable_page_dtor(pte); \
81+
pgtable_pte_page_dtor(pte); \
8282
tlb_remove_page((tlb), pte); \
8383
} while (0)
8484

arch/s390/mm/pgalloc.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ unsigned long *page_table_alloc(struct mm_struct *mm)
210210
page = alloc_page(GFP_KERNEL);
211211
if (!page)
212212
return NULL;
213-
if (!pgtable_page_ctor(page)) {
213+
if (!pgtable_pte_page_ctor(page)) {
214214
__free_page(page);
215215
return NULL;
216216
}
@@ -256,7 +256,7 @@ void page_table_free(struct mm_struct *mm, unsigned long *table)
256256
atomic_xor_bits(&page->_refcount, 3U << 24);
257257
}
258258

259-
pgtable_page_dtor(page);
259+
pgtable_pte_page_dtor(page);
260260
__free_page(page);
261261
}
262262

@@ -308,7 +308,7 @@ void __tlb_remove_table(void *_table)
308308
case 3: /* 4K page table with pgstes */
309309
if (mask & 3)
310310
atomic_xor_bits(&page->_refcount, 3 << 24);
311-
pgtable_page_dtor(page);
311+
pgtable_pte_page_dtor(page);
312312
__free_page(page);
313313
break;
314314
}

arch/sh/include/asm/pgalloc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd,
2929

3030
#define __pte_free_tlb(tlb,pte,addr) \
3131
do { \
32-
pgtable_page_dtor(pte); \
32+
pgtable_pte_page_dtor(pte); \
3333
tlb_remove_page((tlb), (pte)); \
3434
} while (0)
3535

arch/sparc/include/asm/pgtable_64.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1078,7 +1078,7 @@ static inline int io_remap_pfn_range(struct vm_area_struct *vma,
10781078
}
10791079
#define io_remap_pfn_range io_remap_pfn_range
10801080

1081-
static inline unsigned long untagged_addr(unsigned long start)
1081+
static inline unsigned long __untagged_addr(unsigned long start)
10821082
{
10831083
if (adi_capable()) {
10841084
long addr = start;
@@ -1098,7 +1098,8 @@ static inline unsigned long untagged_addr(unsigned long start)
10981098

10991099
return start;
11001100
}
1101-
#define untagged_addr untagged_addr
1101+
#define untagged_addr(addr) \
1102+
((__typeof__(addr))(__untagged_addr((unsigned long)(addr))))
11021103

11031104
static inline bool pte_access_permitted(pte_t pte, bool write)
11041105
{

arch/sparc/mm/init_64.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2903,7 +2903,7 @@ pgtable_t pte_alloc_one(struct mm_struct *mm)
29032903
struct page *page = alloc_page(GFP_KERNEL | __GFP_ZERO);
29042904
if (!page)
29052905
return NULL;
2906-
if (!pgtable_page_ctor(page)) {
2906+
if (!pgtable_pte_page_ctor(page)) {
29072907
free_unref_page(page);
29082908
return NULL;
29092909
}
@@ -2919,7 +2919,7 @@ static void __pte_free(pgtable_t pte)
29192919
{
29202920
struct page *page = virt_to_page(pte);
29212921

2922-
pgtable_page_dtor(page);
2922+
pgtable_pte_page_dtor(page);
29232923
__free_page(page);
29242924
}
29252925

arch/sparc/mm/srmmu.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ pgtable_t pte_alloc_one(struct mm_struct *mm)
378378
if ((pte = (unsigned long)pte_alloc_one_kernel(mm)) == 0)
379379
return NULL;
380380
page = pfn_to_page(__nocache_pa(pte) >> PAGE_SHIFT);
381-
if (!pgtable_page_ctor(page)) {
381+
if (!pgtable_pte_page_ctor(page)) {
382382
__free_page(page);
383383
return NULL;
384384
}
@@ -389,7 +389,7 @@ void pte_free(struct mm_struct *mm, pgtable_t pte)
389389
{
390390
unsigned long p;
391391

392-
pgtable_page_dtor(pte);
392+
pgtable_pte_page_dtor(pte);
393393
p = (unsigned long)page_address(pte); /* Cached address (for test) */
394394
if (p == 0)
395395
BUG();

0 commit comments

Comments
 (0)