]> git.sesse.net Git - bcachefs-tools-debian/blobdiff - linux/sched.c
Disable pristine-tar option in gbp.conf, since there is no pristine-tar branch.
[bcachefs-tools-debian] / linux / sched.c
index c996945e0054d093e93f34d5f1553d8900afdfd9..1c7198d279bc9f534c946f2f56b65011a88ff452 100644 (file)
@@ -1,17 +1,15 @@
 
-#include <linux/futex.h>
+#include <stdio.h>
 #include <string.h>
 #include <sys/mman.h>
+#include <linux/futex.h>
 
 /* hack for mips: */
 #define CONFIG_RCU_HAVE_FUTEX 1
 #include <urcu/futex.h>
 
-#include <linux/math64.h>
-#include <linux/printk.h>
 #include <linux/rcupdate.h>
 #include <linux/sched.h>
-#include <linux/slab.h>
 #include <linux/timer.h>
 
 __thread struct task_struct *current;
@@ -39,7 +37,7 @@ void schedule(void)
 
        rcu_quiescent_state();
 
-       while ((v = current->state) != TASK_RUNNING)
+       while ((v = READ_ONCE(current->state)) != TASK_RUNNING)
                futex(&current->state, FUTEX_WAIT|FUTEX_PRIVATE_FLAG,
                      v, NULL, NULL, 0);
 }
@@ -83,7 +81,7 @@ long schedule_timeout(long timeout)
                 * that will tell you if something is gone wrong and where.
                 */
                if (timeout < 0) {
-                       printk(KERN_ERR "schedule_timeout: wrong timeout "
+                       fprintf(stderr, "schedule_timeout: wrong timeout "
                                "value %lx\n", timeout);
                        current->state = TASK_RUNNING;
                        goto out;
@@ -108,8 +106,6 @@ static void sched_init(void)
 {
        struct task_struct *p = malloc(sizeof(*p));
 
-       mlockall(MCL_CURRENT|MCL_FUTURE);
-
        memset(p, 0, sizeof(*p));
 
        p->state        = TASK_RUNNING;
@@ -122,7 +118,7 @@ static void sched_init(void)
        rcu_register_thread();
 }
 
-#ifndef __NR_getrandom
+#ifndef SYS_getrandom
 #include <fcntl.h>
 #include <sys/stat.h>
 #include <sys/types.h>