lkml.org 
[lkml]   [2013]   [Sep]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectScheduling new work during a context switch
From
Hi,

I am modifying the perf internals to avoid the overhead due to a
second copy, when using Intel's BTS (execution tracing). Mainly, I
have a buffer that fills during the execution of the traced process,
and I sometimes need to save its contents.

When my buffer should be emptied, I schedule a task to copy the buffer
contents to disk later. This action should be performed:
- Whenether the buffer is full (in a IRQ handler).
- Whenether the traced task is scheduled out. This is when it blocks.

The problem is, deferring work in a work queue with schedule_work()
during a context switch (in schedule()) leads to a deadlock, because
both want to hold the same lock (&(&pool->lock)->rlock).
I also tried to pre-schedule the task, make it
wait_event_interruptible(), and wake_up() it during the context
switch, but there is also a deadlock due to already-held &p->pi_lock
in try_to_wake_up().

I am certainly doing something not the way it should be done. Is there
a correct way to defer work during a context switch?

Thanks!

Adrien


\
 
 \ /
  Last update: 2013-09-27 00:01    [W:0.216 / U:0.372 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site