[LITMUS^RT] A question about feather-trace tool
Björn Brandenburg
bbb at mpi-sws.org
Tue Feb 21 12:11:35 CET 2017
On 19 Feb 2017, at 21:32, Shuai Zhao <zs673 at york.ac.uk> wrote:
>
> ticket = atomic_read(&sem->next_ticket);
> t->rt_param.task_params.ticket = ticket;
> atomic_inc(&sem->next_ticket);
Hi Shuai,
as Meng already mentioned, you should never call kmalloc() in a time-critical path. The Linux memory allocator most certainly is not O(1) or predictable.
As an aside, the code that you posted, and which I’ve quoted above, looks highly suspicious to me. Is this supposed to implement a ticket lock? If so, this looks racy; you are not guaranteed that the fetch and increment will happen atomically (unless there’s an outer layer of synchronization not shown in your code excerpt). Is this intentional? If it is intentional, why are you not using just a regular unsigned long instead of an atomic_t value?
- Björn
More information about the litmus-dev
mailing list