Legato 21.05 and CONFIG_PREEMPT_RT

are you using the GPIO legato API in legato application?
How about using the GPIO interrupt in kernel driver layer and see if there is improvement?

You can also see if this helps to change the priority of irq: