Skip to content

Commit

Permalink
Merge branch 'akpm' (patches from Andrew)
Browse files Browse the repository at this point in the history
Merge misc fixes from Andrew Morton:
 "24 fixes"

* emailed patches from Andrew Morton <[email protected]>: (24 commits)
  autofs: fix error return in autofs_fill_super()
  autofs: drop dentry reference only when it is never used
  fs/drop_caches.c: avoid softlockups in drop_pagecache_sb()
  mm: migrate: don't rely on __PageMovable() of newpage after unlocking it
  psi: clarify the Kconfig text for the default-disable option
  mm, memory_hotplug: __offline_pages fix wrong locking
  mm: hwpoison: use do_send_sig_info() instead of force_sig()
  kasan: mark file common so ftrace doesn't trace it
  init/Kconfig: fix grammar by moving a closing parenthesis
  lib/test_kmod.c: potential double free in error handling
  mm, oom: fix use-after-free in oom_kill_process
  mm/hotplug: invalid PFNs from pfn_to_online_page()
  mm,memory_hotplug: fix scan_movable_pages() for gigantic hugepages
  psi: fix aggregation idle shut-off
  mm, memory_hotplug: test_pages_in_a_zone do not pass the end of zone
  mm, memory_hotplug: is_mem_section_removable do not pass the end of a zone
  oom, oom_reaper: do not enqueue same task twice
  mm: migrate: make buffer_migrate_page_norefs() actually succeed
  kernel/exit.c: release ptraced tasks before zap_pid_ns_processes
  x86_64: increase stack size for KASAN_EXTRA
  ...
  • Loading branch information
torvalds committed Feb 2, 2019
2 parents cd984a5 + f585b28 commit b9de6ef
Show file tree
Hide file tree
Showing 38 changed files with 304 additions and 74 deletions.
1 change: 1 addition & 0 deletions arch/c6x/include/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ generic-y += pgalloc.h
generic-y += preempt.h
generic-y += segment.h
generic-y += serial.h
generic-y += shmparam.h
generic-y += tlbflush.h
generic-y += topology.h
generic-y += trace_clock.h
Expand Down
1 change: 0 additions & 1 deletion arch/c6x/include/uapi/asm/Kbuild
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
include include/uapi/asm-generic/Kbuild.asm

generic-y += kvm_para.h
generic-y += shmparam.h
generic-y += ucontext.h
1 change: 1 addition & 0 deletions arch/h8300/include/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ generic-y += preempt.h
generic-y += scatterlist.h
generic-y += sections.h
generic-y += serial.h
generic-y += shmparam.h
generic-y += sizes.h
generic-y += spinlock.h
generic-y += timex.h
Expand Down
1 change: 0 additions & 1 deletion arch/h8300/include/uapi/asm/Kbuild
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
include include/uapi/asm-generic/Kbuild.asm

generic-y += kvm_para.h
generic-y += shmparam.h
generic-y += ucontext.h
1 change: 1 addition & 0 deletions arch/hexagon/include/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ generic-y += rwsem.h
generic-y += sections.h
generic-y += segment.h
generic-y += serial.h
generic-y += shmparam.h
generic-y += sizes.h
generic-y += topology.h
generic-y += trace_clock.h
Expand Down
1 change: 0 additions & 1 deletion arch/hexagon/include/uapi/asm/Kbuild
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
include include/uapi/asm-generic/Kbuild.asm

generic-y += shmparam.h
generic-y += ucontext.h
1 change: 1 addition & 0 deletions arch/m68k/include/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ generic-y += mm-arch-hooks.h
generic-y += percpu.h
generic-y += preempt.h
generic-y += sections.h
generic-y += shmparam.h
generic-y += spinlock.h
generic-y += topology.h
generic-y += trace_clock.h
Expand Down
1 change: 0 additions & 1 deletion arch/m68k/include/uapi/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@ include include/uapi/asm-generic/Kbuild.asm

generated-y += unistd_32.h
generic-y += kvm_para.h
generic-y += shmparam.h
1 change: 1 addition & 0 deletions arch/microblaze/include/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ generic-y += parport.h
generic-y += percpu.h
generic-y += preempt.h
generic-y += serial.h
generic-y += shmparam.h
generic-y += syscalls.h
generic-y += topology.h
generic-y += trace_clock.h
Expand Down
1 change: 0 additions & 1 deletion arch/microblaze/include/uapi/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ include include/uapi/asm-generic/Kbuild.asm

generated-y += unistd_32.h
generic-y += kvm_para.h
generic-y += shmparam.h
generic-y += ucontext.h
1 change: 1 addition & 0 deletions arch/openrisc/include/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ generic-y += qrwlock_types.h
generic-y += qrwlock.h
generic-y += sections.h
generic-y += segment.h
generic-y += shmparam.h
generic-y += string.h
generic-y += switch_to.h
generic-y += topology.h
Expand Down
1 change: 0 additions & 1 deletion arch/openrisc/include/uapi/asm/Kbuild
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
include include/uapi/asm-generic/Kbuild.asm

generic-y += kvm_para.h
generic-y += shmparam.h
generic-y += ucontext.h
1 change: 1 addition & 0 deletions arch/unicore32/include/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ generic-y += preempt.h
generic-y += sections.h
generic-y += segment.h
generic-y += serial.h
generic-y += shmparam.h
generic-y += sizes.h
generic-y += syscalls.h
generic-y += topology.h
Expand Down
1 change: 0 additions & 1 deletion arch/unicore32/include/uapi/asm/Kbuild
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
include include/uapi/asm-generic/Kbuild.asm

generic-y += kvm_para.h
generic-y += shmparam.h
generic-y += ucontext.h
4 changes: 4 additions & 0 deletions arch/x86/include/asm/page_64_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
#endif

#ifdef CONFIG_KASAN
#ifdef CONFIG_KASAN_EXTRA
#define KASAN_STACK_ORDER 2
#else
#define KASAN_STACK_ORDER 1
#endif
#else
#define KASAN_STACK_ORDER 0
#endif
Expand Down
3 changes: 2 additions & 1 deletion fs/autofs/expire.c
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,6 @@ int autofs_expire_run(struct super_block *sb,
pkt.len = dentry->d_name.len;
memcpy(pkt.name, dentry->d_name.name, pkt.len);
pkt.name[pkt.len] = '\0';
dput(dentry);

if (copy_to_user(pkt_p, &pkt, sizeof(struct autofs_packet_expire)))
ret = -EFAULT;
Expand All @@ -609,6 +608,8 @@ int autofs_expire_run(struct super_block *sb,
complete_all(&ino->expire_complete);
spin_unlock(&sbi->fs_lock);

dput(dentry);

return ret;
}

Expand Down
4 changes: 3 additions & 1 deletion fs/autofs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,10 @@ int autofs_fill_super(struct super_block *s, void *data, int silent)
}
root_inode = autofs_get_inode(s, S_IFDIR | 0755);
root = d_make_root(root_inode);
if (!root)
if (!root) {
ret = -ENOMEM;
goto fail_ino;
}
pipe = NULL;

root->d_fsdata = ino;
Expand Down
8 changes: 7 additions & 1 deletion fs/drop_caches.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,21 @@ static void drop_pagecache_sb(struct super_block *sb, void *unused)
spin_lock(&sb->s_inode_list_lock);
list_for_each_entry(inode, &sb->s_inodes, i_sb_list) {
spin_lock(&inode->i_lock);
/*
* We must skip inodes in unusual state. We may also skip
* inodes without pages but we deliberately won't in case
* we need to reschedule to avoid softlockups.
*/
if ((inode->i_state & (I_FREEING|I_WILL_FREE|I_NEW)) ||
(inode->i_mapping->nrpages == 0)) {
(inode->i_mapping->nrpages == 0 && !need_resched())) {
spin_unlock(&inode->i_lock);
continue;
}
__iget(inode);
spin_unlock(&inode->i_lock);
spin_unlock(&sb->s_inode_list_lock);

cond_resched();
invalidate_mapping_pages(inode->i_mapping, 0, -1);
iput(toput_inode);
toput_inode = inode;
Expand Down
4 changes: 3 additions & 1 deletion fs/proc/generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ struct dentry *proc_lookup_de(struct inode *dir, struct dentry *dentry,
inode = proc_get_inode(dir->i_sb, de);
if (!inode)
return ERR_PTR(-ENOMEM);
d_set_d_op(dentry, &proc_misc_dentry_ops);
d_set_d_op(dentry, de->proc_dops);
return d_splice_alias(inode, dentry);
}
read_unlock(&proc_subdir_lock);
Expand Down Expand Up @@ -429,6 +429,8 @@ static struct proc_dir_entry *__proc_create(struct proc_dir_entry **parent,
INIT_LIST_HEAD(&ent->pde_openers);
proc_set_user(ent, (*parent)->uid, (*parent)->gid);

ent->proc_dops = &proc_misc_dentry_ops;

out:
return ent;
}
Expand Down
1 change: 1 addition & 0 deletions fs/proc/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ struct proc_dir_entry {
struct completion *pde_unload_completion;
const struct inode_operations *proc_iops;
const struct file_operations *proc_fops;
const struct dentry_operations *proc_dops;
union {
const struct seq_operations *seq_ops;
int (*single_show)(struct seq_file *, void *);
Expand Down
20 changes: 20 additions & 0 deletions fs/proc/proc_net.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,22 @@ static struct net *get_proc_net(const struct inode *inode)
return maybe_get_net(PDE_NET(PDE(inode)));
}

static int proc_net_d_revalidate(struct dentry *dentry, unsigned int flags)
{
return 0;
}

static const struct dentry_operations proc_net_dentry_ops = {
.d_revalidate = proc_net_d_revalidate,
.d_delete = always_delete_dentry,
};

static void pde_force_lookup(struct proc_dir_entry *pde)
{
/* /proc/net/ entries can be changed under us by setns(CLONE_NEWNET) */
pde->proc_dops = &proc_net_dentry_ops;
}

static int seq_open_net(struct inode *inode, struct file *file)
{
unsigned int state_size = PDE(inode)->state_size;
Expand Down Expand Up @@ -90,6 +106,7 @@ struct proc_dir_entry *proc_create_net_data(const char *name, umode_t mode,
p = proc_create_reg(name, mode, &parent, data);
if (!p)
return NULL;
pde_force_lookup(p);
p->proc_fops = &proc_net_seq_fops;
p->seq_ops = ops;
p->state_size = state_size;
Expand Down Expand Up @@ -133,6 +150,7 @@ struct proc_dir_entry *proc_create_net_data_write(const char *name, umode_t mode
p = proc_create_reg(name, mode, &parent, data);
if (!p)
return NULL;
pde_force_lookup(p);
p->proc_fops = &proc_net_seq_fops;
p->seq_ops = ops;
p->state_size = state_size;
Expand Down Expand Up @@ -181,6 +199,7 @@ struct proc_dir_entry *proc_create_net_single(const char *name, umode_t mode,
p = proc_create_reg(name, mode, &parent, data);
if (!p)
return NULL;
pde_force_lookup(p);
p->proc_fops = &proc_net_single_fops;
p->single_show = show;
return proc_register(parent, p);
Expand Down Expand Up @@ -223,6 +242,7 @@ struct proc_dir_entry *proc_create_net_single_write(const char *name, umode_t mo
p = proc_create_reg(name, mode, &parent, data);
if (!p)
return NULL;
pde_force_lookup(p);
p->proc_fops = &proc_net_single_fops;
p->single_show = show;
p->write = write;
Expand Down
18 changes: 10 additions & 8 deletions include/linux/memory_hotplug.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,16 @@ struct vmem_altmap;
* walkers which rely on the fully initialized page->flags and others
* should use this rather than pfn_valid && pfn_to_page
*/
#define pfn_to_online_page(pfn) \
({ \
struct page *___page = NULL; \
unsigned long ___nr = pfn_to_section_nr(pfn); \
\
if (___nr < NR_MEM_SECTIONS && online_section_nr(___nr))\
___page = pfn_to_page(pfn); \
___page; \
#define pfn_to_online_page(pfn) \
({ \
struct page *___page = NULL; \
unsigned long ___pfn = pfn; \
unsigned long ___nr = pfn_to_section_nr(___pfn); \
\
if (___nr < NR_MEM_SECTIONS && online_section_nr(___nr) && \
pfn_valid_within(___pfn)) \
___page = pfn_to_page(___pfn); \
___page; \
})

/*
Expand Down
1 change: 1 addition & 0 deletions include/linux/sched/coredump.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ static inline int get_dumpable(struct mm_struct *mm)
#define MMF_HUGE_ZERO_PAGE 23 /* mm has ever used the global huge zero page */
#define MMF_DISABLE_THP 24 /* disable THP for all VMAs */
#define MMF_OOM_VICTIM 25 /* mm is the oom victim */
#define MMF_OOM_REAP_QUEUED 26 /* mm was queued for oom_reaper */
#define MMF_DISABLE_THP_MASK (1 << MMF_DISABLE_THP)

#define MMF_INIT_MASK (MMF_DUMPABLE_MASK | MMF_DUMP_FILTER_MASK |\
Expand Down
13 changes: 12 additions & 1 deletion init/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,17 @@ config PSI_DEFAULT_DISABLED
per default but can be enabled through passing psi=1 on the
kernel commandline during boot.

This feature adds some code to the task wakeup and sleep
paths of the scheduler. The overhead is too low to affect
common scheduling-intense workloads in practice (such as
webservers, memcache), but it does show up in artificial
scheduler stress tests, such as hackbench.

If you are paranoid and not sure what the kernel will be
used for, say Y.

Say N if unsure.

endmenu # "CPU/Task time and stats accounting"

config CPU_ISOLATION
Expand Down Expand Up @@ -825,7 +836,7 @@ config CGROUP_PIDS
PIDs controller is designed to stop this from happening.

It should be noted that organisational operations (such as attaching
to a cgroup hierarchy will *not* be blocked by the PIDs controller),
to a cgroup hierarchy) will *not* be blocked by the PIDs controller,
since the PIDs limit only affects a process's ability to fork, not to
attach to a cgroup.

Expand Down
12 changes: 10 additions & 2 deletions kernel/exit.c
Original file line number Diff line number Diff line change
Expand Up @@ -558,12 +558,14 @@ static struct task_struct *find_alive_thread(struct task_struct *p)
return NULL;
}

static struct task_struct *find_child_reaper(struct task_struct *father)
static struct task_struct *find_child_reaper(struct task_struct *father,
struct list_head *dead)
__releases(&tasklist_lock)
__acquires(&tasklist_lock)
{
struct pid_namespace *pid_ns = task_active_pid_ns(father);
struct task_struct *reaper = pid_ns->child_reaper;
struct task_struct *p, *n;

if (likely(reaper != father))
return reaper;
Expand All @@ -579,6 +581,12 @@ static struct task_struct *find_child_reaper(struct task_struct *father)
panic("Attempted to kill init! exitcode=0x%08x\n",
father->signal->group_exit_code ?: father->exit_code);
}

list_for_each_entry_safe(p, n, dead, ptrace_entry) {
list_del_init(&p->ptrace_entry);
release_task(p);
}

zap_pid_ns_processes(pid_ns);
write_lock_irq(&tasklist_lock);

Expand Down Expand Up @@ -668,7 +676,7 @@ static void forget_original_parent(struct task_struct *father,
exit_ptrace(father, dead);

/* Can drop and reacquire tasklist_lock */
reaper = find_child_reaper(father);
reaper = find_child_reaper(father, dead);
if (list_empty(&father->children))
return;

Expand Down
21 changes: 17 additions & 4 deletions kernel/sched/psi.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@
* sampling of the aggregate task states would be.
*/

#include "../workqueue_internal.h"
#include <linux/sched/loadavg.h>
#include <linux/seq_file.h>
#include <linux/proc_fs.h>
Expand Down Expand Up @@ -480,9 +481,6 @@ static void psi_group_change(struct psi_group *group, int cpu,
groupc->tasks[t]++;

write_seqcount_end(&groupc->seq);

if (!delayed_work_pending(&group->clock_work))
schedule_delayed_work(&group->clock_work, PSI_FREQ);
}

static struct psi_group *iterate_groups(struct task_struct *task, void **iter)
Expand Down Expand Up @@ -513,6 +511,7 @@ void psi_task_change(struct task_struct *task, int clear, int set)
{
int cpu = task_cpu(task);
struct psi_group *group;
bool wake_clock = true;
void *iter = NULL;

if (!task->pid)
Expand All @@ -530,8 +529,22 @@ void psi_task_change(struct task_struct *task, int clear, int set)
task->psi_flags &= ~clear;
task->psi_flags |= set;

while ((group = iterate_groups(task, &iter)))
/*
* Periodic aggregation shuts off if there is a period of no
* task changes, so we wake it back up if necessary. However,
* don't do this if the task change is the aggregation worker
* itself going to sleep, or we'll ping-pong forever.
*/
if (unlikely((clear & TSK_RUNNING) &&
(task->flags & PF_WQ_WORKER) &&
wq_worker_last_func(task) == psi_update_work))
wake_clock = false;

while ((group = iterate_groups(task, &iter))) {
psi_group_change(group, cpu, clear, set);
if (wake_clock && !delayed_work_pending(&group->clock_work))
schedule_delayed_work(&group->clock_work, PSI_FREQ);
}
}

void psi_memstall_tick(struct task_struct *task, int cpu)
Expand Down
Loading

0 comments on commit b9de6ef

Please sign in to comment.