Skip to content

Commit 5af9c2e

Browse files
committed
Merge branch 'akpm' (patches from Andrew)
Merge fixes from Andrew Morton: "22 fixes" * emailed patches from Andrew Morton <[email protected]>: (22 commits) epoll: restrict EPOLLEXCLUSIVE to POLLIN and POLLOUT radix-tree: fix oops after radix_tree_iter_retry MAINTAINERS: trim the file triggers for ABI/API dax: dirty inode only if required thp: make deferred_split_scan() work again mm: replace vma_lock_anon_vma with anon_vma_lock_read/write ocfs2/dlm: clear refmap bit of recovery lock while doing local recovery cleanup um: asm/page.h: remove the pte_high member from struct pte_t mm, hugetlb: don't require CMA for runtime gigantic pages mm/hugetlb: fix gigantic page initialization/allocation mm: downgrade VM_BUG in isolate_lru_page() to warning mempolicy: do not try to queue pages from !vma_migratable() mm, vmstat: fix wrong WQ sleep when memory reclaim doesn't make any progress vmstat: make vmstat_update deferrable mm, vmstat: make quiet_vmstat lighter mm/Kconfig: correct description of DEFERRED_STRUCT_PAGE_INIT memblock: don't mark memblock_phys_mem_size() as __init dump_stack: avoid potential deadlocks mm: validate_mm browse_rb SMP race condition m32r: fix build failure due to SMP and MMU ...
2 parents 5d6a6a7 + b6a515c commit 5af9c2e

File tree

23 files changed

+166
-126
lines changed

23 files changed

+166
-126
lines changed

MAINTAINERS

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,7 @@ F: drivers/scsi/aacraid/
223223

224224
ABI/API
225225
226-
F: Documentation/ABI/
227226
F: include/linux/syscalls.h
228-
F: include/uapi/
229227
F: kernel/sys_ni.c
230228

231229
ABIT UGURU 1,2 HARDWARE MONITOR DRIVER

arch/m32r/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,7 @@ source "kernel/Kconfig.preempt"
276276

277277
config SMP
278278
bool "Symmetric multi-processing support"
279+
depends on MMU
279280
---help---
280281
This enables support for systems with more than one CPU. If you have
281282
a system with only one CPU, say N. If you have a system with more

arch/um/include/asm/page.h

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,21 +34,18 @@ struct page;
3434

3535
#if defined(CONFIG_3_LEVEL_PGTABLES) && !defined(CONFIG_64BIT)
3636

37-
typedef struct { unsigned long pte_low, pte_high; } pte_t;
37+
typedef struct { unsigned long pte; } pte_t;
3838
typedef struct { unsigned long pmd; } pmd_t;
3939
typedef struct { unsigned long pgd; } pgd_t;
40-
#define pte_val(x) ((x).pte_low | ((unsigned long long) (x).pte_high << 32))
41-
42-
#define pte_get_bits(pte, bits) ((pte).pte_low & (bits))
43-
#define pte_set_bits(pte, bits) ((pte).pte_low |= (bits))
44-
#define pte_clear_bits(pte, bits) ((pte).pte_low &= ~(bits))
45-
#define pte_copy(to, from) ({ (to).pte_high = (from).pte_high; \
46-
smp_wmb(); \
47-
(to).pte_low = (from).pte_low; })
48-
#define pte_is_zero(pte) (!((pte).pte_low & ~_PAGE_NEWPAGE) && !(pte).pte_high)
49-
#define pte_set_val(pte, phys, prot) \
50-
({ (pte).pte_high = (phys) >> 32; \
51-
(pte).pte_low = (phys) | pgprot_val(prot); })
40+
#define pte_val(p) ((p).pte)
41+
42+
#define pte_get_bits(p, bits) ((p).pte & (bits))
43+
#define pte_set_bits(p, bits) ((p).pte |= (bits))
44+
#define pte_clear_bits(p, bits) ((p).pte &= ~(bits))
45+
#define pte_copy(to, from) ({ (to).pte = (from).pte; })
46+
#define pte_is_zero(p) (!((p).pte & ~_PAGE_NEWPAGE))
47+
#define pte_set_val(p, phys, prot) \
48+
({ (p).pte = (phys) | pgprot_val(prot); })
5249

5350
#define pmd_val(x) ((x).pmd)
5451
#define __pmd(x) ((pmd_t) { (x) } )

arch/x86/mm/hugetlbpage.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,10 @@ static __init int setup_hugepagesz(char *opt)
173173
}
174174
__setup("hugepagesz=", setup_hugepagesz);
175175

176-
#ifdef CONFIG_CMA
176+
#if (defined(CONFIG_MEMORY_ISOLATION) && defined(CONFIG_COMPACTION)) || defined(CONFIG_CMA)
177177
static __init int gigantic_pages_init(void)
178178
{
179-
/* With CMA we can allocate gigantic pages at runtime */
179+
/* With compaction or CMA we can allocate gigantic pages at runtime */
180180
if (cpu_has_gbpages && !size_to_hstate(1UL << PUD_SHIFT))
181181
hugetlb_add_hstate(PUD_SHIFT - PAGE_SHIFT);
182182
return 0;

fs/block_dev.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1730,6 +1730,12 @@ static int blkdev_dax_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
17301730
return __dax_fault(vma, vmf, blkdev_get_block, NULL);
17311731
}
17321732

1733+
static int blkdev_dax_pfn_mkwrite(struct vm_area_struct *vma,
1734+
struct vm_fault *vmf)
1735+
{
1736+
return dax_pfn_mkwrite(vma, vmf);
1737+
}
1738+
17331739
static int blkdev_dax_pmd_fault(struct vm_area_struct *vma, unsigned long addr,
17341740
pmd_t *pmd, unsigned int flags)
17351741
{
@@ -1739,7 +1745,7 @@ static int blkdev_dax_pmd_fault(struct vm_area_struct *vma, unsigned long addr,
17391745
static const struct vm_operations_struct blkdev_dax_vm_ops = {
17401746
.fault = blkdev_dax_fault,
17411747
.pmd_fault = blkdev_dax_pmd_fault,
1742-
.pfn_mkwrite = blkdev_dax_fault,
1748+
.pfn_mkwrite = blkdev_dax_pfn_mkwrite,
17431749
};
17441750

17451751
static const struct vm_operations_struct blkdev_default_vm_ops = {

fs/dax.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,8 @@ static int dax_radix_entry(struct address_space *mapping, pgoff_t index,
358358
void *entry;
359359

360360
WARN_ON_ONCE(pmd_entry && !dirty);
361-
__mark_inode_dirty(mapping->host, I_DIRTY_PAGES);
361+
if (dirty)
362+
__mark_inode_dirty(mapping->host, I_DIRTY_PAGES);
362363

363364
spin_lock_irq(&mapping->tree_lock);
364365

fs/eventpoll.c

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,11 @@
9494
/* Epoll private bits inside the event mask */
9595
#define EP_PRIVATE_BITS (EPOLLWAKEUP | EPOLLONESHOT | EPOLLET | EPOLLEXCLUSIVE)
9696

97+
#define EPOLLINOUT_BITS (POLLIN | POLLOUT)
98+
99+
#define EPOLLEXCLUSIVE_OK_BITS (EPOLLINOUT_BITS | POLLERR | POLLHUP | \
100+
EPOLLWAKEUP | EPOLLET | EPOLLEXCLUSIVE)
101+
97102
/* Maximum number of nesting allowed inside epoll sets */
98103
#define EP_MAX_NESTS 4
99104

@@ -1068,7 +1073,22 @@ static int ep_poll_callback(wait_queue_t *wait, unsigned mode, int sync, void *k
10681073
* wait list.
10691074
*/
10701075
if (waitqueue_active(&ep->wq)) {
1071-
ewake = 1;
1076+
if ((epi->event.events & EPOLLEXCLUSIVE) &&
1077+
!((unsigned long)key & POLLFREE)) {
1078+
switch ((unsigned long)key & EPOLLINOUT_BITS) {
1079+
case POLLIN:
1080+
if (epi->event.events & POLLIN)
1081+
ewake = 1;
1082+
break;
1083+
case POLLOUT:
1084+
if (epi->event.events & POLLOUT)
1085+
ewake = 1;
1086+
break;
1087+
case 0:
1088+
ewake = 1;
1089+
break;
1090+
}
1091+
}
10721092
wake_up_locked(&ep->wq);
10731093
}
10741094
if (waitqueue_active(&ep->poll_wait))
@@ -1875,9 +1895,13 @@ SYSCALL_DEFINE4(epoll_ctl, int, epfd, int, op, int, fd,
18751895
* so EPOLLEXCLUSIVE is not allowed for a EPOLL_CTL_MOD operation.
18761896
* Also, we do not currently supported nested exclusive wakeups.
18771897
*/
1878-
if ((epds.events & EPOLLEXCLUSIVE) && (op == EPOLL_CTL_MOD ||
1879-
(op == EPOLL_CTL_ADD && is_file_epoll(tf.file))))
1880-
goto error_tgt_fput;
1898+
if (epds.events & EPOLLEXCLUSIVE) {
1899+
if (op == EPOLL_CTL_MOD)
1900+
goto error_tgt_fput;
1901+
if (op == EPOLL_CTL_ADD && (is_file_epoll(tf.file) ||
1902+
(epds.events & ~EPOLLEXCLUSIVE_OK_BITS)))
1903+
goto error_tgt_fput;
1904+
}
18811905

18821906
/*
18831907
* At this point it is safe to assume that the "private_data" contains
@@ -1950,8 +1974,10 @@ SYSCALL_DEFINE4(epoll_ctl, int, epfd, int, op, int, fd,
19501974
break;
19511975
case EPOLL_CTL_MOD:
19521976
if (epi) {
1953-
epds.events |= POLLERR | POLLHUP;
1954-
error = ep_modify(ep, epi, &epds);
1977+
if (!(epi->event.events & EPOLLEXCLUSIVE)) {
1978+
epds.events |= POLLERR | POLLHUP;
1979+
error = ep_modify(ep, epi, &epds);
1980+
}
19551981
} else
19561982
error = -ENOENT;
19571983
break;

fs/ocfs2/dlm/dlmrecovery.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2367,6 +2367,8 @@ static void dlm_do_local_recovery_cleanup(struct dlm_ctxt *dlm, u8 dead_node)
23672367
break;
23682368
}
23692369
}
2370+
dlm_lockres_clear_refmap_bit(dlm, res,
2371+
dead_node);
23702372
spin_unlock(&res->spinlock);
23712373
continue;
23722374
}

include/linux/gfp.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -547,16 +547,16 @@ static inline bool pm_suspended_storage(void)
547547
}
548548
#endif /* CONFIG_PM_SLEEP */
549549

550-
#ifdef CONFIG_CMA
551-
550+
#if (defined(CONFIG_MEMORY_ISOLATION) && defined(CONFIG_COMPACTION)) || defined(CONFIG_CMA)
552551
/* The below functions must be run on a range from a single zone. */
553552
extern int alloc_contig_range(unsigned long start, unsigned long end,
554553
unsigned migratetype);
555554
extern void free_contig_range(unsigned long pfn, unsigned nr_pages);
555+
#endif
556556

557+
#ifdef CONFIG_CMA
557558
/* CMA stuff */
558559
extern void init_cma_reserved_pageblock(struct page *page);
559-
560560
#endif
561561

562562
#endif /* __LINUX_GFP_H */

include/linux/radix-tree.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ void **radix_tree_iter_retry(struct radix_tree_iter *iter)
400400
* @iter: pointer to radix tree iterator
401401
* Returns: current chunk size
402402
*/
403-
static __always_inline unsigned
403+
static __always_inline long
404404
radix_tree_chunk_size(struct radix_tree_iter *iter)
405405
{
406406
return iter->next_index - iter->index;
@@ -434,9 +434,9 @@ radix_tree_next_slot(void **slot, struct radix_tree_iter *iter, unsigned flags)
434434
return slot + offset + 1;
435435
}
436436
} else {
437-
unsigned size = radix_tree_chunk_size(iter) - 1;
437+
long size = radix_tree_chunk_size(iter);
438438

439-
while (size--) {
439+
while (--size > 0) {
440440
slot++;
441441
iter->index++;
442442
if (likely(*slot))

include/linux/rmap.h

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -109,20 +109,6 @@ static inline void put_anon_vma(struct anon_vma *anon_vma)
109109
__put_anon_vma(anon_vma);
110110
}
111111

112-
static inline void vma_lock_anon_vma(struct vm_area_struct *vma)
113-
{
114-
struct anon_vma *anon_vma = vma->anon_vma;
115-
if (anon_vma)
116-
down_write(&anon_vma->root->rwsem);
117-
}
118-
119-
static inline void vma_unlock_anon_vma(struct vm_area_struct *vma)
120-
{
121-
struct anon_vma *anon_vma = vma->anon_vma;
122-
if (anon_vma)
123-
up_write(&anon_vma->root->rwsem);
124-
}
125-
126112
static inline void anon_vma_lock_write(struct anon_vma *anon_vma)
127113
{
128114
down_write(&anon_vma->root->rwsem);

kernel/signal.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3508,8 +3508,10 @@ static int sigsuspend(sigset_t *set)
35083508
current->saved_sigmask = current->blocked;
35093509
set_current_blocked(set);
35103510

3511-
__set_current_state(TASK_INTERRUPTIBLE);
3512-
schedule();
3511+
while (!signal_pending(current)) {
3512+
__set_current_state(TASK_INTERRUPTIBLE);
3513+
schedule();
3514+
}
35133515
set_restore_sigmask();
35143516
return -ERESTARTNOHAND;
35153517
}

lib/dump_stack.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ static atomic_t dump_lock = ATOMIC_INIT(-1);
2525

2626
asmlinkage __visible void dump_stack(void)
2727
{
28+
unsigned long flags;
2829
int was_locked;
2930
int old;
3031
int cpu;
@@ -33,16 +34,16 @@ asmlinkage __visible void dump_stack(void)
3334
* Permit this cpu to perform nested stack dumps while serialising
3435
* against other CPUs
3536
*/
36-
preempt_disable();
37-
3837
retry:
38+
local_irq_save(flags);
3939
cpu = smp_processor_id();
4040
old = atomic_cmpxchg(&dump_lock, -1, cpu);
4141
if (old == -1) {
4242
was_locked = 0;
4343
} else if (old == cpu) {
4444
was_locked = 1;
4545
} else {
46+
local_irq_restore(flags);
4647
cpu_relax();
4748
goto retry;
4849
}
@@ -52,7 +53,7 @@ asmlinkage __visible void dump_stack(void)
5253
if (!was_locked)
5354
atomic_set(&dump_lock, -1);
5455

55-
preempt_enable();
56+
local_irq_restore(flags);
5657
}
5758
#else
5859
asmlinkage __visible void dump_stack(void)

mm/Kconfig

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,7 @@ config ARCH_SUPPORTS_DEFERRED_STRUCT_PAGE_INIT
624624
bool
625625

626626
config DEFERRED_STRUCT_PAGE_INIT
627-
bool "Defer initialisation of struct pages to kswapd"
627+
bool "Defer initialisation of struct pages to kthreads"
628628
default n
629629
depends on ARCH_SUPPORTS_DEFERRED_STRUCT_PAGE_INIT
630630
depends on MEMORY_HOTPLUG
@@ -633,9 +633,10 @@ config DEFERRED_STRUCT_PAGE_INIT
633633
single thread. On very large machines this can take a considerable
634634
amount of time. If this option is set, large machines will bring up
635635
a subset of memmap at boot and then initialise the rest in parallel
636-
when kswapd starts. This has a potential performance impact on
637-
processes running early in the lifetime of the systemm until kswapd
638-
finishes the initialisation.
636+
by starting one-off "pgdatinitX" kernel thread for each node X. This
637+
has a potential performance impact on processes running early in the
638+
lifetime of the system until these kthreads finish the
639+
initialisation.
639640

640641
config IDLE_PAGE_TRACKING
641642
bool "Enable idle page tracking"

mm/backing-dev.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -989,7 +989,7 @@ long wait_iff_congested(struct zone *zone, int sync, long timeout)
989989
* here rather than calling cond_resched().
990990
*/
991991
if (current->flags & PF_WQ_WORKER)
992-
schedule_timeout(1);
992+
schedule_timeout_uninterruptible(1);
993993
else
994994
cond_resched();
995995

mm/huge_memory.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3482,7 +3482,7 @@ static unsigned long deferred_split_scan(struct shrinker *shrink,
34823482

34833483
spin_lock_irqsave(&pgdata->split_queue_lock, flags);
34843484
/* Take pin on all head pages to avoid freeing them under us */
3485-
list_for_each_safe(pos, next, &list) {
3485+
list_for_each_safe(pos, next, &pgdata->split_queue) {
34863486
page = list_entry((void *)pos, struct page, mapping);
34873487
page = compound_head(page);
34883488
if (get_page_unless_zero(page)) {

mm/hugetlb.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1001,7 +1001,7 @@ static int hstate_next_node_to_free(struct hstate *h, nodemask_t *nodes_allowed)
10011001
((node = hstate_next_node_to_free(hs, mask)) || 1); \
10021002
nr_nodes--)
10031003

1004-
#if defined(CONFIG_CMA) && defined(CONFIG_X86_64)
1004+
#if defined(CONFIG_X86_64) && ((defined(CONFIG_MEMORY_ISOLATION) && defined(CONFIG_COMPACTION)) || defined(CONFIG_CMA))
10051005
static void destroy_compound_gigantic_page(struct page *page,
10061006
unsigned int order)
10071007
{
@@ -1214,8 +1214,8 @@ void free_huge_page(struct page *page)
12141214

12151215
set_page_private(page, 0);
12161216
page->mapping = NULL;
1217-
BUG_ON(page_count(page));
1218-
BUG_ON(page_mapcount(page));
1217+
VM_BUG_ON_PAGE(page_count(page), page);
1218+
VM_BUG_ON_PAGE(page_mapcount(page), page);
12191219
restore_reserve = PagePrivate(page);
12201220
ClearPagePrivate(page);
12211221

@@ -1286,6 +1286,7 @@ static void prep_compound_gigantic_page(struct page *page, unsigned int order)
12861286
set_page_count(p, 0);
12871287
set_compound_head(p, page);
12881288
}
1289+
atomic_set(compound_mapcount_ptr(page), -1);
12891290
}
12901291

12911292
/*

mm/memblock.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1448,7 +1448,7 @@ void __init __memblock_free_late(phys_addr_t base, phys_addr_t size)
14481448
* Remaining API functions
14491449
*/
14501450

1451-
phys_addr_t __init memblock_phys_mem_size(void)
1451+
phys_addr_t __init_memblock memblock_phys_mem_size(void)
14521452
{
14531453
return memblock.memory.total_size;
14541454
}

mm/mempolicy.c

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -548,8 +548,7 @@ static int queue_pages_pte_range(pmd_t *pmd, unsigned long addr,
548548
goto retry;
549549
}
550550

551-
if (flags & (MPOL_MF_MOVE | MPOL_MF_MOVE_ALL))
552-
migrate_page_add(page, qp->pagelist, flags);
551+
migrate_page_add(page, qp->pagelist, flags);
553552
}
554553
pte_unmap_unlock(pte - 1, ptl);
555554
cond_resched();
@@ -625,7 +624,7 @@ static int queue_pages_test_walk(unsigned long start, unsigned long end,
625624
unsigned long endvma = vma->vm_end;
626625
unsigned long flags = qp->flags;
627626

628-
if (vma->vm_flags & VM_PFNMAP)
627+
if (!vma_migratable(vma))
629628
return 1;
630629

631630
if (endvma > end)
@@ -644,16 +643,13 @@ static int queue_pages_test_walk(unsigned long start, unsigned long end,
644643

645644
if (flags & MPOL_MF_LAZY) {
646645
/* Similar to task_numa_work, skip inaccessible VMAs */
647-
if (vma_migratable(vma) &&
648-
vma->vm_flags & (VM_READ | VM_EXEC | VM_WRITE))
646+
if (vma->vm_flags & (VM_READ | VM_EXEC | VM_WRITE))
649647
change_prot_numa(vma, start, endvma);
650648
return 1;
651649
}
652650

653-
if ((flags & MPOL_MF_STRICT) ||
654-
((flags & (MPOL_MF_MOVE | MPOL_MF_MOVE_ALL)) &&
655-
vma_migratable(vma)))
656-
/* queue pages from current vma */
651+
/* queue pages from current vma */
652+
if (flags & (MPOL_MF_MOVE | MPOL_MF_MOVE_ALL))
657653
return 0;
658654
return 1;
659655
}

0 commit comments

Comments
 (0)