Re: [patch 04/41] cpu ops: Core piece for generic atomic per cpu operations

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Christoph Lameter
Date: Friday, May 30, 2008 - 11:00 am

On Fri, 30 May 2008, Rusty Russell wrote:


There is no doubt that local_t does perform an atomic vs. interrupt inc 
for example. But its not usable. Because you need to determine the address 
of the local_t belonging to the current processor first. As soon as you 
have loaded a processor specific address you can no longer be preempted 
because that may change the processor and then the wrong address may be 
increment (and then we have a race again since now we are incrementing 
counters belonging to other processors). So local_t at mininum requires 
disabling preempt.
 
Believe me I have tried to use local_t repeatedly for vm statistics etc. 
It always fails on that issue. See f.e. the patch that converts vmstat to 
cpu alloc and compare with my initial local_t based implementation 2 years 
ago that bombed out because I assumed that local_t would work right.

cpu ops does both

1. The determination of the address of the object belonging to the local 
processor.

and

2. The RMW

in one instruction. That avoids having to disable preemption or interrupts 
and it shortens the instructions significantly.

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[patch 04/41] cpu ops: Core piece for generic atomic per c ..., Christoph Lameter, (Thu May 29, 8:56 pm)
Re: [patch 04/41] cpu ops: Core piece for generic atomic p ..., Christoph Lameter, (Thu May 29, 10:17 pm)
Re: [patch 04/41] cpu ops: Core piece for generic atomic p ..., Christoph Lameter, (Thu May 29, 11:12 pm)
Re: [patch 04/41] cpu ops: Core piece for generic atomic p ..., Christoph Lameter, (Fri May 30, 11:00 am)
Re: [patch 04/41] cpu ops: Core piece for generic atomic p ..., Christoph Lameter, (Mon Jun 9, 12:00 pm)
Re: [patch 04/41] cpu ops: Core piece for generic atomic p ..., Christoph Lameter, (Tue Jun 10, 10:42 am)
Re: [patch 04/41] cpu ops: Core piece for generic atomic p ..., Christoph Lameter, (Tue Jun 10, 5:15 pm)
Re: [patch 04/41] cpu ops: Core piece for generic atomic p ..., Christoph Lameter, (Wed Jun 11, 4:39 pm)
Re: [patch 04/41] cpu ops: Core piece for generic atomic p ..., Christoph Lameter, (Thu Jun 12, 10:19 am)
Re: [patch 04/41] cpu ops: Core piece for generic atomic p ..., Christoph Lameter, (Thu Jun 12, 7:27 pm)
Re: [patch 04/41] cpu ops: Core piece for generic atomic p ..., Christoph Lameter, (Mon Jun 16, 7:52 am)
Re: [patch 04/41] cpu ops: Core piece for generic atomic p ..., Christoph Lameter, (Mon Jun 16, 7:29 pm)