libmn: optimize spinlock implementation