The patch titled Subject: core_pattern: add CPU specifier has been added to the -mm mm-nonmm-unstable branch. Its filename is core_pattern-add-cpu-specifier.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/core_pattern-add-cpu-specifier.patch This patch will later appear in the mm-nonmm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: Oleksandr Natalenko <oleksandr@xxxxxxxxxx> Subject: core_pattern: add CPU specifier Date: Sat, 3 Sep 2022 08:43:30 +0200 Statistically, in a large deployment regular segfaults may indicate a CPU issue. Currently, it is not possible to find out what CPU the segfault happened on. There are at least two attempts to improve segfault logging with this regard, but they do not help in case the logs rotate. Hence, lets make sure it is possible to permanently record a CPU the task ran on using a new core_pattern specifier. Link: https://lkml.kernel.org/r/20220903064330.20772-1-oleksandr@xxxxxxxxxx Signed-off-by: Oleksandr Natalenko <oleksandr@xxxxxxxxxx> Suggested-by: Renaud Métrich <rmetrich@xxxxxxxxxx> Reviewed-by: Oleg Nesterov <oleg@xxxxxxxxxx> Cc: Alexander Viro <viro@xxxxxxxxxxxxxxxxxx> Cc: "Eric W . Biederman" <ebiederm@xxxxxxxxxxxx> Cc: Grzegorz Halat <ghalat@xxxxxxxxxx> Cc: "Guilherme G. Piccoli" <gpiccoli@xxxxxxxxxx> Cc: "Huang, Ying" <ying.huang@xxxxxxxxx> Cc: Jason A. Donenfeld <Jason@xxxxxxxxx> Cc: Joel Savitz <jsavitz@xxxxxxxxxx> Cc: Jonathan Corbet <corbet@xxxxxxx> Cc: Kees Cook <keescook@xxxxxxxxxxxx> Cc: Laurent Dufour <ldufour@xxxxxxxxxxxxx> Cc: Luis Chamberlain <mcgrof@xxxxxxxxxx> Cc: Rob Herring <robh@xxxxxxxxxx> Cc: Stephen Kitt <steve@xxxxxxx> Cc: Will Deacon <will@xxxxxxxxxx> Cc: Xiaoming Ni <nixiaoming@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- Documentation/admin-guide/sysctl/kernel.rst | 1 + fs/coredump.c | 5 +++++ include/linux/coredump.h | 1 + 3 files changed, 7 insertions(+) --- a/Documentation/admin-guide/sysctl/kernel.rst~core_pattern-add-cpu-specifier +++ a/Documentation/admin-guide/sysctl/kernel.rst @@ -174,6 +174,7 @@ core_pattern %f executable filename %E executable path %c maximum size of core file by resource limit RLIMIT_CORE + %C CPU the task ran on %<OTHER> both are dropped ======== ========================================== --- a/fs/coredump.c~core_pattern-add-cpu-specifier +++ a/fs/coredump.c @@ -325,6 +325,10 @@ static int format_corename(struct core_n err = cn_printf(cn, "%lu", rlimit(RLIMIT_CORE)); break; + /* CPU the task ran on */ + case 'C': + err = cn_printf(cn, "%d", cprm->cpu); + break; default: break; } @@ -535,6 +539,7 @@ void do_coredump(const kernel_siginfo_t */ .mm_flags = mm->flags, .vma_meta = NULL, + .cpu = raw_smp_processor_id(), }; audit_core_dumps(siginfo->si_signo); --- a/include/linux/coredump.h~core_pattern-add-cpu-specifier +++ a/include/linux/coredump.h @@ -22,6 +22,7 @@ struct coredump_params { struct file *file; unsigned long limit; unsigned long mm_flags; + int cpu; loff_t written; loff_t pos; loff_t to_skip; _ Patches currently in -mm which might be from oleksandr@xxxxxxxxxx are core_pattern-add-cpu-specifier.patch