Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755583AbcDLF3Z (ORCPT ); Tue, 12 Apr 2016 01:29:25 -0400 Received: from mail-oi0-f68.google.com ([209.85.218.68]:36399 "EHLO mail-oi0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750888AbcDLF3Y (ORCPT ); Tue, 12 Apr 2016 01:29:24 -0400 From: "Bill Huey (hui)" To: Peter Zijlstra , Steven Rostedt , linux-kernel@vger.kernel.org Cc: Dario Faggioli , Alessandro Zummo , Thomas Gleixner , KY Srinivasan , Amir Frenkel , Bdale Garbee Subject: [PATCH RFC v0 00/12] Cyclic Scheduler Against RTC Date: Mon, 11 Apr 2016 22:29:08 -0700 Message-Id: <1460438960-32060-1-git-send-email-bill.huey@gmail.com> X-Mailer: git-send-email 2.5.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4168 Lines: 92 Hi, This a crude cyclic scheduler implementation. It uses SCHED_FIFO tasks and runs them according to a map pattern specified by a 64 bit mask. Each bit corresponds to an entry into an 64 entry array of 'struct task_struct'. This works single core CPU 0 only for now. Threads are 'admitted' to this map by an extension to the ioctl() via the of (rtc) real-time clock interface. The bit pattern then determines when the task will run or activate next. The /dev/rtc interface is choosen for this purpose because of its accessibilty to userspace. For example, the mplayer program already use it as a timer source and could possibly benefit from being sync to a vertical retrace interrupt during decoding. Could be an OpenGL program needing precisely scheduler support for those same handling vertical retrace interrupts, low latency audio and timely handling of touch events amognst other uses. There is also a need for some kind of blocking/yielding interface that can return an overrun count for when the thread utilizes more time than allocated for that frame. The read() function in rtc is overloaded for this purpose and reports overrun events. Yield functionality has yet to be fully tested. I apologize for any informal or misused of terminology as I haven't fully reviewed all of the academic literature regarding these kind of schedulers. I welcome suggestions and corrects etc Special thanks to includes... Peter Ziljstra (Intel), Steve Rostedt (Red Hat), Rik van Riel (Red Hat) for encouraging me to continue working in the Linux kernel community and being generally positive and supportive. KY Srinivasan (formerly Novell now Microsoft) for discussion of real-time schedulers and pointers to specifics on that topic. It was just a single discussion but was basically the inspiration for this kind of work. Amir Frenkel (Palm), Kenneth Albanowski (Palm), Bdale Garbee (HP) for the amazing place that was Palm, Kenneth for being a co-conspirator with this scheduler. This scheduler was inspired by performance work that I did at Palm's kernel group along with discussions with the multimedia team before HP kill webOS off. Sad and infuriating moment. Maybe, in a short while, the community will understand the value of these patches for -rt and start solving the general phenomenon of high performance multi-media and user interactivity problems more properly with both a scheduler like this and -rt shipped as default in the near future. [Also, I'd love some kind of sponsorship to continue what I think is critical work versus heading back into the valley] --- Bill Huey (hui) (12): Kconfig change Reroute rtc update irqs to the cyclic scheduler handler Add cyclic support to rtc-dev.c Anonymous struct initialization Task tracking per file descriptor Add anonymous struct to sched_rt_entity kernel/userspace additions for addition ioctl() support for rtc Compilation support Add priority support for the cyclic scheduler Export SCHED_FIFO/RT requeuing functions Cyclic scheduler support Cyclic/rtc documentation Documentation/scheduler/sched-cyclic-rtc.txt | 468 ++++++++++++++++++++ drivers/rtc/Kconfig | 5 + drivers/rtc/class.c | 3 + drivers/rtc/interface.c | 23 + drivers/rtc/rtc-dev.c | 161 +++++++ include/linux/init_task.h | 18 + include/linux/rtc.h | 3 + include/linux/sched.h | 15 + include/uapi/linux/rtc.h | 4 + kernel/sched/Makefile | 1 + kernel/sched/core.c | 13 + kernel/sched/cyclic.c | 620 +++++++++++++++++++++++++++ kernel/sched/cyclic.h | 86 ++++ kernel/sched/cyclic_rt.h | 7 + kernel/sched/rt.c | 41 ++ 15 files changed, 1468 insertions(+) create mode 100644 Documentation/scheduler/sched-cyclic-rtc.txt create mode 100644 kernel/sched/cyclic.c create mode 100644 kernel/sched/cyclic.h create mode 100644 kernel/sched/cyclic_rt.h -- 2.5.0