spinlocks and kernel timer !!!

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi

static void some_method()
{
	unsigned long expires;
	static struct timer_list *timer;
	expires = jiffes + 20;
	data = 5;
	timer->expires = expires;
	timer->function = my_function;
	timer->data = data;
	init_timer(timer);   /*initalise timer*/
	spin_lock_irqsave(&spinlock, iflags);
	spin_unlock_irqrestore(&spinlock, iflags);

	return 0;
}

static int __init mod_init( void )
{
	printk(KERN_DEBUG "in init..\n");
	some_method();
	printk(KERN_DEBUG "after some method in init..\n");
	
	return 0;
};

static void __exit mod_exit( void )
{
	printk(KERN_DEBUG "bye world...\n");

}

My question is between spin_lock_irqsave() and
spin_unlock_irqrestore() code is supposed to be atomic right?
Now as i have initialised a timer structure in the function.If the
jiffies gets equal to expires in between spinlock() and spinunlock()
will my_function() execute?

What will happen and why?

Am  i missing something ?
Any pointers or links shall be appreciated.
thank you

pradeep

--
play the game

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux