Re: IBM test question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Esben Nielsen wrote:

for userland atomic operations (aside from swapping).
I can, if I use a kernel helper :) [1]

 Yep, but much slower.


I worked with an ARMv4 at my former job and wanted to run Linux on it. I thus gave this problem a thought. I got the following idea: Make a user space preemt-disable counter just like the in-kernel one. This can be done by registering a address in userspace per thread pointing where to find the counter. When the kernel wants to schedule it checks if the counter is non-zero. If it is (the very rare case), it doesn't reschedule but sets up a timer of some configurable time (say 1 ms or whatever you need). If the counter is not back to 0 after the timer has expired we schedule anyway and signals the thread to let it know that an
atomic operation have failed. Notice, that this can only happen due to an
error in the program: You must always be able finish your atomic operations in 1 ms.

(There are a lot of details to this, ofcourse. Forinstance. in the case the kernel wanted to schedule and sets up he timer, the user space program needs to know it so it can disable the timer reschedule as soon as the counter reaches 0. And there is the problem of not swapping out the page where the counter is stored....)


The kernel helper is not slow for armv5. There no userspace->kernel switch with some magic. That's just 15 instructions instead of one. The kernel helper is at a special address. When a context switch occurs, the kernel check if it wasn't in the helper and finish the atomic operation or set a flag.


Matthieu
-
To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [RT Stable]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux