From: "Chen, Yu C" <yu.c.chen@intel.com>
To: "Jain, Ayush" <ayushjai@amd.com>,
Andrew Morton <akpm@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>, Tejun Heo <tj@kernel.org>,
Johannes Weiner <hannes@cmpxchg.org>,
Jonathan Corbet <corbet@lwn.net>,
Mel Gorman <mgormanmgorman@suse.de>,
Michal Hocko <mhocko@kernel.org>,
Michal Koutny <mkoutny@suse.com>,
Muchun Song <muchun.song@linux.dev>,
Roman Gushchin <roman.gushchin@linux.dev>,
Shakeel Butt <shakeel.butt@linux.dev>,
"Chen, Tim C" <tim.c.chen@intel.com>,
Aubrey Li <aubrey.li@intel.com>, Libo Chen <libo.chen@oracle.com>,
<cgroups@vger.kernel.org>, <linux-doc@vger.kernel.org>,
<linux-mm@kvack.org>, <linux-kernel@vger.kernel.org>,
K Prateek Nayak <kprateek.nayak@amd.com>,
Madadi Vineeth Reddy <vineethr@linux.ibm.com>,
<Neeraj.Upadhyay@amd.com>, Peter Zijlstra <peterz@infradead.org>
Subject: Re: [PATCH v3] sched/numa: add statistics of numa balance task migration
Date: Mon, 5 May 2025 23:03:10 +0800 [thread overview]
Message-ID: <bd936eba-e536-4825-ae64-d1bd23c6eb4c@intel.com> (raw)
In-Reply-To: <8b248ff3-43ae-4e40-9fa4-ba4a04f3c18b@amd.com>
On 5/5/2025 2:43 PM, Jain, Ayush wrote:
>
> Hello,
>
> Hitting Kernel Panic on latest-next while running rcutorture tests
>
> 37ff6e9a2ce3 ("Add linux-next specific files for 20250502")
>
> reverting this patch fixes it
> 3b2339eeb032 ("sched-numa-add-statistics-of-numa-balance-task-migration-v3")
> https://web.git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/kernel/sched/core.c?id=3b2339eeb032627e9329daf70a4ba8cd62c9cc8d
>
> by looking at RIP pointer
>
> $ ./scripts/faddr2line vmlinux __migrate_swap_task+0x2e/0x180
> __migrate_swap_task+0x2e/0x180:
> count_memcg_events_mm at include/linux/memcontrol.h:987
> (inlined by) count_memcg_events_mm at include/linux/memcontrol.h:978
> (inlined by) __migrate_swap_task at kernel/sched/core.c:3356
>
> memcg = mem_cgroup_from_task(rcu_dereference(mm->owner));
> mm->owner -> NULL
>
> Attaching kernel logs below:
>
> [ 1070.635450] rcu-torture: rcu_torture_read_exit: End of episode
> [ 1074.047617] BUG: kernel NULL pointer dereference, address:
> 0000000000000498
Thanks Ayush,
According to this address,
4c 8b af 50 09 00 00 mov 0x950(%rdi),%r13 <--- r13 = p->mm;
49 8b bd 98 04 00 00 mov 0x498(%r13),%rdi <--- p->mm->owner
It seems that this task to be swapped has NULL mm_struct.
Does the following help?
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 96db6947bc92..0cb8cc4d551d 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -3353,7 +3353,8 @@ void set_task_cpu(struct task_struct *p, unsigned
int new_cpu)
static void __migrate_swap_task(struct task_struct *p, int cpu)
{
__schedstat_inc(p->stats.numa_task_swapped);
- count_memcg_event_mm(p->mm, NUMA_TASK_SWAP);
+ if (p->mm)
+ count_memcg_event_mm(p->mm, NUMA_TASK_SWAP);
if (task_on_rq_queued(p)) {
struct rq *src_rq, *dst_rq;
Hi Andrew,
May I know if we can hold this patch and not merge it for now,
besides this regression, Libo has another comment related to
this patch and I'll address it in next version. Sorry for
inconvenience.
thanks,
Chenyu
next prev parent reply other threads:[~2025-05-05 15:06 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-30 10:36 Chen Yu
2025-05-01 7:00 ` Libo Chen
2025-05-02 9:30 ` Chen, Yu C
2025-05-05 6:43 ` Jain, Ayush
2025-05-05 15:03 ` Chen, Yu C [this message]
2025-05-05 17:25 ` Venkat Rao Bagalkote
2025-05-07 11:36 ` Chen, Yu C
2025-05-05 17:46 ` Michal Koutný
2025-05-05 18:27 ` Chen, Yu C
2025-05-05 18:49 ` Libo Chen
2025-05-05 21:32 ` Libo Chen
2025-05-05 21:57 ` Libo Chen
2025-05-06 5:06 ` Jain, Ayush
2025-05-06 5:36 ` Chen, Yu C
2025-05-06 7:03 ` Libo Chen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bd936eba-e536-4825-ae64-d1bd23c6eb4c@intel.com \
--to=yu.c.chen@intel.com \
--cc=Neeraj.Upadhyay@amd.com \
--cc=akpm@linux-foundation.org \
--cc=aubrey.li@intel.com \
--cc=ayushjai@amd.com \
--cc=cgroups@vger.kernel.org \
--cc=corbet@lwn.net \
--cc=hannes@cmpxchg.org \
--cc=kprateek.nayak@amd.com \
--cc=libo.chen@oracle.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgormanmgorman@suse.de \
--cc=mhocko@kernel.org \
--cc=mingo@redhat.com \
--cc=mkoutny@suse.com \
--cc=muchun.song@linux.dev \
--cc=peterz@infradead.org \
--cc=roman.gushchin@linux.dev \
--cc=shakeel.butt@linux.dev \
--cc=tim.c.chen@intel.com \
--cc=tj@kernel.org \
--cc=vineethr@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox