[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160311160522.GA24046@htj.duckdns.org>
Date: Fri, 11 Mar 2016 11:05:22 -0500
From: Tejun Heo <tj@...nel.org>
To: torvalds@...ux-foundation.org, akpm@...ux-foundation.org,
a.p.zijlstra@...llo.nl, mingo@...hat.com, lizefan@...wei.com,
hannes@...xchg.org, pjt@...gle.com
Cc: linux-kernel@...r.kernel.org, cgroups@...r.kernel.org,
linux-api@...r.kernel.org, kernel-team@...com
Subject: Example program for PRIO_RGRP
Hello,
The attached test-rgrp-burn.c is an example program making use of the
new PRIO_RGRP. The test program creates rgroup the following rgroup
hierarchy
sgroup - main thread
+ [rgroup-0] burner-0
+ [rgroup-1] + [rgroup-2] burner-1
+ [rgroup-3] burner-2
and takes upto 4 arguments respectively specifying the nice level for
each rgroup. Each burner thread executes CPU burning loops and
periodically prints out how many loops it has completed.
* "./test-rgrp-burn"
If the program is run without any argument, on a kernel which doesn't
support rgroup, or from a cgroup where cpu controller is not
available, the three burner threads would run at about equivalent
speeds.
* "./test-rgrp-burn 0" from a cgroup w/ cpu controller
cpu controller is enabled across the top-level, so rgroup-0 and
rgroup-1 would compete on equal footing, so burner-0 runs twice as
fast as burner-1 or burner-2.
* "./test-rgrp-burn 0 3 -1 2" from a cgroup w/ cpu controller
cpu controller is enabled at both levels. Nice level difference of 3
is about twice difference in weight, so the ratio would roughly be
burner-0 : burner-1 : burner-2 ~= 3 : 2 : 1
Thanks.
--
tejun
View attachment "test-rgrp-burn.c" of type "text/plain" (3316 bytes)
Powered by blists - more mailing lists