Re: [PATCH 2.6.17-rc6-mm2] Fix exit race in per-task-delay-accounting

From: Shailabh Nagar
Date: Wed Jun 21 2006 - 10:14:47 EST


Balbir Singh wrote:
> Balbir Singh wrote:
>
>> Hi, Andrew,
>>
>> This patch fixes a race in per-task-delay-accounting. This race
>> was reported by Jay Lan. I tested the patch using
>> cerebrus test control system for eight hours with getdelays running on
>> the side (for both push and pull of delay statistics).
>>
>> It fixed the problem that Jay Lan saw.

Balbir, Andrew,

I'd recommend holding off on including the patch for a bit
since the solution proposed uses a
a) global and b) taskstats related
mutex to solve a race that is in the delay accounting code.

The locking required to resolve this race is for the exiting task
(whose tsk->delays is being set to null) and that too only for
accessing its delay accounting field.

Using a global mutex that is also being used to serialize exits
may be unnecessarily
- increasing contention
- introducing dependency between taskstats (generic) and delay accounting
layers.

So if there is an inexpensive way of achieving this locking using
something localized and specific to delay accounting (the most obvious
way seems to be a tsk->delay_lock but that has the unpleasant aspect of adding
yet another field to struct task) we should explore that first.

--Shailabh

>>
>> Signed-off-by: Balbir Singh <balbir@xxxxxxxxxx>
>> ---
>>
>> include/linux/taskstats_kern.h | 1 +
>> kernel/delayacct.c | 5 ++++-
>> kernel/taskstats.c | 5 ++++-
>> 3 files changed, 9 insertions(+), 2 deletions(-)
>>
>> diff -puN kernel/taskstats.c~per-task-delay-accounting-fix-exit-race
>> kernel/taskstats.c
>> ---
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/