Permalink
Browse files

update patches

  • Loading branch information...
1 parent 1ca9b88 commit 7ee3326b4301e60e379aa06d721ed79e9c8ec365 @nikhilh nikhilh committed Aug 25, 2010
View
2 benchmark/CPUIsolation.py
@@ -59,7 +59,7 @@ def usage():
if __name__ == '__main__':
if(len(sys.argv) != 2):
usage()
- sizes = [10, 20, 40, 80 ]
+ sizes = [1, 3, 5, 10, 20, 40, 80 ]
trials = 10
for bm in bmarkToTopo.keys():
if(re.match(bm, sys.argv[1], re.I) is not None):
View
254 patches/lxc-attach-enable/0001-nsfd-v5.patch → patches/0001-nsfd-v5.patch
@@ -18,7 +18,7 @@ git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/linux-2.6.33-nsfd-v5.git
0011-ns-proc-Add-support-for-the-ipc-namespace.patch
0012-ns-proc-Add-support-for-the-mount-namespace.patch
-Signed-off-by: Cedric Le Goater <clg@fr.ibm.com>
+Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
---
arch/alpha/kernel/systbls.S | 1
@@ -65,10 +65,10 @@ Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
41 files changed, 543 insertions(+), 76 deletions(-)
create mode 100644 fs/proc/namespaces.c
-Index: linux-2.6.35/arch/alpha/kernel/systbls.S
+Index: linux-2.6.35-rc6/arch/alpha/kernel/systbls.S
===================================================================
---- linux-2.6.35.orig/arch/alpha/kernel/systbls.S 2010-08-01 15:11:14.000000000 -0700
-+++ linux-2.6.35/arch/alpha/kernel/systbls.S 2010-08-03 16:40:55.534551725 -0700
+--- linux-2.6.35-rc6.orig/arch/alpha/kernel/systbls.S 2010-07-22 12:13:38.000000000 -0700
++++ linux-2.6.35-rc6/arch/alpha/kernel/systbls.S 2010-07-28 16:06:10.420451061 -0700
@@ -512,6 +512,7 @@
.quad sys_pwritev
.quad sys_rt_tgsigqueueinfo
@@ -77,10 +77,10 @@ Index: linux-2.6.35/arch/alpha/kernel/systbls.S
.size sys_call_table, . - sys_call_table
.type sys_call_table, @object
-Index: linux-2.6.35/arch/arm/kernel/calls.S
+Index: linux-2.6.35-rc6/arch/arm/kernel/calls.S
===================================================================
---- linux-2.6.35.orig/arch/arm/kernel/calls.S 2010-08-01 15:11:14.000000000 -0700
-+++ linux-2.6.35/arch/arm/kernel/calls.S 2010-08-03 16:40:55.534551725 -0700
+--- linux-2.6.35-rc6.orig/arch/arm/kernel/calls.S 2010-07-22 12:13:38.000000000 -0700
++++ linux-2.6.35-rc6/arch/arm/kernel/calls.S 2010-07-28 16:06:10.420451061 -0700
@@ -375,6 +375,7 @@
CALL(sys_rt_tgsigqueueinfo)
CALL(sys_perf_event_open)
@@ -89,20 +89,20 @@ Index: linux-2.6.35/arch/arm/kernel/calls.S
#ifndef syscalls_counted
.equ syscalls_padding, ((NR_syscalls + 3) & ~3) - NR_syscalls
#define syscalls_counted
-Index: linux-2.6.35/arch/avr32/kernel/syscall_table.S
+Index: linux-2.6.35-rc6/arch/avr32/kernel/syscall_table.S
===================================================================
---- linux-2.6.35.orig/arch/avr32/kernel/syscall_table.S 2010-08-01 15:11:14.000000000 -0700
-+++ linux-2.6.35/arch/avr32/kernel/syscall_table.S 2010-08-03 16:40:55.534551725 -0700
+--- linux-2.6.35-rc6.orig/arch/avr32/kernel/syscall_table.S 2010-07-22 12:13:38.000000000 -0700
++++ linux-2.6.35-rc6/arch/avr32/kernel/syscall_table.S 2010-07-28 16:06:10.420451061 -0700
@@ -296,4 +296,5 @@
.long sys_ni_syscall /* 280, was sys_timerfd */
.long sys_eventfd
.long sys_recvmmsg
+ .long sys_setns
.long sys_ni_syscall /* r8 is saturated at nr_syscalls */
-Index: linux-2.6.35/arch/blackfin/mach-common/entry.S
+Index: linux-2.6.35-rc6/arch/blackfin/mach-common/entry.S
===================================================================
---- linux-2.6.35.orig/arch/blackfin/mach-common/entry.S 2010-08-01 15:11:14.000000000 -0700
-+++ linux-2.6.35/arch/blackfin/mach-common/entry.S 2010-08-03 16:40:55.534551725 -0700
+--- linux-2.6.35-rc6.orig/arch/blackfin/mach-common/entry.S 2010-07-22 12:13:38.000000000 -0700
++++ linux-2.6.35-rc6/arch/blackfin/mach-common/entry.S 2010-07-28 16:06:10.420451061 -0700
@@ -1628,6 +1628,7 @@
.long _sys_rt_tgsigqueueinfo
.long _sys_perf_event_open
@@ -111,10 +111,10 @@ Index: linux-2.6.35/arch/blackfin/mach-common/entry.S
.rept NR_syscalls-(.-_sys_call_table)/4
.long _sys_ni_syscall
-Index: linux-2.6.35/arch/ia64/kernel/entry.S
+Index: linux-2.6.35-rc6/arch/ia64/kernel/entry.S
===================================================================
---- linux-2.6.35.orig/arch/ia64/kernel/entry.S 2010-08-01 15:11:14.000000000 -0700
-+++ linux-2.6.35/arch/ia64/kernel/entry.S 2010-08-03 16:40:55.624923258 -0700
+--- linux-2.6.35-rc6.orig/arch/ia64/kernel/entry.S 2010-07-22 12:13:38.000000000 -0700
++++ linux-2.6.35-rc6/arch/ia64/kernel/entry.S 2010-07-28 16:06:10.420451061 -0700
@@ -1768,6 +1768,7 @@
data8 sys_pwritev // 1320
data8 sys_rt_tgsigqueueinfo
@@ -123,19 +123,19 @@ Index: linux-2.6.35/arch/ia64/kernel/entry.S
.org sys_call_table + 8*NR_syscalls // guard against failures to increase NR_syscalls
#endif /* __IA64_ASM_PARAVIRTUALIZED_NATIVE */
-Index: linux-2.6.35/arch/microblaze/kernel/syscall_table.S
+Index: linux-2.6.35-rc6/arch/microblaze/kernel/syscall_table.S
===================================================================
---- linux-2.6.35.orig/arch/microblaze/kernel/syscall_table.S 2010-08-01 15:11:14.000000000 -0700
-+++ linux-2.6.35/arch/microblaze/kernel/syscall_table.S 2010-08-03 16:40:55.624923258 -0700
+--- linux-2.6.35-rc6.orig/arch/microblaze/kernel/syscall_table.S 2010-07-22 12:13:38.000000000 -0700
++++ linux-2.6.35-rc6/arch/microblaze/kernel/syscall_table.S 2010-07-28 16:06:10.420451061 -0700
@@ -372,3 +372,4 @@
.long sys_rt_tgsigqueueinfo /* 365 */
.long sys_perf_event_open
.long sys_recvmmsg
+ .long sys_setns
-Index: linux-2.6.35/arch/mips/kernel/scall32-o32.S
+Index: linux-2.6.35-rc6/arch/mips/kernel/scall32-o32.S
===================================================================
---- linux-2.6.35.orig/arch/mips/kernel/scall32-o32.S 2010-08-01 15:11:14.000000000 -0700
-+++ linux-2.6.35/arch/mips/kernel/scall32-o32.S 2010-08-03 16:40:55.624923258 -0700
+--- linux-2.6.35-rc6.orig/arch/mips/kernel/scall32-o32.S 2010-07-22 12:13:38.000000000 -0700
++++ linux-2.6.35-rc6/arch/mips/kernel/scall32-o32.S 2010-07-28 16:06:10.420451061 -0700
@@ -584,6 +584,7 @@
sys sys_perf_event_open 5
sys sys_accept4 4
@@ -144,40 +144,40 @@ Index: linux-2.6.35/arch/mips/kernel/scall32-o32.S
.endm
/* We pre-compute the number of _instruction_ bytes needed to
-Index: linux-2.6.35/arch/mips/kernel/scall64-64.S
+Index: linux-2.6.35-rc6/arch/mips/kernel/scall64-64.S
===================================================================
---- linux-2.6.35.orig/arch/mips/kernel/scall64-64.S 2010-08-01 15:11:14.000000000 -0700
-+++ linux-2.6.35/arch/mips/kernel/scall64-64.S 2010-08-03 16:40:55.624923258 -0700
+--- linux-2.6.35-rc6.orig/arch/mips/kernel/scall64-64.S 2010-07-22 12:13:38.000000000 -0700
++++ linux-2.6.35-rc6/arch/mips/kernel/scall64-64.S 2010-07-28 16:06:10.420451061 -0700
@@ -421,4 +421,5 @@
PTR sys_perf_event_open
PTR sys_accept4
PTR sys_recvmmsg
+ PTR sys_setns
.size sys_call_table,.-sys_call_table
-Index: linux-2.6.35/arch/mips/kernel/scall64-n32.S
+Index: linux-2.6.35-rc6/arch/mips/kernel/scall64-n32.S
===================================================================
---- linux-2.6.35.orig/arch/mips/kernel/scall64-n32.S 2010-08-01 15:11:14.000000000 -0700
-+++ linux-2.6.35/arch/mips/kernel/scall64-n32.S 2010-08-03 16:41:51.827169090 -0700
+--- linux-2.6.35-rc6.orig/arch/mips/kernel/scall64-n32.S 2010-07-22 12:13:38.000000000 -0700
++++ linux-2.6.35-rc6/arch/mips/kernel/scall64-n32.S 2010-07-28 16:06:10.420451061 -0700
@@ -420,4 +420,5 @@
PTR sys_accept4
PTR compat_sys_recvmmsg
PTR sys_getdents
+ PTR sys_setns
.size sysn32_call_table,.-sysn32_call_table
-Index: linux-2.6.35/arch/mips/kernel/scall64-o32.S
+Index: linux-2.6.35-rc6/arch/mips/kernel/scall64-o32.S
===================================================================
---- linux-2.6.35.orig/arch/mips/kernel/scall64-o32.S 2010-08-01 15:11:14.000000000 -0700
-+++ linux-2.6.35/arch/mips/kernel/scall64-o32.S 2010-08-03 16:40:55.624923258 -0700
+--- linux-2.6.35-rc6.orig/arch/mips/kernel/scall64-o32.S 2010-07-22 12:13:38.000000000 -0700
++++ linux-2.6.35-rc6/arch/mips/kernel/scall64-o32.S 2010-07-28 16:06:10.420451061 -0700
@@ -539,4 +539,5 @@
PTR sys_perf_event_open
PTR sys_accept4
PTR compat_sys_recvmmsg
+ PTR sys_setns
.size sys_call_table,.-sys_call_table
-Index: linux-2.6.35/arch/powerpc/platforms/cell/spufs/sched.c
+Index: linux-2.6.35-rc6/arch/powerpc/platforms/cell/spufs/sched.c
===================================================================
---- linux-2.6.35.orig/arch/powerpc/platforms/cell/spufs/sched.c 2010-08-01 15:11:14.000000000 -0700
-+++ linux-2.6.35/arch/powerpc/platforms/cell/spufs/sched.c 2010-08-03 16:40:55.624923258 -0700
+--- linux-2.6.35-rc6.orig/arch/powerpc/platforms/cell/spufs/sched.c 2010-07-22 12:13:38.000000000 -0700
++++ linux-2.6.35-rc6/arch/powerpc/platforms/cell/spufs/sched.c 2010-07-28 16:06:10.420451061 -0700
@@ -1095,7 +1095,7 @@
LOAD_INT(c), LOAD_FRAC(c),
count_active_contexts(),
@@ -187,30 +187,30 @@ Index: linux-2.6.35/arch/powerpc/platforms/cell/spufs/sched.c
return 0;
}
-Index: linux-2.6.35/arch/sh/kernel/syscalls_64.S
+Index: linux-2.6.35-rc6/arch/sh/kernel/syscalls_64.S
===================================================================
---- linux-2.6.35.orig/arch/sh/kernel/syscalls_64.S 2010-08-01 15:11:14.000000000 -0700
-+++ linux-2.6.35/arch/sh/kernel/syscalls_64.S 2010-08-03 16:40:55.624923258 -0700
+--- linux-2.6.35-rc6.orig/arch/sh/kernel/syscalls_64.S 2010-07-22 12:13:38.000000000 -0700
++++ linux-2.6.35-rc6/arch/sh/kernel/syscalls_64.S 2010-07-28 16:06:10.420451061 -0700
@@ -393,3 +393,4 @@
.long sys_perf_event_open
.long sys_recvmmsg /* 365 */
.long sys_accept4
+ .long sys_setns
-Index: linux-2.6.35/arch/sparc/kernel/systbls_32.S
+Index: linux-2.6.35-rc6/arch/sparc/kernel/systbls_32.S
===================================================================
---- linux-2.6.35.orig/arch/sparc/kernel/systbls_32.S 2010-08-01 15:11:14.000000000 -0700
-+++ linux-2.6.35/arch/sparc/kernel/systbls_32.S 2010-08-03 16:40:55.624923258 -0700
+--- linux-2.6.35-rc6.orig/arch/sparc/kernel/systbls_32.S 2010-07-22 12:13:38.000000000 -0700
++++ linux-2.6.35-rc6/arch/sparc/kernel/systbls_32.S 2010-07-28 16:06:10.420451061 -0700
@@ -82,5 +82,5 @@
/*310*/ .long sys_utimensat, sys_signalfd, sys_timerfd_create, sys_eventfd, sys_fallocate
/*315*/ .long sys_timerfd_settime, sys_timerfd_gettime, sys_signalfd4, sys_eventfd2, sys_epoll_create1
/*320*/ .long sys_dup3, sys_pipe2, sys_inotify_init1, sys_accept4, sys_preadv
-/*325*/ .long sys_pwritev, sys_rt_tgsigqueueinfo, sys_perf_event_open, sys_recvmmsg
+/*325*/ .long sys_pwritev, sys_rt_tgsigqueueinfo, sys_perf_event_open, sys_recvmmsg, sys_setns
-Index: linux-2.6.35/arch/sparc/kernel/systbls_64.S
+Index: linux-2.6.35-rc6/arch/sparc/kernel/systbls_64.S
===================================================================
---- linux-2.6.35.orig/arch/sparc/kernel/systbls_64.S 2010-08-01 15:11:14.000000000 -0700
-+++ linux-2.6.35/arch/sparc/kernel/systbls_64.S 2010-08-03 16:40:55.624923258 -0700
+--- linux-2.6.35-rc6.orig/arch/sparc/kernel/systbls_64.S 2010-07-22 12:13:38.000000000 -0700
++++ linux-2.6.35-rc6/arch/sparc/kernel/systbls_64.S 2010-07-28 16:06:10.420451061 -0700
@@ -83,7 +83,7 @@
/*310*/ .word compat_sys_utimensat, compat_sys_signalfd, sys_timerfd_create, sys_eventfd, compat_sys_fallocate
.word compat_sys_timerfd_settime, compat_sys_timerfd_gettime, compat_sys_signalfd4, sys_eventfd2, sys_epoll_create1
@@ -226,10 +226,10 @@ Index: linux-2.6.35/arch/sparc/kernel/systbls_64.S
/*320*/ .word sys_dup3, sys_pipe2, sys_inotify_init1, sys_accept4, sys_preadv
- .word sys_pwritev, sys_rt_tgsigqueueinfo, sys_perf_event_open, sys_recvmmsg
+ .word sys_pwritev, sys_rt_tgsigqueueinfo, sys_perf_event_open, sys_recvmmsg, sys_setns
-Index: linux-2.6.35/arch/um/drivers/mconsole_kern.c
+Index: linux-2.6.35-rc6/arch/um/drivers/mconsole_kern.c
===================================================================
---- linux-2.6.35.orig/arch/um/drivers/mconsole_kern.c 2010-08-01 15:11:14.000000000 -0700
-+++ linux-2.6.35/arch/um/drivers/mconsole_kern.c 2010-08-03 16:40:55.624923258 -0700
+--- linux-2.6.35-rc6.orig/arch/um/drivers/mconsole_kern.c 2010-07-22 12:13:38.000000000 -0700
++++ linux-2.6.35-rc6/arch/um/drivers/mconsole_kern.c 2010-07-28 16:06:10.420451061 -0700
@@ -125,7 +125,7 @@
void mconsole_proc(struct mc_request *req)
{
@@ -239,20 +239,20 @@ Index: linux-2.6.35/arch/um/drivers/mconsole_kern.c
struct file *file;
int n, err;
char *ptr = req->request.data, *buf;
-Index: linux-2.6.35/arch/x86/ia32/ia32entry.S
+Index: linux-2.6.35-rc6/arch/x86/ia32/ia32entry.S
===================================================================
---- linux-2.6.35.orig/arch/x86/ia32/ia32entry.S 2010-08-01 15:11:14.000000000 -0700
-+++ linux-2.6.35/arch/x86/ia32/ia32entry.S 2010-08-03 16:40:55.624923258 -0700
+--- linux-2.6.35-rc6.orig/arch/x86/ia32/ia32entry.S 2010-07-22 12:13:38.000000000 -0700
++++ linux-2.6.35-rc6/arch/x86/ia32/ia32entry.S 2010-07-28 16:06:10.420451061 -0700
@@ -842,4 +842,5 @@
.quad compat_sys_rt_tgsigqueueinfo /* 335 */
.quad sys_perf_event_open
.quad compat_sys_recvmmsg
+ .quad sys_setns
ia32_syscall_end:
-Index: linux-2.6.35/arch/x86/include/asm/unistd_32.h
+Index: linux-2.6.35-rc6/arch/x86/include/asm/unistd_32.h
===================================================================
---- linux-2.6.35.orig/arch/x86/include/asm/unistd_32.h 2010-08-01 15:11:14.000000000 -0700
-+++ linux-2.6.35/arch/x86/include/asm/unistd_32.h 2010-08-03 16:40:55.624923258 -0700
+--- linux-2.6.35-rc6.orig/arch/x86/include/asm/unistd_32.h 2010-07-22 12:13:38.000000000 -0700
++++ linux-2.6.35-rc6/arch/x86/include/asm/unistd_32.h 2010-07-28 16:06:10.420451061 -0700
@@ -343,10 +343,11 @@
#define __NR_rt_tgsigqueueinfo 335
#define __NR_perf_event_open 336
@@ -266,10 +266,10 @@ Index: linux-2.6.35/arch/x86/include/asm/unistd_32.h
#define __ARCH_WANT_IPC_PARSE_VERSION
#define __ARCH_WANT_OLD_READDIR
-Index: linux-2.6.35/arch/x86/include/asm/unistd_64.h
+Index: linux-2.6.35-rc6/arch/x86/include/asm/unistd_64.h
===================================================================
---- linux-2.6.35.orig/arch/x86/include/asm/unistd_64.h 2010-08-01 15:11:14.000000000 -0700
-+++ linux-2.6.35/arch/x86/include/asm/unistd_64.h 2010-08-03 16:40:55.624923258 -0700
+--- linux-2.6.35-rc6.orig/arch/x86/include/asm/unistd_64.h 2010-07-22 12:13:38.000000000 -0700
++++ linux-2.6.35-rc6/arch/x86/include/asm/unistd_64.h 2010-07-28 16:06:10.420451061 -0700
@@ -663,6 +663,8 @@
__SYSCALL(__NR_perf_event_open, sys_perf_event_open)
#define __NR_recvmmsg 299
@@ -279,19 +279,19 @@ Index: linux-2.6.35/arch/x86/include/asm/unistd_64.h
#ifndef __NO_STUBS
#define __ARCH_WANT_OLD_READDIR
-Index: linux-2.6.35/arch/x86/kernel/syscall_table_32.S
+Index: linux-2.6.35-rc6/arch/x86/kernel/syscall_table_32.S
===================================================================
---- linux-2.6.35.orig/arch/x86/kernel/syscall_table_32.S 2010-08-01 15:11:14.000000000 -0700
-+++ linux-2.6.35/arch/x86/kernel/syscall_table_32.S 2010-08-03 16:40:55.624923258 -0700
+--- linux-2.6.35-rc6.orig/arch/x86/kernel/syscall_table_32.S 2010-07-22 12:13:38.000000000 -0700
++++ linux-2.6.35-rc6/arch/x86/kernel/syscall_table_32.S 2010-07-28 16:06:10.420451061 -0700
@@ -337,3 +337,4 @@
.long sys_rt_tgsigqueueinfo /* 335 */
.long sys_perf_event_open
.long sys_recvmmsg
+ .long sys_setns
-Index: linux-2.6.35/arch/xtensa/include/asm/unistd.h
+Index: linux-2.6.35-rc6/arch/xtensa/include/asm/unistd.h
===================================================================
---- linux-2.6.35.orig/arch/xtensa/include/asm/unistd.h 2010-08-01 15:11:14.000000000 -0700
-+++ linux-2.6.35/arch/xtensa/include/asm/unistd.h 2010-08-03 16:40:55.624923258 -0700
+--- linux-2.6.35-rc6.orig/arch/xtensa/include/asm/unistd.h 2010-07-22 12:13:38.000000000 -0700
++++ linux-2.6.35-rc6/arch/xtensa/include/asm/unistd.h 2010-07-28 16:06:10.420451061 -0700
@@ -683,8 +683,10 @@
__SYSCALL(306, sys_eventfd, 1)
#define __NR_recvmmsg 307
@@ -304,10 +304,10 @@ Index: linux-2.6.35/arch/xtensa/include/asm/unistd.h
/*
* sysxtensa syscall handler
-Index: linux-2.6.35/fs/namespace.c
+Index: linux-2.6.35-rc6/fs/namespace.c
===================================================================
---- linux-2.6.35.orig/fs/namespace.c 2010-08-01 15:11:14.000000000 -0700
-+++ linux-2.6.35/fs/namespace.c 2010-08-03 16:40:55.637625497 -0700
+--- linux-2.6.35-rc6.orig/fs/namespace.c 2010-07-22 12:13:38.000000000 -0700
++++ linux-2.6.35-rc6/fs/namespace.c 2010-07-28 16:06:10.420451061 -0700
@@ -29,6 +29,7 @@
#include <linux/log2.h>
#include <linux/idr.h>
@@ -376,10 +376,10 @@ Index: linux-2.6.35/fs/namespace.c
+ .install = mntns_install,
+};
+
-Index: linux-2.6.35/fs/proc/Makefile
+Index: linux-2.6.35-rc6/fs/proc/Makefile
===================================================================
---- linux-2.6.35.orig/fs/proc/Makefile 2010-08-01 15:11:14.000000000 -0700
-+++ linux-2.6.35/fs/proc/Makefile 2010-08-03 16:40:55.637625497 -0700
+--- linux-2.6.35-rc6.orig/fs/proc/Makefile 2010-07-22 12:13:38.000000000 -0700
++++ linux-2.6.35-rc6/fs/proc/Makefile 2010-07-28 16:06:10.420451061 -0700
@@ -19,6 +19,7 @@
proc-y += uptime.o
proc-y += version.o
@@ -388,10 +388,10 @@ Index: linux-2.6.35/fs/proc/Makefile
proc-$(CONFIG_PROC_SYSCTL) += proc_sysctl.o
proc-$(CONFIG_NET) += proc_net.o
proc-$(CONFIG_PROC_KCORE) += kcore.o
-Index: linux-2.6.35/fs/proc/base.c
+Index: linux-2.6.35-rc6/fs/proc/base.c
===================================================================
---- linux-2.6.35.orig/fs/proc/base.c 2010-08-01 15:11:14.000000000 -0700
-+++ linux-2.6.35/fs/proc/base.c 2010-08-03 16:40:55.637625497 -0700
+--- linux-2.6.35-rc6.orig/fs/proc/base.c 2010-07-22 12:13:38.000000000 -0700
++++ linux-2.6.35-rc6/fs/proc/base.c 2010-07-28 16:06:10.430450661 -0700
@@ -552,7 +552,7 @@
return allowed;
}
@@ -480,14 +480,14 @@ Index: linux-2.6.35/fs/proc/base.c
static const struct pid_entry tid_base_stuff[] = {
DIR("fd", S_IRUSR|S_IXUSR, proc_fd_inode_operations, proc_fd_operations),
DIR("fdinfo", S_IRUSR|S_IXUSR, proc_fdinfo_inode_operations, proc_fdinfo_operations),
-+ DIR("ns", S_IRUSR|S_IXUGO, proc_ns_dir_inode_operations, proc_ns_dir_operations),
++ DIR("ns", S_IRUSR|S_IXUGO, proc_ns_dir_inode_operations, proc_ns_dir_operations),
REG("environ", S_IRUSR, proc_environ_operations),
INF("auxv", S_IRUSR, proc_pid_auxv),
ONE("status", S_IRUGO, proc_pid_status),
-Index: linux-2.6.35/fs/proc/inode.c
+Index: linux-2.6.35-rc6/fs/proc/inode.c
===================================================================
---- linux-2.6.35.orig/fs/proc/inode.c 2010-08-01 15:11:14.000000000 -0700
-+++ linux-2.6.35/fs/proc/inode.c 2010-08-03 16:40:55.637625497 -0700
+--- linux-2.6.35-rc6.orig/fs/proc/inode.c 2010-07-22 12:13:38.000000000 -0700
++++ linux-2.6.35-rc6/fs/proc/inode.c 2010-07-28 16:06:10.430450661 -0700
@@ -28,6 +28,7 @@
static void proc_delete_inode(struct inode *inode)
{
@@ -516,10 +516,10 @@ Index: linux-2.6.35/fs/proc/inode.c
inode = &ei->vfs_inode;
inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
return inode;
-Index: linux-2.6.35/fs/proc/internal.h
+Index: linux-2.6.35-rc6/fs/proc/internal.h
===================================================================
---- linux-2.6.35.orig/fs/proc/internal.h 2010-08-01 15:11:14.000000000 -0700
-+++ linux-2.6.35/fs/proc/internal.h 2010-08-03 16:40:55.637625497 -0700
+--- linux-2.6.35-rc6.orig/fs/proc/internal.h 2010-07-22 12:13:38.000000000 -0700
++++ linux-2.6.35-rc6/fs/proc/internal.h 2010-07-28 16:06:10.430450661 -0700
@@ -119,3 +119,21 @@
*/
int proc_readdir(struct file *, void *, filldir_t);
@@ -542,10 +542,10 @@ Index: linux-2.6.35/fs/proc/internal.h
+extern const struct inode_operations proc_ns_dir_inode_operations;
+extern const struct file_operations proc_ns_dir_operations;
+
-Index: linux-2.6.35/fs/proc/namespaces.c
+Index: linux-2.6.35-rc6/fs/proc/namespaces.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6.35/fs/proc/namespaces.c 2010-08-03 16:40:55.637625497 -0700
++++ linux-2.6.35-rc6/fs/proc/namespaces.c 2010-07-28 16:06:10.430450661 -0700
@@ -0,0 +1,196 @@
+#include <linux/proc_fs.h>
+#include <linux/nsproxy.h>
@@ -743,10 +743,10 @@ Index: linux-2.6.35/fs/proc/namespaces.c
+ return ERR_PTR(-EINVAL);
+}
+
-Index: linux-2.6.35/fs/proc/root.c
+Index: linux-2.6.35-rc6/fs/proc/root.c
===================================================================
---- linux-2.6.35.orig/fs/proc/root.c 2010-08-01 15:11:14.000000000 -0700
-+++ linux-2.6.35/fs/proc/root.c 2010-08-03 16:40:55.637625497 -0700
+--- linux-2.6.35-rc6.orig/fs/proc/root.c 2010-07-22 12:13:38.000000000 -0700
++++ linux-2.6.35-rc6/fs/proc/root.c 2010-07-28 16:06:10.430450661 -0700
@@ -43,21 +43,10 @@
struct pid_namespace *ns;
struct proc_inode *ei;
@@ -796,10 +796,10 @@ Index: linux-2.6.35/fs/proc/root.c
simple_set_mnt(mnt, sb);
return 0;
}
-Index: linux-2.6.35/include/linux/pid_namespace.h
+Index: linux-2.6.35-rc6/include/linux/pid_namespace.h
===================================================================
---- linux-2.6.35.orig/include/linux/pid_namespace.h 2010-08-01 15:11:14.000000000 -0700
-+++ linux-2.6.35/include/linux/pid_namespace.h 2010-08-03 16:40:55.637625497 -0700
+--- linux-2.6.35-rc6.orig/include/linux/pid_namespace.h 2010-07-22 12:13:38.000000000 -0700
++++ linux-2.6.35-rc6/include/linux/pid_namespace.h 2010-07-28 16:06:10.430450661 -0700
@@ -20,6 +20,7 @@
struct kref kref;
struct pidmap pidmap[PIDMAP_ENTRIES];
@@ -835,10 +835,10 @@ Index: linux-2.6.35/include/linux/pid_namespace.h
}
static inline void put_pid_ns(struct pid_namespace *ns)
-Index: linux-2.6.35/include/linux/proc_fs.h
+Index: linux-2.6.35-rc6/include/linux/proc_fs.h
===================================================================
---- linux-2.6.35.orig/include/linux/proc_fs.h 2010-08-01 15:11:14.000000000 -0700
-+++ linux-2.6.35/include/linux/proc_fs.h 2010-08-03 16:40:55.637625497 -0700
+--- linux-2.6.35-rc6.orig/include/linux/proc_fs.h 2010-07-22 12:13:38.000000000 -0700
++++ linux-2.6.35-rc6/include/linux/proc_fs.h 2010-07-28 16:06:10.430450661 -0700
@@ -250,6 +250,25 @@
extern void kclist_add(struct kcore_list *, void *, size_t, int type);
#endif
@@ -874,10 +874,10 @@ Index: linux-2.6.35/include/linux/proc_fs.h
struct inode vfs_inode;
};
-Index: linux-2.6.35/init/main.c
+Index: linux-2.6.35-rc6/init/main.c
===================================================================
---- linux-2.6.35.orig/init/main.c 2010-08-01 15:11:14.000000000 -0700
-+++ linux-2.6.35/init/main.c 2010-08-03 16:40:55.637625497 -0700
+--- linux-2.6.35-rc6.orig/init/main.c 2010-07-22 12:13:38.000000000 -0700
++++ linux-2.6.35-rc6/init/main.c 2010-07-28 16:06:10.430450661 -0700
@@ -879,15 +879,6 @@
* init can run on any cpu.
*/
@@ -894,10 +894,10 @@ Index: linux-2.6.35/init/main.c
cad_pid = task_pid(current);
-Index: linux-2.6.35/ipc/namespace.c
+Index: linux-2.6.35-rc6/ipc/namespace.c
===================================================================
---- linux-2.6.35.orig/ipc/namespace.c 2010-08-01 15:11:14.000000000 -0700
-+++ linux-2.6.35/ipc/namespace.c 2010-08-03 16:40:55.637625497 -0700
+--- linux-2.6.35-rc6.orig/ipc/namespace.c 2010-07-22 12:13:38.000000000 -0700
++++ linux-2.6.35-rc6/ipc/namespace.c 2010-07-28 16:06:10.430450661 -0700
@@ -11,6 +11,7 @@
#include <linux/slab.h>
#include <linux/fs.h>
@@ -940,10 +940,10 @@ Index: linux-2.6.35/ipc/namespace.c
+ .put = ipcns_put,
+ .install = ipcns_install,
+};
-Index: linux-2.6.35/kernel/cgroup.c
+Index: linux-2.6.35-rc6/kernel/cgroup.c
===================================================================
---- linux-2.6.35.orig/kernel/cgroup.c 2010-08-01 15:11:14.000000000 -0700
-+++ linux-2.6.35/kernel/cgroup.c 2010-08-03 16:40:55.637625497 -0700
+--- linux-2.6.35-rc6.orig/kernel/cgroup.c 2010-07-22 12:13:38.000000000 -0700
++++ linux-2.6.35-rc6/kernel/cgroup.c 2010-07-28 16:06:10.430450661 -0700
@@ -2650,7 +2650,7 @@
{
struct cgroup_pidlist *l;
@@ -953,10 +953,10 @@ Index: linux-2.6.35/kernel/cgroup.c
/*
* We can't drop the pidlist_mutex before taking the l->mutex in case
-Index: linux-2.6.35/kernel/fork.c
+Index: linux-2.6.35-rc6/kernel/fork.c
===================================================================
---- linux-2.6.35.orig/kernel/fork.c 2010-08-01 15:11:14.000000000 -0700
-+++ linux-2.6.35/kernel/fork.c 2010-08-03 16:40:55.644559010 -0700
+--- linux-2.6.35-rc6.orig/kernel/fork.c 2010-07-22 12:13:38.000000000 -0700
++++ linux-2.6.35-rc6/kernel/fork.c 2010-07-28 16:06:10.430450661 -0700
@@ -1154,12 +1154,6 @@
pid = alloc_pid(p->nsproxy->pid_ns);
if (!pid)
@@ -989,10 +989,10 @@ Index: linux-2.6.35/kernel/fork.c
goto bad_unshare_out;
/*
-Index: linux-2.6.35/kernel/nsproxy.c
+Index: linux-2.6.35-rc6/kernel/nsproxy.c
===================================================================
---- linux-2.6.35.orig/kernel/nsproxy.c 2010-08-01 15:11:14.000000000 -0700
-+++ linux-2.6.35/kernel/nsproxy.c 2010-08-03 16:40:55.644559010 -0700
+--- linux-2.6.35-rc6.orig/kernel/nsproxy.c 2010-07-22 12:13:38.000000000 -0700
++++ linux-2.6.35-rc6/kernel/nsproxy.c 2010-07-28 16:06:10.430450661 -0700
@@ -22,6 +22,9 @@
#include <linux/pid_namespace.h>
#include <net/net_namespace.h>
@@ -1065,10 +1065,10 @@ Index: linux-2.6.35/kernel/nsproxy.c
static int __init nsproxy_cache_init(void)
{
nsproxy_cachep = KMEM_CACHE(nsproxy, SLAB_PANIC);
-Index: linux-2.6.35/kernel/perf_event.c
+Index: linux-2.6.35-rc6/kernel/perf_event.c
===================================================================
---- linux-2.6.35.orig/kernel/perf_event.c 2010-08-01 15:11:14.000000000 -0700
-+++ linux-2.6.35/kernel/perf_event.c 2010-08-03 16:40:55.669610546 -0700
+--- linux-2.6.35-rc6.orig/kernel/perf_event.c 2010-07-22 12:13:38.000000000 -0700
++++ linux-2.6.35-rc6/kernel/perf_event.c 2010-07-28 16:06:10.430450661 -0700
@@ -4843,7 +4843,7 @@
event->parent = parent_event;
@@ -1078,10 +1078,10 @@ Index: linux-2.6.35/kernel/perf_event.c
event->id = atomic64_inc_return(&perf_event_id);
event->state = PERF_EVENT_STATE_INACTIVE;
-Index: linux-2.6.35/kernel/pid.c
+Index: linux-2.6.35-rc6/kernel/pid.c
===================================================================
---- linux-2.6.35.orig/kernel/pid.c 2010-08-01 15:11:14.000000000 -0700
-+++ linux-2.6.35/kernel/pid.c 2010-08-03 16:40:55.669610546 -0700
+--- linux-2.6.35-rc6.orig/kernel/pid.c 2010-07-22 12:13:38.000000000 -0700
++++ linux-2.6.35-rc6/kernel/pid.c 2010-07-28 16:06:10.430450661 -0700
@@ -248,6 +248,10 @@
struct pid_namespace *tmp;
struct upid *upid;
@@ -1129,18 +1129,18 @@ Index: linux-2.6.35/kernel/pid.c
if (likely(pid_alive(task))) {
if (type != PIDTYPE_PID)
task = task->group_leader;
-Index: linux-2.6.35/kernel/pid_namespace.c
+Index: linux-2.6.35-rc6/kernel/pid_namespace.c
===================================================================
---- linux-2.6.35.orig/kernel/pid_namespace.c 2010-08-01 15:11:14.000000000 -0700
-+++ linux-2.6.35/kernel/pid_namespace.c 2010-08-03 16:40:55.669610546 -0700
-@@ -14,6 +14,7 @@
+--- linux-2.6.35-rc6.orig/kernel/pid_namespace.c 2010-07-22 12:13:38.000000000 -0700
++++ linux-2.6.35-rc6/kernel/pid_namespace.c 2010-07-28 16:06:10.430450661 -0700
+@@ -13,6 +13,7 @@
+ #include <linux/syscalls.h>
#include <linux/err.h>
#include <linux/acct.h>
- #include <linux/slab.h>
+#include <linux/proc_fs.h>
+ #include <linux/slab.h>
#define BITS_PER_PAGE (PAGE_SIZE*8)
-
@@ -89,6 +90,7 @@
kref_init(&ns->kref);
ns->level = level;
@@ -1220,10 +1220,10 @@ Index: linux-2.6.35/kernel/pid_namespace.c
static __init int pid_namespaces_init(void)
{
pid_ns_cachep = KMEM_CACHE(pid_namespace, SLAB_PANIC);
-Index: linux-2.6.35/kernel/signal.c
+Index: linux-2.6.35-rc6/kernel/signal.c
===================================================================
---- linux-2.6.35.orig/kernel/signal.c 2010-08-01 15:11:14.000000000 -0700
-+++ linux-2.6.35/kernel/signal.c 2010-08-03 16:40:55.669610546 -0700
+--- linux-2.6.35-rc6.orig/kernel/signal.c 2010-07-22 12:13:38.000000000 -0700
++++ linux-2.6.35-rc6/kernel/signal.c 2010-07-28 16:06:10.430450661 -0700
@@ -1458,16 +1458,15 @@
* we are under tasklist_lock here so our parent is tied to
* us and cannot exit and release its namespace.
@@ -1253,10 +1253,10 @@ Index: linux-2.6.35/kernel/signal.c
info.si_uid = __task_cred(tsk)->uid;
rcu_read_unlock();
-Index: linux-2.6.35/kernel/sysctl_binary.c
+Index: linux-2.6.35-rc6/kernel/sysctl_binary.c
===================================================================
---- linux-2.6.35.orig/kernel/sysctl_binary.c 2010-08-01 15:11:14.000000000 -0700
-+++ linux-2.6.35/kernel/sysctl_binary.c 2010-08-03 16:40:55.669610546 -0700
+--- linux-2.6.35-rc6.orig/kernel/sysctl_binary.c 2010-07-22 12:13:38.000000000 -0700
++++ linux-2.6.35-rc6/kernel/sysctl_binary.c 2010-07-28 16:06:10.430450661 -0700
@@ -1350,7 +1350,7 @@
goto out_putname;
}
@@ -1266,10 +1266,10 @@ Index: linux-2.6.35/kernel/sysctl_binary.c
result = vfs_path_lookup(mnt->mnt_root, mnt, pathname, 0, &nd);
if (result)
goto out_putname;
-Index: linux-2.6.35/kernel/utsname.c
+Index: linux-2.6.35-rc6/kernel/utsname.c
===================================================================
---- linux-2.6.35.orig/kernel/utsname.c 2010-08-01 15:11:14.000000000 -0700
-+++ linux-2.6.35/kernel/utsname.c 2010-08-03 16:40:55.669610546 -0700
+--- linux-2.6.35-rc6.orig/kernel/utsname.c 2010-07-22 12:13:38.000000000 -0700
++++ linux-2.6.35-rc6/kernel/utsname.c 2010-07-28 16:06:10.430450661 -0700
@@ -14,6 +14,7 @@
#include <linux/utsname.h>
#include <linux/err.h>
@@ -1313,10 +1313,10 @@ Index: linux-2.6.35/kernel/utsname.c
+ .install = utsns_install,
+};
+
-Index: linux-2.6.35/net/core/net_namespace.c
+Index: linux-2.6.35-rc6/net/core/net_namespace.c
===================================================================
---- linux-2.6.35.orig/net/core/net_namespace.c 2010-08-01 15:11:14.000000000 -0700
-+++ linux-2.6.35/net/core/net_namespace.c 2010-08-03 16:40:55.669610546 -0700
+--- linux-2.6.35-rc6.orig/net/core/net_namespace.c 2010-07-22 12:13:38.000000000 -0700
++++ linux-2.6.35-rc6/net/core/net_namespace.c 2010-07-28 16:06:47.380462171 -0700
@@ -571,3 +571,33 @@
mutex_unlock(&net_mutex);
}
View
11 patches/README
@@ -1,11 +0,0 @@
-git clone git://git.openvz.org/pub/linux-2.6.18-openvz
-cd linux-2.6.18-openvz
-patch -p1 < etunpatch-2.6.18-openvz.diff
-patch -p1 < enable-promisc-default.diff
-
-For 2.6.35 kernel, lxc-attach needs the patches
-in lxc-attach-enable.
-
-$ cd /usr/src/linux-2.6.35/
-$ patch -p1 < /path/to/lxc-attach-enable/0001-nsfd-v5.patch
-
View
30 ...g-setns-sycall-for-powerpc-and-s390.patch → ...ing-setns-sycall-for-powerpc-&-s390.patch
@@ -13,19 +13,19 @@ Signed-off-by: Michel Normand <normand@fr.ibm.com>
arch/s390/kernel/syscalls.S | 1 +
5 files changed, 13 insertions(+), 2 deletions(-)
-Index: 2.6.35-rc6/arch/powerpc/include/asm/systbl.h
+Index: 2.6.33/arch/powerpc/include/asm/systbl.h
===================================================================
---- 2.6.35-rc6.orig/arch/powerpc/include/asm/systbl.h
-+++ 2.6.35-rc6/arch/powerpc/include/asm/systbl.h
+--- 2.6.33.orig/arch/powerpc/include/asm/systbl.h
++++ 2.6.33/arch/powerpc/include/asm/systbl.h
@@ -326,3 +326,4 @@ SYSCALL_SPU(perf_event_open)
COMPAT_SYS_SPU(preadv)
COMPAT_SYS_SPU(pwritev)
COMPAT_SYS(rt_tgsigqueueinfo)
+SYSCALL(setns)
-Index: 2.6.35-rc6/arch/powerpc/include/asm/unistd.h
+Index: 2.6.33/arch/powerpc/include/asm/unistd.h
===================================================================
---- 2.6.35-rc6.orig/arch/powerpc/include/asm/unistd.h
-+++ 2.6.35-rc6/arch/powerpc/include/asm/unistd.h
+--- 2.6.33.orig/arch/powerpc/include/asm/unistd.h
++++ 2.6.33/arch/powerpc/include/asm/unistd.h
@@ -345,10 +345,11 @@
#define __NR_preadv 320
#define __NR_pwritev 321
@@ -39,10 +39,10 @@ Index: 2.6.35-rc6/arch/powerpc/include/asm/unistd.h
#define __NR__exit __NR_exit
#define NR_syscalls __NR_syscalls
-Index: 2.6.35-rc6/arch/s390/include/asm/unistd.h
+Index: 2.6.33/arch/s390/include/asm/unistd.h
===================================================================
---- 2.6.35-rc6.orig/arch/s390/include/asm/unistd.h
-+++ 2.6.35-rc6/arch/s390/include/asm/unistd.h
+--- 2.6.33.orig/arch/s390/include/asm/unistd.h
++++ 2.6.33/arch/s390/include/asm/unistd.h
@@ -269,7 +269,8 @@
#define __NR_pwritev 329
#define __NR_rt_tgsigqueueinfo 330
@@ -53,10 +53,10 @@ Index: 2.6.35-rc6/arch/s390/include/asm/unistd.h
/*
* There are some system calls that are not present on 64 bit, some
-Index: 2.6.35-rc6/arch/s390/kernel/compat_wrapper.S
+Index: 2.6.33/arch/s390/kernel/compat_wrapper.S
===================================================================
---- 2.6.35-rc6.orig/arch/s390/kernel/compat_wrapper.S
-+++ 2.6.35-rc6/arch/s390/kernel/compat_wrapper.S
+--- 2.6.33.orig/arch/s390/kernel/compat_wrapper.S
++++ 2.6.33/arch/s390/kernel/compat_wrapper.S
@@ -1853,3 +1853,10 @@ sys32_execve_wrapper:
llgtr %r3,%r3 # compat_uptr_t *
llgtr %r4,%r4 # compat_uptr_t *
@@ -68,10 +68,10 @@ Index: 2.6.35-rc6/arch/s390/kernel/compat_wrapper.S
+ llgtr %r3,%r3 # int
+ jg sys_setns
+
-Index: 2.6.35-rc6/arch/s390/kernel/syscalls.S
+Index: 2.6.33/arch/s390/kernel/syscalls.S
===================================================================
---- 2.6.35-rc6.orig/arch/s390/kernel/syscalls.S
-+++ 2.6.35-rc6/arch/s390/kernel/syscalls.S
+--- 2.6.33.orig/arch/s390/kernel/syscalls.S
++++ 2.6.33/arch/s390/kernel/syscalls.S
@@ -340,3 +340,4 @@ SYSCALL(sys_preadv,sys_preadv,compat_sys
SYSCALL(sys_pwritev,sys_pwritev,compat_sys_pwritev_wrapper)
SYSCALL(sys_rt_tgsigqueueinfo,sys_rt_tgsigqueueinfo,compat_sys_rt_tgsigqueueinfo_wrapper) /* 330 */
View
10 patches/add-missing-setns-syscall-for-mips.patch
@@ -0,0 +1,10 @@
+Index: linux-2.6.35/arch/mips/kernel/scall64-n32.S
+===================================================================
+--- linux-2.6.35.orig/arch/mips/kernel/scall64-n32.S 2010-08-15 17:44:44.723500284 -0700
++++ linux-2.6.35/arch/mips/kernel/scall64-n32.S 2010-08-15 17:45:58.455394258 -0700
+@@ -420,4 +420,5 @@
+ PTR sys_accept4
+ PTR compat_sys_recvmmsg
+ PTR sys_getdents
++ PTR sys_setns
+ .size sysn32_call_table,.-sysn32_call_table
View
456 patches/cfs-bw-control-1.patch
@@ -0,0 +1,456 @@
+In this patch we introduce the notion of CFS bandwidth, to account for the
+realities of SMP this is partitioned into globally unassigned bandwidth, and
+locally claimed bandwidth:
+- The global bandwidth is per task_group, it represents a pool of unclaimed
+ bandwidth that cfs_rq's can allocate from. It uses the new cfs_bandwidth
+ structure.
+- The local bandwidth is tracked per-cfs_rq, this represents allotments from
+ the global pool
+ bandwidth assigned to a task_group, this is tracked using the
+ new cfs_bandwidth structure.
+
+Bandwidth is managed via cgroupfs via two new files in the cpu subsystem:
+- cpu.cfs_period_us : the bandwidth period in usecs
+- cpu.cfs_quota_us : the cpu bandwidth (in usecs) that this tg will be allowed
+ to consume over period above.
+
+A per-cfs_bandwidth timer is also introduced to handle future refresh at
+period expiration. There's some minor refactoring here so that
+start_bandwidth_timer() functionality can be shared
+
+Signed-off-by: Paul Turner <pjt@google.com>
+Signed-off-by: Nikhil Rao <ncrao@google.com>
+Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
+---
+ init/Kconfig | 9 +
+ kernel/sched.c | 271 +++++++++++++++++++++++++++++++++++++++++++++++-----
+ kernel/sched_fair.c | 10 +
+ 3 files changed, 268 insertions(+), 22 deletions(-)
+
+--- a/init/Kconfig
++++ b/init/Kconfig
+@@ -605,6 +605,15 @@ config FAIR_GROUP_SCHED
+ depends on CGROUP_SCHED
+ default CGROUP_SCHED
+
++config CFS_BANDWIDTH
++ bool "CPU bandwidth provisioning for FAIR_GROUP_SCHED"
++ depends on EXPERIMENTAL
++ depends on FAIR_GROUP_SCHED
++ default n
++ help
++ This option allows users to define quota and period for cpu
++ bandwidth provisioning on a per-cgroup basis.
++
+ config RT_GROUP_SCHED
+ bool "Group scheduling for SCHED_RR/FIFO"
+ depends on EXPERIMENTAL
+--- a/kernel/sched.c
++++ b/kernel/sched.c
+@@ -191,10 +191,28 @@ static inline int rt_bandwidth_enabled(v
+ return sysctl_sched_rt_runtime >= 0;
+ }
+
+-static void start_rt_bandwidth(struct rt_bandwidth *rt_b)
++static void start_bandwidth_timer(struct hrtimer *period_timer, ktime_t period)
+ {
+- ktime_t now;
++ unsigned long delta;
++ ktime_t soft, hard, now;
++
++ for (;;) {
++ if (hrtimer_active(period_timer))
++ break;
+
++ now = hrtimer_cb_get_time(period_timer);
++ hrtimer_forward(period_timer, now, period);
++
++ soft = hrtimer_get_softexpires(period_timer);
++ hard = hrtimer_get_expires(period_timer);
++ delta = ktime_to_ns(ktime_sub(hard, soft));
++ __hrtimer_start_range_ns(period_timer, soft, delta,
++ HRTIMER_MODE_ABS_PINNED, 0);
++ }
++}
++
++static void start_rt_bandwidth(struct rt_bandwidth *rt_b)
++{
+ if (!rt_bandwidth_enabled() || rt_b->rt_runtime == RUNTIME_INF)
+ return;
+
+@@ -202,22 +220,7 @@ static void start_rt_bandwidth(struct rt
+ return;
+
+ raw_spin_lock(&rt_b->rt_runtime_lock);
+- for (;;) {
+- unsigned long delta;
+- ktime_t soft, hard;
+-
+- if (hrtimer_active(&rt_b->rt_period_timer))
+- break;
+-
+- now = hrtimer_cb_get_time(&rt_b->rt_period_timer);
+- hrtimer_forward(&rt_b->rt_period_timer, now, rt_b->rt_period);
+-
+- soft = hrtimer_get_softexpires(&rt_b->rt_period_timer);
+- hard = hrtimer_get_expires(&rt_b->rt_period_timer);
+- delta = ktime_to_ns(ktime_sub(hard, soft));
+- __hrtimer_start_range_ns(&rt_b->rt_period_timer, soft, delta,
+- HRTIMER_MODE_ABS_PINNED, 0);
+- }
++ start_bandwidth_timer(&rt_b->rt_period_timer, rt_b->rt_period);
+ raw_spin_unlock(&rt_b->rt_runtime_lock);
+ }
+
+@@ -242,6 +245,15 @@ struct cfs_rq;
+
+ static LIST_HEAD(task_groups);
+
++#ifdef CONFIG_CFS_BANDWIDTH
++struct cfs_bandwidth {
++ raw_spinlock_t lock;
++ ktime_t period;
++ u64 runtime, quota;
++ struct hrtimer period_timer;
++};
++#endif
++
+ /* task group related information */
+ struct task_group {
+ struct cgroup_subsys_state css;
+@@ -267,6 +279,10 @@ struct task_group {
+ struct task_group *parent;
+ struct list_head siblings;
+ struct list_head children;
++
++#ifdef CONFIG_CFS_BANDWIDTH
++ struct cfs_bandwidth cfs_bandwidth;
++#endif
+ };
+
+ #define root_task_group init_task_group
+@@ -368,9 +384,76 @@ struct cfs_rq {
+ */
+ unsigned long rq_weight;
+ #endif
++#ifdef CONFIG_CFS_BANDWIDTH
++ u64 quota_assigned, quota_used;
++#endif
+ #endif
+ };
+
++#ifdef CONFIG_CFS_BANDWIDTH
++static int do_sched_cfs_period_timer(struct cfs_bandwidth *cfs_b, int overrun);
++
++static enum hrtimer_restart sched_cfs_period_timer(struct hrtimer *timer)
++{
++ struct cfs_bandwidth *cfs_b =
++ container_of(timer, struct cfs_bandwidth, period_timer);
++ ktime_t now;
++ int overrun;
++ int idle = 0;
++
++ for (;;) {
++ now = hrtimer_cb_get_time(timer);
++ overrun = hrtimer_forward(timer, now, cfs_b->period);
++
++ if (!overrun)
++ break;
++
++ idle = do_sched_cfs_period_timer(cfs_b, overrun);
++ }
++
++ return idle ? HRTIMER_NORESTART : HRTIMER_RESTART;
++}
++
++static
++void init_cfs_bandwidth(struct cfs_bandwidth *cfs_b, u64 quota, u64 period)
++{
++ raw_spin_lock_init(&cfs_b->lock);
++ cfs_b->quota = cfs_b->runtime = quota;
++ cfs_b->period = ns_to_ktime(period);
++
++ hrtimer_init(&cfs_b->period_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
++ cfs_b->period_timer.function = sched_cfs_period_timer;
++}
++
++static
++void init_cfs_rq_quota(struct cfs_rq *cfs_rq)
++{
++ cfs_rq->quota_used = 0;
++ if (cfs_rq->tg->cfs_bandwidth.quota == RUNTIME_INF)
++ cfs_rq->quota_assigned = RUNTIME_INF;
++ else
++ cfs_rq->quota_assigned = 0;
++}
++
++static void start_cfs_bandwidth(struct cfs_bandwidth *cfs_b)
++{
++ if (cfs_b->quota == RUNTIME_INF)
++ return;
++
++ if (hrtimer_active(&cfs_b->period_timer))
++ return;
++
++ raw_spin_lock(&cfs_b->lock);
++ start_bandwidth_timer(&cfs_b->period_timer, cfs_b->period);
++ raw_spin_unlock(&cfs_b->lock);
++}
++
++static void destroy_cfs_bandwidth(struct cfs_bandwidth *cfs_b)
++{
++ hrtimer_cancel(&cfs_b->period_timer);
++}
++#endif
++
+ /* Real-Time classes' related field in a runqueue: */
+ struct rt_rq {
+ struct rt_prio_array active;
+@@ -1822,6 +1905,14 @@ static inline void __set_task_cpu(struct
+
+ static const struct sched_class rt_sched_class;
+
++#ifdef CONFIG_CFS_BANDWIDTH
++/*
++ * default period for cfs group bandwidth.
++ * default: 0.5s
++ */
++static u64 sched_cfs_bandwidth_period = 500000000ULL;
++#endif
++
+ #define sched_class_highest (&rt_sched_class)
+ #define for_each_class(class) \
+ for (class = sched_class_highest; class; class = class->next)
+@@ -7445,6 +7536,9 @@ static void init_tg_cfs_entry(struct tas
+ tg->cfs_rq[cpu] = cfs_rq;
+ init_cfs_rq(cfs_rq, rq);
+ cfs_rq->tg = tg;
++#ifdef CONFIG_CFS_BANDWIDTH
++ init_cfs_rq_quota(cfs_rq);
++#endif
+ if (add)
+ list_add(&cfs_rq->leaf_cfs_rq_list, &rq->leaf_cfs_rq_list);
+
+@@ -7590,6 +7684,10 @@ void __init sched_init(void)
+ * We achieve this by letting init_task_group's tasks sit
+ * directly in rq->cfs (i.e init_task_group->se[] = NULL).
+ */
++#ifdef CONFIG_CFS_BANDWIDTH
++ init_cfs_bandwidth(&init_task_group.cfs_bandwidth,
++ RUNTIME_INF, sched_cfs_bandwidth_period);
++#endif
+ init_tg_cfs_entry(&init_task_group, &rq->cfs, NULL, i, 1, NULL);
+ #endif
+ #endif /* CONFIG_FAIR_GROUP_SCHED */
+@@ -7823,6 +7921,10 @@ static void free_fair_sched_group(struct
+ {
+ int i;
+
++#ifdef CONFIG_CFS_BANDWIDTH
++ destroy_cfs_bandwidth(&tg->cfs_bandwidth);
++#endif
++
+ for_each_possible_cpu(i) {
+ if (tg->cfs_rq)
+ kfree(tg->cfs_rq[i]);
+@@ -7850,7 +7952,10 @@ int alloc_fair_sched_group(struct task_g
+ goto err;
+
+ tg->shares = NICE_0_LOAD;
+-
++#ifdef CONFIG_CFS_BANDWIDTH
++ init_cfs_bandwidth(&tg->cfs_bandwidth, RUNTIME_INF,
++ sched_cfs_bandwidth_period);
++#endif
+ for_each_possible_cpu(i) {
+ rq = cpu_rq(i);
+
+@@ -8296,7 +8401,7 @@ static int __rt_schedulable(struct task_
+ return walk_tg_tree(tg_schedulable, tg_nop, &data);
+ }
+
+-static int tg_set_bandwidth(struct task_group *tg,
++static int tg_set_rt_bandwidth(struct task_group *tg,
+ u64 rt_period, u64 rt_runtime)
+ {
+ int i, err = 0;
+@@ -8335,7 +8440,7 @@ int sched_group_set_rt_runtime(struct ta
+ if (rt_runtime_us < 0)
+ rt_runtime = RUNTIME_INF;
+
+- return tg_set_bandwidth(tg, rt_period, rt_runtime);
++ return tg_set_rt_bandwidth(tg, rt_period, rt_runtime);
+ }
+
+ long sched_group_rt_runtime(struct task_group *tg)
+@@ -8360,7 +8465,7 @@ int sched_group_set_rt_period(struct tas
+ if (rt_period == 0)
+ return -EINVAL;
+
+- return tg_set_bandwidth(tg, rt_period, rt_runtime);
++ return tg_set_rt_bandwidth(tg, rt_period, rt_runtime);
+ }
+
+ long sched_group_rt_period(struct task_group *tg)
+@@ -8567,6 +8672,116 @@ static u64 cpu_shares_read_u64(struct cg
+
+ return (u64) tg->shares;
+ }
++
++#ifdef CONFIG_CFS_BANDWIDTH
++static int tg_set_cfs_bandwidth(struct task_group *tg, u64 period, u64 quota)
++{
++ int i;
++ static DEFINE_MUTEX(mutex);
++
++ if (tg == &init_task_group)
++ return -EINVAL;
++
++ if (!period)
++ return -EINVAL;
++
++ /*
++ * Ensure we have at least one tick of bandwidth every period. This is
++ * to prevent reaching a state of large arrears when throttled via
++ * entity_tick() resulting in prolonged exit starvation.
++ */
++ if (NS_TO_JIFFIES(quota) < 1)
++ return -EINVAL;
++
++ mutex_lock(&mutex);
++ raw_spin_lock_irq(&tg->cfs_bandwidth.lock);
++ tg->cfs_bandwidth.period = ns_to_ktime(period);
++ tg->cfs_bandwidth.runtime = tg->cfs_bandwidth.quota = quota;
++ raw_spin_unlock_irq(&tg->cfs_bandwidth.lock);
++
++ for_each_possible_cpu(i) {
++ struct cfs_rq *cfs_rq = tg->cfs_rq[i];
++ struct rq *rq = rq_of(cfs_rq);
++
++ raw_spin_lock_irq(&rq->lock);
++ init_cfs_rq_quota(cfs_rq);
++ raw_spin_unlock_irq(&rq->lock);
++ }
++ mutex_unlock(&mutex);
++
++ return 0;
++}
++
++int tg_set_cfs_quota(struct task_group *tg, long cfs_runtime_us)
++{
++ u64 quota, period;
++
++ period = ktime_to_ns(tg->cfs_bandwidth.period);
++ if (cfs_runtime_us < 0)
++ quota = RUNTIME_INF;
++ else
++ quota = (u64)cfs_runtime_us * NSEC_PER_USEC;
++
++ return tg_set_cfs_bandwidth(tg, period, quota);
++}
++
++long tg_get_cfs_quota(struct task_group *tg)
++{
++ u64 quota_us;
++
++ if (tg->cfs_bandwidth.quota == RUNTIME_INF)
++ return -1;
++
++ quota_us = tg->cfs_bandwidth.quota;
++ do_div(quota_us, NSEC_PER_USEC);
++ return quota_us;
++}
++
++int tg_set_cfs_period(struct task_group *tg, long cfs_period_us)
++{
++ u64 quota, period;
++
++ period = (u64)cfs_period_us * NSEC_PER_USEC;
++ quota = tg->cfs_bandwidth.quota;
++
++ if (period <= 0)
++ return -EINVAL;
++
++ return tg_set_cfs_bandwidth(tg, period, quota);
++}
++
++long tg_get_cfs_period(struct task_group *tg)
++{
++ u64 cfs_period_us;
++
++ cfs_period_us = ktime_to_ns(tg->cfs_bandwidth.period);
++ do_div(cfs_period_us, NSEC_PER_USEC);
++ return cfs_period_us;
++}
++
++static s64 cpu_cfs_quota_read_s64(struct cgroup *cgrp, struct cftype *cft)
++{
++ return tg_get_cfs_quota(cgroup_tg(cgrp));
++}
++
++static int cpu_cfs_quota_write_s64(struct cgroup *cgrp, struct cftype *cftype,
++ s64 cfs_quota_us)
++{
++ return tg_set_cfs_quota(cgroup_tg(cgrp), cfs_quota_us);
++}
++
++static u64 cpu_cfs_period_read_u64(struct cgroup *cgrp, struct cftype *cft)
++{
++ return tg_get_cfs_period(cgroup_tg(cgrp));
++}
++
++static int cpu_cfs_period_write_u64(struct cgroup *cgrp, struct cftype *cftype,
++ u64 cfs_period_us)
++{
++ return tg_set_cfs_period(cgroup_tg(cgrp), cfs_period_us);
++}
++
++#endif /* CONFIG_CFS_BANDWIDTH */
+ #endif /* CONFIG_FAIR_GROUP_SCHED */
+
+ #ifdef CONFIG_RT_GROUP_SCHED
+@@ -8601,6 +8816,18 @@ static struct cftype cpu_files[] = {
+ .write_u64 = cpu_shares_write_u64,
+ },
+ #endif
++#ifdef CONFIG_CFS_BANDWIDTH
++ {
++ .name = "cfs_quota_us",
++ .read_s64 = cpu_cfs_quota_read_s64,
++ .write_s64 = cpu_cfs_quota_write_s64,
++ },
++ {
++ .name = "cfs_period_us",
++ .read_u64 = cpu_cfs_period_read_u64,
++ .write_u64 = cpu_cfs_period_write_u64,
++ },
++#endif
+ #ifdef CONFIG_RT_GROUP_SCHED
+ {
+ .name = "rt_runtime_us",
+--- a/kernel/sched_fair.c
++++ b/kernel/sched_fair.c
+@@ -360,6 +360,9 @@ static void __enqueue_entity(struct cfs_
+
+ rb_link_node(&se->run_node, parent, link);
+ rb_insert_color(&se->run_node, &cfs_rq->tasks_timeline);
++#ifdef CONFIG_CFS_BANDWIDTH
++ start_cfs_bandwidth(&cfs_rq->tg->cfs_bandwidth);
++#endif
+ }
+
+ static void __dequeue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se)
+@@ -1126,6 +1129,13 @@ static void yield_task_fair(struct rq *r
+ se->vruntime = rightmost->vruntime + 1;
+ }
+
++#ifdef CONFIG_CFS_BANDWIDTH
++static int do_sched_cfs_period_timer(struct cfs_bandwidth *cfs_b, int overrun)
++{
++ return 1;
++}
++#endif
++
+ #ifdef CONFIG_SMP
+
+ static void task_waking_fair(struct rq *rq, struct task_struct *p)
View
149 patches/cfs-bw-control-2.patch
@@ -0,0 +1,149 @@
+Introduce account_cfs_rq_quota() to account bandwidth usage on the cfs_rq
+level versus task_groups for which bandwidth has been assigned. This is
+tracked by whether the local cfs_rq->quota_assigned is finite or infinite
+(RUNTIME_INF).
+
+For cfs_rq's that belong to a bandwidth constrained task_group we introduce
+tg_request_cfs_quota() which attempts to allocate quota from the global pool
+for use locally. Updates involving the global pool are currently protected
+under cfs_bandwidth->lock, local pools are protected by rq->lock.
+
+This patch only attempts to assign and track quota, no action is taken in the
+case that cfs_rq->quota_used exceeds cfs_rq->quota_assigned.
+
+Signed-off-by: Paul Turner <pjt@google.com>
+Signed-off-by: Nikhil Rao <ncrao@google.com>
+---
+ include/linux/sched.h | 4 ++++
+ kernel/sched.c | 13 +++++++++++++
+ kernel/sched_fair.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
+ kernel/sysctl.c | 10 ++++++++++
+ 4 files changed, 77 insertions(+)
+
+--- a/include/linux/sched.h
++++ b/include/linux/sched.h
+@@ -1902,6 +1902,10 @@ int sched_rt_handler(struct ctl_table *t
+ void __user *buffer, size_t *lenp,
+ loff_t *ppos);
+
++#ifdef CONFIG_CFS_BANDWIDTH
++extern unsigned int sysctl_sched_cfs_bandwidth_slice;
++#endif
++
+ extern unsigned int sysctl_sched_compat_yield;
+
+ #ifdef CONFIG_RT_MUTEXES
+--- a/kernel/sched.c
++++ b/kernel/sched.c
+@@ -1911,6 +1911,19 @@ static const struct sched_class rt_sched
+ * default: 0.5s
+ */
+ static u64 sched_cfs_bandwidth_period = 500000000ULL;
++
++/*
++ * default slice of quota to allocate from global tg to local cfs_rq pool on
++ * each refresh
++ * default: 10ms
++ */
++unsigned int sysctl_sched_cfs_bandwidth_slice = 10000UL;
++
++static inline u64 sched_cfs_bandwidth_slice(void)
++{
++ return (u64)sysctl_sched_cfs_bandwidth_slice * NSEC_PER_USEC;
++}
++
+ #endif
+
+ #define sched_class_highest (&rt_sched_class)
+--- a/kernel/sched_fair.c
++++ b/kernel/sched_fair.c
+@@ -267,6 +267,16 @@ find_matching_se(struct sched_entity **s
+
+ #endif /* CONFIG_FAIR_GROUP_SCHED */
+
++#ifdef CONFIG_CFS_BANDWIDTH
++static inline struct cfs_bandwidth *tg_cfs_bandwidth(struct task_group *tg)
++{
++ return &tg->cfs_bandwidth;
++}
++
++static void account_cfs_rq_quota(struct cfs_rq *cfs_rq,
++ unsigned long delta_exec);
++#endif
++
+
+ /**************************************************************
+ * Scheduling class tree data structure manipulation methods:
+@@ -547,6 +557,9 @@ static void update_curr(struct cfs_rq *c
+ cpuacct_charge(curtask, delta_exec);
+ account_group_exec_runtime(curtask, delta_exec);
+ }
++#ifdef CONFIG_CFS_BANDWIDTH
++ account_cfs_rq_quota(cfs_rq, delta_exec);
++#endif
+ }
+
+ static inline void
+@@ -1130,6 +1143,43 @@ static void yield_task_fair(struct rq *r
+ }
+
+ #ifdef CONFIG_CFS_BANDWIDTH
++static u64 tg_request_cfs_quota(struct task_group *tg)
++{
++ struct cfs_bandwidth *cfs_b = tg_cfs_bandwidth(tg);
++ u64 delta = 0;
++
++ if (cfs_b->runtime > 0 || cfs_b->quota == RUNTIME_INF) {
++ raw_spin_lock(&cfs_b->lock);
++ /*
++ * it's possible a bandwidth update has changed the global
++ * pool.
++ */
++ if (cfs_b->quota == RUNTIME_INF)
++ delta = sched_cfs_bandwidth_slice();
++ else {
++ delta = min(cfs_b->runtime,
++ sched_cfs_bandwidth_slice());
++ cfs_b->runtime -= delta;
++ }
++ raw_spin_unlock(&cfs_b->lock);
++ }
++ return delta;
++}
++
++static void account_cfs_rq_quota(struct cfs_rq *cfs_rq,
++ unsigned long delta_exec)
++{
++ if (cfs_rq->quota_assigned == RUNTIME_INF)
++ return;
++
++ cfs_rq->quota_used += delta_exec;
++
++ if (cfs_rq->quota_used < cfs_rq->quota_assigned)
++ return;
++
++ cfs_rq->quota_assigned += tg_request_cfs_quota(cfs_rq->tg);
++}
++
+ static int do_sched_cfs_period_timer(struct cfs_bandwidth *cfs_b, int overrun)
+ {
+ return 1;
+--- a/kernel/sysctl.c
++++ b/kernel/sysctl.c
+@@ -382,6 +382,16 @@ static struct ctl_table kern_table[] = {
+ .mode = 0644,
+ .proc_handler = proc_dointvec,
+ },
++#ifdef CONFIG_CFS_BANDWIDTH
++ {
++ .procname = "sched_cfs_bandwidth_slice_us",
++ .data = &sysctl_sched_cfs_bandwidth_slice,
++ .maxlen = sizeof(unsigned int),
++ .mode = 0644,
++ .proc_handler = proc_dointvec_minmax,
++ .extra1 = &one,
++ },
++#endif
+ #ifdef CONFIG_PROVE_LOCKING
+ {
+ .procname = "prove_locking",
View
193 patches/cfs-bw-control-3.patch
@@ -0,0 +1,193 @@
+In account_cfs_rq_quota() (via update_curr()) we track consumption versus a
+cfs_rq's local quota and whether there is global quota available to continue
+enabling it in the event we run out.
+
+This patch adds the required support for the latter case, throttling entities
+until quota is available to run. Throttling dequeues the entity in question
+and sends a reschedule to the owning cpu so that it can be evicted.
+
+The following restrictions apply to a throttled cfs_rq:
+- It is dequeued from sched_entity hierarchy and restricted from being
+ re-enqueued. This means that new/waking children of this entity will be
+ queued up to it, but not past it.
+- It does not contribute to weight calculations in tg_shares_up
+- In the case that the cfs_rq of the cpu we are trying to pull from is throttled
+ it is is ignored by the loadbalancer in __load_balance_fair() and
+ move_one_task_fair().
+
+Signed-off-by: Paul Turner <pjt@google.com>
+Signed-off-by: Nikhil Rao <ncrao@google.com>
+Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
+---
+ kernel/sched.c | 12 +++++++++-
+ kernel/sched_fair.c | 62 +++++++++++++++++++++++++++++++++++++++++++++++-----
+ 2 files changed, 68 insertions(+), 6 deletions(-)
+
+--- a/kernel/sched.c
++++ b/kernel/sched.c
+@@ -386,6 +386,7 @@ struct cfs_rq {
+ #endif
+ #ifdef CONFIG_CFS_BANDWIDTH
+ u64 quota_assigned, quota_used;
++ int throttled;
+ #endif
+ #endif
+ };
+@@ -1651,6 +1652,8 @@ static void update_group_shares_cpu(stru
+ }
+ }
+
++static inline int cfs_rq_throttled(struct cfs_rq *cfs_rq);
++
+ /*
+ * Re-compute the task group their per cpu shares over the given domain.
+ * This needs to be done in a bottom-up fashion because the rq weight of a
+@@ -1671,7 +1674,14 @@ static int tg_shares_up(struct task_grou
+ usd_rq_weight = per_cpu_ptr(update_shares_data, smp_processor_id());
+
+ for_each_cpu(i, sched_domain_span(sd)) {
+- weight = tg->cfs_rq[i]->load.weight;
++ /*
++ * bandwidth throttled entities cannot contribute to load
++ * balance
++ */
++ if (!cfs_rq_throttled(tg->cfs_rq[i]))
++ weight = tg->cfs_rq[i]->load.weight;
++ else
++ weight = 0;
+ usd_rq_weight[i] = weight;
+
+ rq_weight += weight;
+--- a/kernel/sched_fair.c
++++ b/kernel/sched_fair.c
+@@ -273,8 +273,18 @@ static inline struct cfs_bandwidth *tg_c
+ return &tg->cfs_bandwidth;
+ }
+
++static inline int cfs_rq_throttled(struct cfs_rq *cfs_rq)
++{
++ return cfs_rq->throttled;
++}
++
+ static void account_cfs_rq_quota(struct cfs_rq *cfs_rq,
+ unsigned long delta_exec);
++#else
++static inline int cfs_rq_throttled(struct cfs_rq *cfs_rq)
++{
++ return 0;
++}
+ #endif
+
+
+@@ -787,6 +797,11 @@ enqueue_entity(struct cfs_rq *cfs_rq, st
+ * Update run-time statistics of the 'current'.
+ */
+ update_curr(cfs_rq);
++
++ if (!entity_is_task(se) && (cfs_rq_throttled(group_cfs_rq(se)) ||
++ !group_cfs_rq(se)->nr_running))
++ return;
++
+ account_entity_enqueue(cfs_rq, se);
+
+ if (flags & ENQUEUE_WAKEUP) {
+@@ -823,6 +838,9 @@ dequeue_entity(struct cfs_rq *cfs_rq, st
+ */
+ update_curr(cfs_rq);
+
++ if (!entity_is_task(se) && cfs_rq_throttled(group_cfs_rq(se)))
++ return;
++
+ update_stats_dequeue(cfs_rq, se);
+ if (flags & DEQUEUE_SLEEP) {
+ #ifdef CONFIG_SCHEDSTATS
+@@ -1068,6 +1086,9 @@ enqueue_task_fair(struct rq *rq, struct
+ break;
+ cfs_rq = cfs_rq_of(se);
+ enqueue_entity(cfs_rq, se, flags);
++ /* don't continue to enqueue if our parent is throttled */
++ if (cfs_rq_throttled(cfs_rq))
++ break;
+ flags = ENQUEUE_WAKEUP;
+ }
+
+@@ -1087,8 +1108,11 @@ static void dequeue_task_fair(struct rq
+ for_each_sched_entity(se) {
+ cfs_rq = cfs_rq_of(se);
+ dequeue_entity(cfs_rq, se, flags);
+- /* Don't dequeue parent if it has other entities besides us */
+- if (cfs_rq->load.weight)
++ /*
++ * Don't dequeue parent if it has other entities besides us,
++ * or if it is throttled
++ */
++ if (cfs_rq->load.weight || cfs_rq_throttled(cfs_rq))
+ break;
+ flags |= DEQUEUE_SLEEP;
+ }
+@@ -1166,6 +1190,22 @@ static u64 tg_request_cfs_quota(struct t
+ return delta;
+ }
+
++static void throttle_cfs_rq(struct cfs_rq *cfs_rq)
++{
++ struct sched_entity *se;
++
++ se = cfs_rq->tg->se[cpu_of(rq_of(cfs_rq))];
++
++ for_each_sched_entity(se) {
++ struct cfs_rq *cfs_rq = cfs_rq_of(se);
++
++ dequeue_entity(cfs_rq, se, 1);
++ if (cfs_rq->load.weight || cfs_rq_throttled(cfs_rq))
++ break;
++ }
++ cfs_rq->throttled = 1;
++}
++
+ static void account_cfs_rq_quota(struct cfs_rq *cfs_rq,
+ unsigned long delta_exec)
+ {
+@@ -1174,10 +1214,16 @@ static void account_cfs_rq_quota(struct
+
+ cfs_rq->quota_used += delta_exec;
+
+- if (cfs_rq->quota_used < cfs_rq->quota_assigned)
++ if (cfs_rq_throttled(cfs_rq) ||
++ cfs_rq->quota_used < cfs_rq->quota_assigned)
+ return;
+
+ cfs_rq->quota_assigned += tg_request_cfs_quota(cfs_rq->tg);
++
++ if (cfs_rq->quota_used >= cfs_rq->quota_assigned) {
++ throttle_cfs_rq(cfs_rq);
++ resched_task(cfs_rq->rq->curr);
++ }
+ }
+
+ static int do_sched_cfs_period_timer(struct cfs_bandwidth *cfs_b, int overrun)
+@@ -1996,9 +2042,10 @@ load_balance_fair(struct rq *this_rq, in
+ u64 rem_load, moved_load;
+
+ /*
+- * empty group
++ * empty group or throttled cfs_rq
+ */
+- if (!busiest_cfs_rq->task_weight)
++ if (!busiest_cfs_rq->task_weight ||
++ cfs_rq_throttled(busiest_cfs_rq))
+ continue;
+
+ rem_load = (u64)rem_load_move * busiest_weight;
+@@ -2058,6 +2105,11 @@ static int move_tasks(struct rq *this_rq
+ total_load_moved += load_moved;
+
+ #ifdef CONFIG_PREEMPT
++ for_each_leaf_cfs_rq(busiest, busy_cfs_rq) {
++ /* skip throttled cfs_rq */
++ if (cfs_rq_throttled(busy_cfs_rq))
++ continue;
++
+ /*
+ * NEWIDLE balancing is a source of latency, so preemptible
+ * kernels will stop after the first task is pulled to minimize
View
191 patches/cfs-bw-control-4.patch
@@ -0,0 +1,191 @@
+At the start of a new period there are several actions we must take:
+- Refresh global bandwidth pool
+- Unthrottle entities who ran out of quota as refreshed bandwidth permits
+
+Unthrottled entities have the cfs_rq->throttled flag set and are re-enqueued
+into the cfs entity hierarchy.
+
+sched_rt_period_mask() is refactored slightly into sched_bw_period_mask()
+since it is now shared by both cfs and rt bandwidth period timers.
+
+The !CONFIG_RT_GROUP_SCHED && CONFIG_SMP case has been collapsed to use
+rd->span instead of cpu_online_mask since I think that was incorrect before
+(don't want to hit cpu's outside of your root_domain for RT bandwidth).
+
+Signed-off-by: Paul Turner <pjt@google.com>
+Signed-off-by: Nikhil Rao <ncrao@google.com>
+Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
+---
+ kernel/sched.c | 16 +++++++++++++
+ kernel/sched_fair.c | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++-
+ kernel/sched_rt.c | 19 ---------------
+ 3 files changed, 79 insertions(+), 19 deletions(-)
+
+--- a/kernel/sched.c
++++ b/kernel/sched.c
+@@ -1548,6 +1548,8 @@ static int tg_nop(struct task_group *tg,
+ }
+ #endif
+
++static inline const struct cpumask *sched_bw_period_mask(void);
++
+ #ifdef CONFIG_SMP
+ /* Used instead of source_load when we know the type == 0 */
+ static unsigned long weighted_cpuload(const int cpu)
+@@ -1915,6 +1917,18 @@ static inline void __set_task_cpu(struct
+
+ static const struct sched_class rt_sched_class;
+
++#ifdef CONFIG_SMP
++static inline const struct cpumask *sched_bw_period_mask(void)
++{
++ return cpu_rq(smp_processor_id())->rd->span;
++}
++#else
++static inline const struct cpumask *sched_bw_period_mask(void)
++{
++ return cpu_online_mask;
++}
++#endif
++
+ #ifdef CONFIG_CFS_BANDWIDTH
+ /*
+ * default period for cfs group bandwidth.
+@@ -8728,6 +8742,8 @@ static int tg_set_cfs_bandwidth(struct t
+
+ raw_spin_lock_irq(&rq->lock);
+ init_cfs_rq_quota(cfs_rq);
++ if (cfs_rq_throttled(cfs_rq))
++ unthrottle_cfs_rq(cfs_rq);
+ raw_spin_unlock_irq(&rq->lock);
+ }
+ mutex_unlock(&mutex);
+--- a/kernel/sched_fair.c
++++ b/kernel/sched_fair.c
+@@ -268,6 +268,13 @@ find_matching_se(struct sched_entity **s
+ #endif /* CONFIG_FAIR_GROUP_SCHED */
+
+ #ifdef CONFIG_CFS_BANDWIDTH
++static inline
++struct cfs_rq *cfs_bandwidth_cfs_rq(struct cfs_bandwidth *cfs_b, int cpu)
++{
++ return container_of(cfs_b, struct task_group,
++ cfs_bandwidth)->cfs_rq[cpu];
++}
++
+ static inline struct cfs_bandwidth *tg_cfs_bandwidth(struct task_group *tg)
+ {
+ return &tg->cfs_bandwidth;
+@@ -1206,6 +1213,24 @@ static void throttle_cfs_rq(struct cfs_r
+ cfs_rq->throttled = 1;
+ }
+
++static void unthrottle_cfs_rq(struct cfs_rq *cfs_rq)
++{
++ struct sched_entity *se;
++
++ se = cfs_rq->tg->se[cpu_of(rq_of(cfs_rq))];
++
++ cfs_rq->throttled = 0;
++ for_each_sched_entity(se) {
++ if (se->on_rq)
++ break;
++
++ cfs_rq = cfs_rq_of(se);
++ enqueue_entity(cfs_rq, se, ENQUEUE_WAKEUP);
++ if (cfs_rq_throttled(cfs_rq))
++ break;
++ }
++}
++
+ static void account_cfs_rq_quota(struct cfs_rq *cfs_rq,
+ unsigned long delta_exec)
+ {
+@@ -1228,8 +1253,44 @@ static void account_cfs_rq_quota(struct
+
+ static int do_sched_cfs_period_timer(struct cfs_bandwidth *cfs_b, int overrun)
+ {
+- return 1;
++ int i, idle = 1;
++ u64 delta;
++ const struct cpumask *span;
++
++ if (cfs_b->quota == RUNTIME_INF)
++ return 1;
++
++ /* reset group quota */
++ raw_spin_lock(&cfs_b->lock);
++ cfs_b->runtime = cfs_b->quota;
++ raw_spin_unlock(&cfs_b->lock);
++
++ span = sched_bw_period_mask();
++ for_each_cpu(i, span) {
++ struct rq *rq = cpu_rq(i);
++ struct cfs_rq *cfs_rq = cfs_bandwidth_cfs_rq(cfs_b, i);
++
++ if (cfs_rq->nr_running)
++ idle = 0;
++
++ if (!cfs_rq_throttled(cfs_rq))
++ continue;
++
++ delta = tg_request_cfs_quota(cfs_rq->tg);
++
++ if (delta) {
++ raw_spin_lock(&rq->lock);
++ cfs_rq->quota_assigned += delta;
++
++ if (cfs_rq->quota_used < cfs_rq->quota_assigned)
++ unthrottle_cfs_rq(cfs_rq);
++ raw_spin_unlock(&rq->lock);
++ }
++ }
++
++ return idle;
+ }
++
+ #endif
+
+ #ifdef CONFIG_SMP
+--- a/kernel/sched_rt.c
++++ b/kernel/sched_rt.c
+@@ -241,18 +241,6 @@ static int rt_se_boosted(struct sched_rt
+ return p->prio != p->normal_prio;
+ }
+
+-#ifdef CONFIG_SMP
+-static inline const struct cpumask *sched_rt_period_mask(void)
+-{
+- return cpu_rq(smp_processor_id())->rd->span;
+-}
+-#else
+-static inline const struct cpumask *sched_rt_period_mask(void)
+-{
+- return cpu_online_mask;
+-}
+-#endif
+-
+ static inline
+ struct rt_rq *sched_rt_period_rt_rq(struct rt_bandwidth *rt_b, int cpu)
+ {
+@@ -302,11 +290,6 @@ static inline int rt_rq_throttled(struct
+ return rt_rq->rt_throttled;
+ }
+
+-static inline const struct cpumask *sched_rt_period_mask(void)
+-{
+- return cpu_online_mask;
+-}
+-
+ static inline
+ struct rt_rq *sched_rt_period_rt_rq(struct rt_bandwidth *rt_b, int cpu)
+ {
+@@ -524,7 +507,7 @@ static int do_sched_rt_period_timer(stru
+ if (!rt_bandwidth_enabled() || rt_b->rt_runtime == RUNTIME_INF)
+ return 1;
+
+- span = sched_rt_period_mask();
++ span = sched_bw_period_mask();
+ for_each_cpu(i, span) {
+ int enqueue = 0;
+ struct rt_rq *rt_rq = sched_rt_period_rt_rq(rt_b, i);
View
140 patches/cfs-bw-control-5.patch
@@ -0,0 +1,140 @@
+From: Nikhil Rao <ncrao@google.com>
+
+This change introduces statistics exports for the cpu sub-system, these are
+added through the use of a stat file similar to that exported by other
+subsystems.
+
+The following exports are included:
+
+nr_periods: number of periods in which execution occurred
+nr_throttled: the number of periods above in which execution was throttle
+throttled_time: cumulative wall-time that any cpus have been throttled for
+this group
+
+Signed-off-by: Paul Turner <pjt@google.com>
+---
+ kernel/sched.c | 26 ++++++++++++++++++++++++++
+ kernel/sched_fair.c | 19 ++++++++++++++++++-
+ 2 files changed, 44 insertions(+), 1 deletion(-)
+
+--- a/kernel/sched.c
++++ b/kernel/sched.c
+@@ -251,6 +251,11 @@ struct cfs_bandwidth {
+ ktime_t period;
+ u64 runtime, quota;
+ struct hrtimer period_timer;
++
++ /* throttle statistics */
++ u64 nr_periods;
++ u64 nr_throttled;
++ u64 throttled_time;
+ };
+ #endif
+
+@@ -387,6 +392,7 @@ struct cfs_rq {
+ #ifdef CONFIG_CFS_BANDWIDTH
+ u64 quota_assigned, quota_used;
+ int throttled;
++ u64 throttled_timestamp;
+ #endif
+ #endif
+ };
+@@ -424,6 +430,10 @@ void init_cfs_bandwidth(struct cfs_bandw
+
+ hrtimer_init(&cfs_b->period_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
+ cfs_b->period_timer.function = sched_cfs_period_timer;
++
++ cfs_b->nr_periods = 0;
++ cfs_b->nr_throttled = 0;
++ cfs_b->throttled_time = 0;
+ }
+
+ static
+@@ -8820,6 +8830,18 @@ static int cpu_cfs_period_write_u64(stru
+ return tg_set_cfs_period(cgroup_tg(cgrp), cfs_period_us);
+ }
+
++static int cpu_stats_show(struct cgroup *cgrp, struct cftype *cft,
++ struct cgroup_map_cb *cb)
++{
++ struct task_group *tg = cgroup_tg(cgrp);
++ struct cfs_bandwidth *cfs_b = tg_cfs_bandwidth(tg);
++
++ cb->fill(cb, "nr_periods", cfs_b->nr_periods);
++ cb->fill(cb, "nr_throttled", cfs_b->nr_throttled);
++ cb->fill(cb, "throttled_time", cfs_b->throttled_time);
++
++ return 0;
++}
+ #endif /* CONFIG_CFS_BANDWIDTH */
+ #endif /* CONFIG_FAIR_GROUP_SCHED */
+
+@@ -8866,6 +8888,10 @@ static struct cftype cpu_files[] = {
+ .read_u64 = cpu_cfs_period_read_u64,
+ .write_u64 = cpu_cfs_period_write_u64,
+ },
++ {
++ .name = "stat",
++ .read_map = cpu_stats_show,
++ },
+ #endif
+ #ifdef CONFIG_RT_GROUP_SCHED
+ {
+--- a/kernel/sched_fair.c
++++ b/kernel/sched_fair.c
+@@ -1211,15 +1211,26 @@ static void throttle_cfs_rq(struct cfs_r
+ break;
+ }
+ cfs_rq->throttled = 1;
++ cfs_rq->throttled_timestamp = rq_of(cfs_rq)->clock;
+ }
+
+ static void unthrottle_cfs_rq(struct cfs_rq *cfs_rq)
+ {
+ struct sched_entity *se;
++ struct cfs_bandwidth *cfs_b = tg_cfs_bandwidth(cfs_rq->tg);
++ struct rq *rq = rq_of(cfs_rq);
+
+ se = cfs_rq->tg->se[cpu_of(rq_of(cfs_rq))];
+
++ /* update stats */
++ update_rq_clock(rq);
++ raw_spin_lock(&cfs_b->lock);
++ cfs_b->throttled_time += (rq->clock - cfs_rq->throttled_timestamp);
++ raw_spin_unlock(&cfs_b->lock);
++
+ cfs_rq->throttled = 0;
++ cfs_rq->throttled_timestamp = 0;
++
+ for_each_sched_entity(se) {
+ if (se->on_rq)
+ break;
+@@ -1253,7 +1264,7 @@ static void account_cfs_rq_quota(struct
+
+ static int do_sched_cfs_period_timer(struct cfs_bandwidth *cfs_b, int overrun)
+ {
+- int i, idle = 1;
++ int i, idle = 1, num_throttled = 0;
+ u64 delta;
+ const struct cpumask *span;
+
+@@ -1275,6 +1286,7 @@ static int do_sched_cfs_period_timer(str
+
+ if (!cfs_rq_throttled(cfs_rq))
+ continue;
++ num_throttled++;
+
+ delta = tg_request_cfs_quota(cfs_rq->tg);
+
+@@ -1288,6 +1300,11 @@ static int do_sched_cfs_period_timer(str
+ }
+ }
+
++ /* update throttled stats */
++ cfs_b->nr_periods++;
++ if (num_throttled)
++ cfs_b->nr_throttled++;
++
+ return idle;
+ }
+
View
174 patches/cfs-bw-control-6.patch
@@ -0,0 +1,174 @@
+With task entities participating in throttled sub-trees it is possible for
+task activation/de-activation to not lead to root visible changes to
+rq->nr_running. This in turn leads to incorrect idle and weight-per-task load
+balance decisions.
+
+To allow correct accounting we move responsibility for updating rq->nr_running
+to the respective sched::classes. In the fair-group case this update is
+hierarchical, tracking the number of active tasks rooted at each group entity.
+
+Note: technically this issue also exists with the existing sched_rt
+throttling; however due to the nearly complete provisioning of system
+resources for rt scheduling this is much less common by default.
+---
+ kernel/sched.c | 9 ++++++---
+ kernel/sched_fair.c | 42 ++++++++++++++++++++++++++++++++++++++++++
+ kernel/sched_rt.c | 5 ++++-
+ 3 files changed, 52 insertions(+), 4 deletions(-)
+
+--- a/kernel/sched.c
++++ b/kernel/sched.c
+@@ -332,7 +332,7 @@ struct task_group init_task_group;
+ /* CFS-related fields in a runqueue */
+ struct cfs_rq {
+ struct load_weight load;
+- unsigned long nr_running;
++ unsigned long nr_running, h_nr_tasks;
+
+ u64 exec_clock;
+ u64 min_vruntime;
+@@ -1966,6 +1966,11 @@ static inline u64 sched_cfs_bandwidth_sl
+
+ #include "sched_stats.h"
+
++static void mod_nr_running(struct rq *rq, long delta)
++{
++ rq->nr_running += delta;
++}
++
+ static void inc_nr_running(struct rq *rq)
+ {
+ rq->nr_running++;
+@@ -2022,7 +2027,6 @@ static void activate_task(struct rq *rq,
+ rq->nr_uninterruptible--;
+
+ enqueue_task(rq, p, flags);
+- inc_nr_running(rq);
+ }
+
+ /*
+@@ -2034,7 +2038,6 @@ static void deactivate_task(struct rq *r
+ rq->nr_uninterruptible++;
+
+ dequeue_task(rq, p, flags);
+- dec_nr_running(rq);
+ }
+
+ #include "sched_idletask.c"
+--- a/kernel/sched_fair.c
++++ b/kernel/sched_fair.c
+@@ -76,6 +76,8 @@ unsigned int sysctl_sched_child_runs_fir
+ */
+ unsigned int __read_mostly sysctl_sched_compat_yield;
+
++static void account_hier_tasks(struct sched_entity *se, int delta);
++
+ /*
+ * SCHED_OTHER wake-up granularity.
+ * (default: 1 msec * (1 + ilog(ncpus)), units: nanoseconds)
+@@ -683,6 +685,40 @@ account_entity_dequeue(struct cfs_rq *cf
+ se->on_rq = 0;
+ }
+
++#ifdef CONFIG_CFS_BANDWIDTH
++/* maintain hierarchal task counts on group entities */
++static void account_hier_tasks(struct sched_entity *se, int delta)
++{
++ struct rq *rq = rq_of(cfs_rq_of(se));
++ struct cfs_rq *cfs_rq;
++
++ for_each_sched_entity(se) {
++ /* a throttled entity cannot affect its parent hierarchy */
++ if (group_cfs_rq(se) && cfs_rq_throttled(group_cfs_rq(se)))
++ break;
++
++ /* we affect our queuing entity */
++ cfs_rq = cfs_rq_of(se);
++ cfs_rq->h_nr_tasks += delta;
++ }
++
++ /* account for global nr_running delta to hierarchy change */
++ if (!se)
++ mod_nr_running(rq, delta);
++}
++#else
++/*
++ * In the absence of group throttling, all operations are guaranteed to be
++ * globally visible at the root rq level.
++ */
++static void account_hier_tasks(struct sched_entity *se, int delta)
++{
++ struct rq *rq = rq_of(cfs_rq_of(se));
++
++ mod_nr_running(rq, delta);
++}
++#endif
++
+ static void enqueue_sleeper(struct cfs_rq *cfs_rq, struct sched_entity *se)
+ {
+ #ifdef CONFIG_SCHEDSTATS
+@@ -1099,6 +1135,7 @@ enqueue_task_fair(struct rq *rq, struct
+ flags = ENQUEUE_WAKEUP;
+ }
+
++ account_hier_tasks(&p->se, 1);
+ hrtick_update(rq);
+ }
+
+@@ -1124,6 +1161,7 @@ static void dequeue_task_fair(struct rq
+ flags |= DEQUEUE_SLEEP;
+ }
+
++ account_hier_tasks(&p->se, -1);
+ hrtick_update(rq);
+ }
+
+@@ -1197,12 +1235,15 @@ static u64 tg_request_cfs_quota(struct t
+ return delta;
+ }
+
++static void account_hier_tasks(struct sched_entity *se, int delta);
++
+ static void throttle_cfs_rq(struct cfs_rq *cfs_rq)
+ {
+ struct sched_entity *se;
+
+ se = cfs_rq->tg->se[cpu_of(rq_of(cfs_rq))];
+
++ account_hier_tasks(se, -cfs_rq->h_nr_tasks);
+ for_each_sched_entity(se) {
+ struct cfs_rq *cfs_rq = cfs_rq_of(se);
+
+@@ -1231,6 +1272,7 @@ static void unthrottle_cfs_rq(struct cfs
+ cfs_rq->throttled = 0;
+ cfs_rq->throttled_timestamp = 0;
+
++ account_hier_tasks(se, cfs_rq->h_nr_tasks);
+ for_each_sched_entity(se) {
+ if (se->on_rq)
+ break;
+--- a/kernel/sched_rt.c
++++ b/kernel/sched_rt.c
+@@ -882,6 +882,8 @@ enqueue_task_rt(struct rq *rq, struct ta
+
+ if (!task_current(rq, p) && p->rt.nr_cpus_allowed > 1)
+ enqueue_pushable_task(rq, p);
++
++ inc_nr_running(rq);
+ }
+
+ static void dequeue_task_rt(struct rq *rq, struct task_struct *p, int flags)
+@@ -892,6 +894,8 @@ static void dequeue_task_rt(struct rq *r
+ dequeue_rt_entity(rt_se);
+
+ dequeue_pushable_task(rq, p);
++
++ dec_nr_running(rq);
+ }
+
+ /*
+@@ -1757,4 +1761,3 @@ static void print_rt_stats(struct seq_fi
+ rcu_read_unlock();
+ }
+ #endif /* CONFIG_SCHED_DEBUG */
+-
View
108 patches/cfs_bandwidth.patch
@@ -0,0 +1,108 @@
+Index: linux-2.6.35/kernel/sched.c
+===================================================================
+--- linux-2.6.35.orig/kernel/sched.c 2010-08-24 14:55:39.078006002 -0700
++++ linux-2.6.35/kernel/sched.c 2010-08-25 01:43:07.066804814 -0700
+@@ -248,9 +248,10 @@
+ #ifdef CONFIG_CFS_BANDWIDTH
+ struct cfs_bandwidth {
+ raw_spinlock_t lock;
+- ktime_t period;
+- u64 runtime, quota;
++ ktime_t quota_time;
++ u64 quota, runtime, period;
+ struct hrtimer period_timer;
++ u64 remainder;
+
+ /* throttle statistics */
+ u64 nr_periods;
+@@ -410,7 +411,7 @@
+
+ for (;;) {
+ now = hrtimer_cb_get_time(timer);
+- overrun = hrtimer_forward(timer, now, cfs_b->period);
++ overrun = hrtimer_forward(timer, now, cfs_b->quota_time);
+
+ if (!overrun)
+ break;
+@@ -425,8 +426,14 @@
+ void init_cfs_bandwidth(struct cfs_bandwidth *cfs_b, u64 quota, u64 period)
+ {
+ raw_spin_lock_init(&cfs_b->lock);
+- cfs_b->quota = cfs_b->runtime = quota;
+- cfs_b->period = ns_to_ktime(period);
++ cfs_b->quota = quota;
++ if(quota == RUNTIME_INF)
++ cfs_b->quota_time = ns_to_ktime(period);
++ else
++ cfs_b->quota_time = ns_to_ktime(quota);
++ cfs_b->runtime = quota;
++ cfs_b->period = period;
++ cfs_b->remainder = 0;
+
+ hrtimer_init(&cfs_b->period_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
+ cfs_b->period_timer.function = sched_cfs_period_timer;
+@@ -455,7 +462,7 @@
+ return;
+
+ raw_spin_lock(&cfs_b->lock);
+- start_bandwidth_timer(&cfs_b->period_timer, cfs_b->period);
++ start_bandwidth_timer(&cfs_b->period_timer, cfs_b->quota_time);
+ raw_spin_unlock(&cfs_b->lock);
+ }
+
+@@ -8745,8 +8752,14 @@
+
+ mutex_lock(&mutex);
+ raw_spin_lock_irq(&tg->cfs_bandwidth.lock);
+- tg->cfs_bandwidth.period = ns_to_ktime(period);
+- tg->cfs_bandwidth.runtime = tg->cfs_bandwidth.quota = quota;
++ tg->cfs_bandwidth.period = period;
++ tg->cfs_bandwidth.quota = quota;
++ if(quota == RUNTIME_INF)
++ tg->cfs_bandwidth.quota_time = ns_to_ktime(period);
++ else
++ tg->cfs_bandwidth.quota_time = ns_to_ktime(quota);
++ tg->cfs_bandwidth.runtime = quota;
++ tg->cfs_bandwidth.remainder = 0;
+ raw_spin_unlock_irq(&tg->cfs_bandwidth.lock);
+
+ for_each_possible_cpu(i) {
+@@ -8768,7 +8781,7 @@
+ {
+ u64 quota, period;
+
+- period = ktime_to_ns(tg->cfs_bandwidth.period);
++ period = tg->cfs_bandwidth.period;
+ if (cfs_runtime_us < 0)
+ quota = RUNTIME_INF;
+ else
+@@ -8806,7 +8819,7 @@
+ {
+ u64 cfs_period_us;
+
+- cfs_period_us = ktime_to_ns(tg->cfs_bandwidth.period);
++ cfs_period_us = tg->cfs_bandwidth.period;
+ do_div(cfs_period_us, NSEC_PER_USEC);
+ return cfs_period_us;
+ }
+Index: linux-2.6.35/kernel/sched_fair.c
+===================================================================
+--- linux-2.6.35.orig/kernel/sched_fair.c 2010-08-24 14:55:39.088006002 -0700
++++ linux-2.6.35/kernel/sched_fair.c 2010-08-25 01:51:53.736804820 -0700
+@@ -1315,7 +1315,15 @@
+
+ /* reset group quota */
+ raw_spin_lock(&cfs_b->lock);
+- cfs_b->runtime = cfs_b->quota;
++ if(cfs_b->quota == RUNTIME_INF)
++ cfs_b->remainder = cfs_b->period;
++ else
++ cfs_b->remainder += cfs_b->quota;
++
++ if(cfs_b->remainder >= cfs_b->period) {
++ cfs_b->runtime = cfs_b->quota;
++ cfs_b->remainder -= cfs_b->period;
++ }
+ raw_spin_unlock(&cfs_b->lock);
+
+ span = sched_bw_period_mask();
View
3,258 patches/config-2.6.18-028stab056.1
0 additions, 3,258 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
21 patches/enable-promisc-default.patch
@@ -1,21 +0,0 @@
-diff --git a/drivers/net/veth.c b/drivers/net/veth.c
-index 701a1e0..ce89a76 100644
---- a/drivers/net/veth.c
-+++ b/drivers/net/veth.c
-@@ -280,6 +280,7 @@ static int veth_xmit(struct sk_buff *skb, struct net_device *dev)
-
- if (unlikely(rcv->owner_env->disable_net))
- goto outf;
-+ #if 0
- /* Filtering */
- if (ve_is_super(dev->owner_env) &&
- !veth_from_netdev(rcv)->allow_mac_change) {
-@@ -299,7 +300,7 @@ static int veth_xmit(struct sk_buff *skb, struct net_device *dev)
- dev->dev_addr))
- goto outf;
- }
--
-+#endif
- out:
- skb->owner_env = rcv->owner_env;
-
View
557 patches/etunpatch-2.6.18-openvz.diff
@@ -1,557 +0,0 @@
-diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
-index a2bd811..1143654 100644
---- a/drivers/net/Kconfig
-+++ b/drivers/net/Kconfig
-@@ -116,6 +116,20 @@ config TUN
-
- If you don't know what to use this for, you don't need it.
-
-+config ETUN
-+ tristate "Ethernet tunnel device driver support"
-+ depends on SYSFS
-+ ---help---
-+ ETUN provices a pair of network devices that can be used for
-+ configuring interesting topolgies. What one devices transmits
-+ the other receives and vice versa. The link level framing
-+ is ethernet for wide compatibility with network stacks.
-+
-+ To compile this driver as a module, choose M here: the module
-+ will be called etun.
-+
-+ If you don't know what to use this for, you don't need it.
-+
- config NET_SB1000
- tristate "General Instruments Surfboard 1000"
- depends on PNP
-diff --git a/drivers/net/Makefile b/drivers/net/Makefile
-index 7e916e0..4a38d36 100644
---- a/drivers/net/Makefile
-+++ b/drivers/net/Makefile
-@@ -196,6 +196,7 @@ obj-$(CONFIG_MACSONIC) += macsonic.o
- obj-$(CONFIG_MACMACE) += macmace.o
- obj-$(CONFIG_MAC89x0) += mac89x0.o
- obj-$(CONFIG_TUN) += tun.o
-+obj-$(CONFIG_ETUN) += etun.o
- obj-$(CONFIG_NET_NETX) += netx-eth.o
- obj-$(CONFIG_DL2K) += dl2k.o
- obj-$(CONFIG_R8169) += r8169.o
-diff --git a/drivers/net/etun.c b/drivers/net/etun.c
-new file mode 100644
-index 0000000..e15893a
---- /dev/null
-+++ b/drivers/net/etun.c
-@@ -0,0 +1,486 @@
-+/*
-+ * ETUN - Universal ETUN device driver.
-+ * Copyright (C) 2006 Linux Networx
-+ *
-+ */
-+
-+#define DRV_NAME "etun"
-+#define DRV_VERSION "1.0"
-+#define DRV_DESCRIPTION "Ethernet pseudo tunnel device driver"
-+#define DRV_COPYRIGHT "(C) 2007 Linux Networx"
-+
-+#include <linux/module.h>
-+#include <linux/kernel.h>
-+#include <linux/list.h>
-+#include <linux/spinlock.h>
-+#include <linux/skbuff.h>
-+#include <linux/netdevice.h>
-+#include <linux/etherdevice.h>
-+#include <linux/ethtool.h>
-+#include <linux/rtnetlink.h>
-+#include <linux/if.h>
-+#include <linux/if_ether.h>
-+#include <linux/ctype.h>
-+#include <net/dst.h>
-+
-+
-+/* Device cheksum strategy.
-+ *
-+ * etun is designed to a be a pair of virutal devices
-+ * connecting two network stack instances.
-+ *
-+ * Typically it will either be used with ethernet bridging or
-+ * it will be used to route packets between the two stacks.
-+ *
-+ * The only checksum offloading I can do is to completely
-+ * skip the checksumming step all together.
-+ *
-+ * When used for ethernet bridging I don't believe any
-+ * checksum off loading is safe.
-+ * - If my source is an external interface the checksum may be
-+ * invalid so I don't want to report I have already checked it.
-+ * - If my destination is an external interface I don't want to put
-+ * a packet on the wire with someone computing the checksum.
-+ *
-+ * When used for routing between two stacks checksums should
-+ * be as unnecessary as they are on the loopback device.
-+ *
-+ * So by default I am safe and disable checksumming and
-+ * other advanced features like SG and TSO.
-+ *
-+ * However because I think these features could be useful
-+ * I provide the ethtool functions to and enable/disable
-+ * them at runtime.
-+ *
-+ * If you think you can correctly enable these go ahead.
-+ * For checksums both the transmitter and the receiver must
-+ * agree before the are actually disabled.
-+ */
-+
-+#define ETUN_NUM_STATS 1
-+static struct {
-+ const char string[ETH_GSTRING_LEN];
-+} ethtool_stats_keys[ETUN_NUM_STATS] = {
-+ { "partner_ifindex" },
-+};
-+
-+struct etun_info {
-+ struct net_device *rx_dev;
-+ unsigned ip_summed;
-+ struct net_device_stats stats;
-+ struct list_head list;
-+ struct net_device *dev;
-+};
-+
-+/*
-+ * I have to hold the rtnl_lock during device delete.
-+ * So I use the rtnl_lock to protect my list manipulations
-+ * as well. Crude but simple.
-+ */
-+static LIST_HEAD(etun_list);
-+
-+/*
-+ * The higher levels take care of making this non-reentrant (it's
-+ * called with bh's disabled).
-+ */
-+static int etun_xmit(struct sk_buff *skb, struct net_device *tx_dev)
-+{
-+ struct etun_info *tx_info = tx_dev->priv;
-+ struct net_device *rx_dev = tx_info->rx_dev;
-+ struct etun_info *rx_info = rx_dev->priv;
-+
-+ tx_info->stats.tx_packets++;
-+ tx_info->stats.tx_bytes += skb->len;
-+
-+ /* Drop the skb state that was needed to get here */
-+ skb_orphan(skb);
-+ if (skb->dst)
-+ skb->dst = dst_pop(skb->dst); /* Allow for smart routing */
-+
-+ /* Switch to the receiving device */
-+ skb->pkt_type = PACKET_HOST;
-+ skb->protocol = eth_type_trans(skb, rx_dev);
-+ skb->dev = rx_dev;
-+ skb->ip_summed = CHECKSUM_NONE;
-+
-+ /* If both halves agree no checksum is needed */
-+ if (tx_dev->features & NETIF_F_NO_CSUM)
-+ skb->ip_summed = rx_info->ip_summed;
-+
-+ rx_dev->last_rx = jiffies;
-+ rx_info->stats.rx_packets++;
-+ rx_info->stats.rx_bytes += skb->len;
-+ netif_rx(skb);
-+
-+ return 0;
-+}
-+
-+static struct net_device_stats *etun_get_stats(struct net_device *dev)
-+{
-+ struct etun_info *info = dev->priv;
-+ return &info->stats;
-+}
-+
-+/* ethtool interface */
-+static int etun_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
-+{
-+ cmd->supported = 0;
-+ cmd->advertising = 0;
-+ cmd->speed = SPEED_10000; /* Memory is fast! */
-+ cmd->duplex = DUPLEX_FULL;
-+ cmd->port = PORT_TP;
-+ cmd->phy_address = 0;
-+ cmd->transceiver = XCVR_INTERNAL;
-+ cmd->autoneg = AUTONEG_DISABLE;
-+ cmd->maxtxpkt = 0;
-+ cmd->maxrxpkt = 0;
-+ return 0;
-+}
-+
-+static void etun_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
-+{
-+ strcpy(info->driver, DRV_NAME);
-+ strcpy(info->version, DRV_VERSION);
-+ strcpy(info->fw_version, "N/A");
-+}
-+
-+static void etun_get_strings(struct net_device *dev, u32 stringset, u8 *buf)
-+{
-+ switch(stringset) {
-+ case ETH_SS_STATS:
-+ memcpy(buf, &ethtool_stats_keys, sizeof(ethtool_stats_keys));
-+ break;
-+ case ETH_SS_TEST:
-+ default:
-+ break;
-+ }
-+}
-+
-+static int etun_get_stats_count(struct net_device *dev)
-+{
-+ return ETUN_NUM_STATS;
-+}
-+
-+static void etun_get_ethtool_stats(struct net_device *dev,
-+ struct ethtool_stats *stats, u64 *data)
-+{
-+ struct etun_info *info = dev->priv;
-+
-+ data[0] = info->rx_dev->ifindex;
-+}
-+
-+static u32 etun_get_rx_csum(struct net_device *dev)
-+{
-+ struct etun_info *info = dev->priv;
-+ return info->ip_summed == CHECKSUM_UNNECESSARY;
-+}
-+
-+static int etun_set_rx_csum(struct net_device *dev, u32 data)
-+{
-+ struct etun_info *info = dev->priv;
-+
-+ info->ip_summed = data ? CHECKSUM_UNNECESSARY : CHECKSUM_NONE;
-+
-+ return 0;
-+}
-+
-+static u32 etun_get_tx_csum(struct net_device *dev)
-+{
-+ return (dev->features & NETIF_F_NO_CSUM) != 0;
-+}
-+
-+static int etun_set_tx_csum(struct net_device *dev, u32 data)
-+{
-+ dev->features &= ~NETIF_F_NO_CSUM;
-+ if (data)
-+ dev->features |= NETIF_F_NO_CSUM;
-+
-+ return 0;
-+}
-+
-+static struct ethtool_ops etun_ethtool_ops = {
-+ .get_settings = etun_get_settings,
-+ .get_drvinfo = etun_get_drvinfo,
-+ .get_link = ethtool_op_get_link,
-+ .get_rx_csum = etun_get_rx_csum,
-+ .set_rx_csum = etun_set_rx_csum,
-+ .get_tx_csum = etun_get_tx_csum,
-+ .set_tx_csum = etun_set_tx_csum,
-+ .get_sg = ethtool_op_get_sg,
-+ .set_sg = ethtool_op_set_sg,
-+#if 0 /* Does just setting the bit successfuly emulate tso? */
-+ .get_tso = ethtool_op_get_tso,
-+ .set_tso = ethtool_op_set_tso,
-+#endif
-+ .get_strings = etun_get_strings,
-+ .get_stats_count = etun_get_stats_count,
-+ .get_ethtool_stats = etun_get_ethtool_stats,
-+ .get_perm_addr = ethtool_op_get_perm_addr,
-+};
-+
-+static int etun_open(struct net_device *tx_dev)
-+{
-+ struct etun_info *tx_info = tx_dev->priv;
-+ struct net_device *rx_dev = tx_info->rx_dev;
-+ /* If we attempt to bring up etun in the small window before
-+ * it is connected to it's partner error.
-+ */
-+ if (!rx_dev)
-+ return -ENOTCONN;
-+ if (rx_dev->flags & IFF_UP) {
-+ netif_carrier_on(tx_dev);
-+ netif_carrier_on(rx_dev);
-+ }
-+ netif_start_queue(tx_dev);
-+ return 0;
-+}
-+
-+static int etun_stop(struct net_device *tx_dev)
-+{
-+ struct etun_info *tx_info = tx_dev->priv;
-+ struct net_device *rx_dev = tx_info->rx_dev;
-+ netif_stop_queue(tx_dev);
-+ if (netif_carrier_ok(tx_dev)) {
-+ netif_carrier_off(tx_dev);