From: Linus Torvalds Date: Thu, 20 Jan 2022 08:41:01 +0000 (+0200) Subject: Merge branch 'akpm' (patches from Andrew) X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=f4484d138b31e8fa1ba410363b5b9664f68974af;p=linux.git Merge branch 'akpm' (patches from Andrew) Merge more updates from Andrew Morton: "55 patches. Subsystems affected by this patch series: percpu, procfs, sysctl, misc, core-kernel, get_maintainer, lib, checkpatch, binfmt, nilfs2, hfs, fat, adfs, panic, delayacct, kconfig, kcov, and ubsan" * emailed patches from Andrew Morton : (55 commits) lib: remove redundant assignment to variable ret ubsan: remove CONFIG_UBSAN_OBJECT_SIZE kcov: fix generic Kconfig dependencies if ARCH_WANTS_NO_INSTR lib/Kconfig.debug: make TEST_KMOD depend on PAGE_SIZE_LESS_THAN_256KB btrfs: use generic Kconfig option for 256kB page size limit arch/Kconfig: split PAGE_SIZE_LESS_THAN_256KB from PAGE_SIZE_LESS_THAN_64KB configs: introduce debug.config for CI-like setup delayacct: track delays from memory compact Documentation/accounting/delay-accounting.rst: add thrashing page cache and direct compact delayacct: cleanup flags in struct task_delay_info and functions use it delayacct: fix incomplete disable operation when switch enable to disable delayacct: support swapin delay accounting for swapping without blkio panic: remove oops_id panic: use error_report_end tracepoint on warnings fs/adfs: remove unneeded variable make code cleaner FAT: use io_schedule_timeout() instead of congestion_wait() hfsplus: use struct_group_attr() for memcpy() region nilfs2: remove redundant pointer sbufs fs/binfmt_elf: use PT_LOAD p_align values for static PIE const_structs.checkpatch: add frequently used ops structs ... --- f4484d138b31e8fa1ba410363b5b9664f68974af diff --cc include/linux/kthread.h index b6c8aafa8db5a,2a5c04494663a..3df4ea04716fa --- a/include/linux/kthread.h +++ b/include/linux/kthread.h @@@ -33,7 -33,8 +33,8 @@@ struct task_struct *kthread_create_on_c unsigned int cpu, const char *namefmt); + void get_kthread_comm(char *buf, size_t buf_size, struct task_struct *tsk); -void set_kthread_struct(struct task_struct *p); +bool set_kthread_struct(struct task_struct *p); void kthread_set_per_cpu(struct task_struct *k, int cpu); bool kthread_is_per_cpu(struct task_struct *k); diff --cc kernel/kthread.c index a2c156ee8275c,a70cd5dc94e34..38c6dd822da87 --- a/kernel/kthread.c +++ b/kernel/kthread.c @@@ -94,7 -95,19 +96,19 @@@ static inline struct kthread *__to_kthr return kthread; } + void get_kthread_comm(char *buf, size_t buf_size, struct task_struct *tsk) + { + struct kthread *kthread = to_kthread(tsk); + + if (!kthread || !kthread->full_name) { + __get_task_comm(buf, buf_size, tsk); + return; + } + + strscpy_pad(buf, kthread->full_name, buf_size); + } + -void set_kthread_struct(struct task_struct *p) +bool set_kthread_struct(struct task_struct *p) { struct kthread *kthread; @@@ -118,13 -128,17 +132,17 @@@ void free_kthread_struct(struct task_st struct kthread *kthread; /* - * Can be NULL if this kthread was created by kernel_thread() - * or if kmalloc() in kthread() failed. + * Can be NULL if kmalloc() in set_kthread_struct() failed. */ kthread = to_kthread(k); + if (!kthread) + return; + #ifdef CONFIG_BLK_CGROUP - WARN_ON_ONCE(kthread && kthread->blkcg_css); + WARN_ON_ONCE(kthread->blkcg_css); #endif + k->worker_private = NULL; + kfree(kthread->full_name); kfree(kthread); }