The peak of 5us is mainly due to the fact that the locking process can be deschedule during a given time to allow system processes to do their task.
In the driver riot_vsbdrv v4, there no protection again descheduling. The protections have been implemented only on v4r0p2 .
The Locking task today is divided on two section:
Today only the section2 is protected again descheduling
To improve its, we can:
Beware: the consequence of the full disabling of the scheduler for a long time period are not well known