User: Password:
Subscribe / Log in / New account

The state of realtime Linux

The state of realtime Linux

Posted Jun 17, 2010 15:54 UTC (Thu) by shane (subscriber, #3335)
Parent article: The state of realtime Linux

So the realtime patch set currently puts a lock around per-CPU data accesses, eliminating the preemption problem but wrecking scalability. Here, too, a real solution has not yet been found.

It sounds like what is needed is a way to direct the kernel that a task can be pre-empted but not manipulated in a way that is unsafe for pre-CPU state.

(Log in to post comments)

The state of realtime Linux

Posted Jun 17, 2010 16:11 UTC (Thu) by nevets (subscriber, #11875) [Link]

It is not the state of the task that we are worried about, but the state of the per-cpu data it is modifying.

If you have some per-cpu data that is never touched in interrupt context, all you need to do to protect it is to disable preemption. This is the same as a lock, since it makes the modification of the data serialized. No one else can modify because you must be on the CPU to modify it and no one can preempt the current user that is modifying the data.

Now if the task is preempted, another task can get on the CPU and modify the data breaking the serialization of the previous task.

Now in PREEMPT_RT, instead we add a special per_cpu_locked() variable. When you grab the per-cpu variable, you grab the lock for that variable (per-cpu). Now you can be preempted, and even migrated. But you will always be touching the data on the original CPU. If someone else tries to touch that variable, it must first grab the per-cpu lock, which will cause it to block until the first task is finished with it.

This solves the serialization, but hurts scalability, since a box of 2048 CPUs can have a bit of cacheline bouncing if tasks are constantly migrating after grabbing a per-cpu variable.

The state of realtime Linux

Posted Jun 17, 2010 18:19 UTC (Thu) by dlang (subscriber, #313) [Link]

it sounds like you may want to be a little less eager to migrate processes (or even say that you don't migrate a process that is holding a per-cpu lock)

Copyright © 2017, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds