Polling in kernel threads

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

 



Hello!

I develop a network interface driver and I've the following issue...

I create a kernel thread which has the following thread handler:
static int com_thread( void *data )
{
  daemonize( "comthread" );

  allow_signal( SIGTERM );
  while( !signal_pending(current) ) {
    if(receive(...)) {
		process_received_data(...);
	}
  }
  complete_and_exit(&threadcomplete, 0);
}

As you can see, the thread is polling a network card (i.e. Message Queue of a SCI network card). I know that polling normally is no good idea but the system, where this driver shall run on, has 8 cores and we want to reserve exactly one core for the polling work to get low latencies...

But now there are two problems:

1. problem is that the kernel thread doesn't get any signals which are sent to it. A possibility is to use a variable instead of "!signal_pending(current)" to advise the thread to exit. But I would like to know why the thread gets no signals until I insert a sleep function, like "msleep(1)", into the while loop.

2. problem is the stability of the system. Although there are 7 other "free" CPUs which could do the rest of the kernel's work, the system becomes very unstable - sometimes it freezes. Why does this happen? I've set the nice level of the thread to 19 but this didn't help...

I know... the method is very naive. So, does anyone of you know a better way to reserve a CPU for polling?

Many Thanks for your help!!!

Best regards,
Lukas

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at 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