lkml.org 
[lkml]   [2016]   [May]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v12 07/13] task_isolation: add debug boot flag
From
Date
On 5/19/2016 1:54 PM, Peter Zijlstra wrote:
> So the 'simple' thing is:
>
> struct rq *rq = cpu_rq(cpu);
> struct task_struct *task;
>
> raw_spin_lock_irq(&rq->lock);
> task = rq->curr;
> get_task_struct(task);
> raw_spin_unlock_irq(&rq->lock);
>
> Because by holding rq->lock, the remote CPU cannot schedule and the
> current task_must_ still be valid.

I will plan to use that idiom in the next patch series. Thanks!

> And note; the above can result in a task which already has PF_EXITING
> set.

I think that should be benign though; we may generate an unnecessary
warning, but somebody was doing something that could have resulted in
interrupting an isolated task anyway, so warning about it is reasonable. And
presumably PF_EXITING just means we don't wake any threads and leave
the signal queued, but that gets flushed when the task finally exits.

> The complex thing is described in the linked thread and will likely make
> your head hurt.

I read the linked thread and was entertained. :-) I suspect locking the
runqueue may be the more robust solution anyway, and since this is
presumably not a hot path, it seems easier to reason about this way.

--
Chris Metcalf, Mellanox Technologies
http://www.mellanox.com

\
 
 \ /
  Last update: 2016-05-19 20:21    [W:0.287 / U:0.716 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site