# Unknown symbol sched_setscheduler

## vanmortel

Hey people,

I'm making a very simple kernel module. I create a kernel thread like with 'kthread_create' and I'm trying to set the scheduler policy of the task_struct. Here is part of the code :

```

#include <linux/sched.h>

...

struct sched_param param = { .sched_priority = 1 };

ztask = kthread_create(myfunction, NULL, "bleh");

sched_setscheduler(ztask, SCHED_RR, &param);

wake_up_process(ztask);

```

Everything compile fine but when I insert the module I get this in dmesg :

bleh: Unknown symbol sched_setscheduler

I've tried everything to make it work but still getting this message.

Kernel : Linux 2.6.28.8-vanilla

SMP is enabled.

Thanks for your help all

David

----------

## alligator421

Probably a linking problem.

sched_setscheduler is declared in sched.h and corresponding object file "sched.o" is in "$source/kernel/sched.o" on my machine.

# /usr/src/$SOURCE/kernel $ nm sched.o|grep sched_setscheduler

00000076 r __kstrtab_sched_setscheduler

00000000 r __ksymtab_sched_setscheduler

00001d20 t do_sched_setscheduler

00001b00 T sched_setscheduler

00001dc0 T sys_sched_setscheduler

# /usr/src/$SOURCE/kernel $

Or maybe the symbols needs to be declared and exported elsewhere too to make it work at runtime with ins/modprobe.

----------

## vanmortel

Add this :

```
MODULE_LICENSE("GPL");
```

The rest is self explaining  :Wink: 

David

----------

