So the procfs file is written in binary format and is read back in
ascii format. Seems odd.
Perhaps this should all be done as a new syscall rather than some
procfs thing.
+ struct preempt_delay {
+ u32 __user *delay_req; /* delay request flag pointer */
+ unsigned char delay_granted:1; /* currently in delay */
+ unsigned char yield_penalty:1; /* failure to yield penalty */
+ } sched_preempt_delay;
The problem with bitfields is that a write to one bitfield can corrupt
a concurrent write to the other one. So it's your responsibility to
provide locking and/or to describe how this race is avoided. A comment
here in the definition would be a suitable way of addressing this.
+ if (delay_req) {
+ int ret;
+
+ pagefault_disable();
+ ret = __copy_from_user_inatomic(&delay_req_flag, delay_req,
+ sizeof(u32));
+ pagefault_enable();
This all looks rather hacky and unneccesary. Can't we somehow use
plain old get_user() and avoid such fuss?
+#else
+#define delay_resched_task(curr) resched_task(curr)
This could have been implemented in C...