Re: [PATCH] mm/kmemleak: rely on rcu for task stack scanning

2020-08-21 Thread Catalin Marinas
On Thu, Aug 20, 2020 at 01:39:02PM -0700, Davidlohr Bueso wrote: > kmemleak_scan() currently relies on the big tasklist_lock > hammer to stabilize iterating through the tasklist. Instead, > this patch proposes simply using rcu along with the rcu-safe > for_each_process_thread flavor (without changi

Re: [PATCH] mm/kmemleak: rely on rcu for task stack scanning

2020-08-21 Thread Oleg Nesterov
On 08/20, Davidlohr Bueso wrote: > > @@ -1471,15 +1471,15 @@ static void kmemleak_scan(void) > if (kmemleak_stack_scan) { > struct task_struct *p, *g; > > - read_lock(&tasklist_lock); > - do_each_thread(g, p) { > + rcu_read_lock(); > +

Re: [PATCH] mm/kmemleak: rely on rcu for task stack scanning

2020-08-20 Thread Qian Cai
On Thu, Aug 20, 2020 at 06:27:50PM -0700, Davidlohr Bueso wrote: > On Thu, 20 Aug 2020, Qian Cai wrote: > > > On Thu, Aug 20, 2020 at 01:39:02PM -0700, Davidlohr Bueso wrote: > > > kmemleak_scan() currently relies on the big tasklist_lock > > > hammer to stabilize iterating through the tasklist. I

Re: [PATCH] mm/kmemleak: rely on rcu for task stack scanning

2020-08-20 Thread Davidlohr Bueso
On Thu, 20 Aug 2020, Qian Cai wrote: On Thu, Aug 20, 2020 at 01:39:02PM -0700, Davidlohr Bueso wrote: kmemleak_scan() currently relies on the big tasklist_lock hammer to stabilize iterating through the tasklist. Instead, this patch proposes simply using rcu along with the rcu-safe for_each_proc

Re: [PATCH] mm/kmemleak: rely on rcu for task stack scanning

2020-08-20 Thread Qian Cai
On Thu, Aug 20, 2020 at 01:39:02PM -0700, Davidlohr Bueso wrote: > kmemleak_scan() currently relies on the big tasklist_lock > hammer to stabilize iterating through the tasklist. Instead, > this patch proposes simply using rcu along with the rcu-safe > for_each_process_thread flavor (without changi

[PATCH] mm/kmemleak: rely on rcu for task stack scanning

2020-08-20 Thread Davidlohr Bueso
kmemleak_scan() currently relies on the big tasklist_lock hammer to stabilize iterating through the tasklist. Instead, this patch proposes simply using rcu along with the rcu-safe for_each_process_thread flavor (without changing scan semantics), which doesn't make use of next_thread/p->thread_group