0

In linux, in kvm environment, when a process in VM locks on some resource and is pre-empted, other processes of VM, which need that locked resource would spend time on spinlock. And the process would unlock the resource when it's allotted the PROCESSOR.

I would like to disable the scheduler from pre-emptying, until the process unlocks the resource. And this would reduce the cpu-time on spinlock.

How to achieve the above?? i.e.

  1. How to findout if a process in VM has locked on some resource?

  2. Then how to inform scheduler to not to pre-empt the process until the resource is unlocked?

correct me if am wrong anywhere..

Thanks in advance..

rAzOr
  • 300
  • 6
  • 19

1 Answers1

0

Use spinlock_irq_save() call. It disables interrupts and preempting and locks a spinlock atomically. See http://www.kernel.org/doc/Documentation/spinlocks.txt for use cases.

Basilevs
  • 22,440
  • 15
  • 57
  • 102