lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 25 Jul 2011 16:58:01 +0200
From:	Peter Zijlstra <a.p.zijlstra@...llo.nl>
To:	Paul Turner <pjt@...gle.com>
Cc:	linux-kernel@...r.kernel.org,
	Bharata B Rao <bharata@...ux.vnet.ibm.com>,
	Dhaval Giani <dhaval.giani@...il.com>,
	Balbir Singh <bsingharora@...il.com>,
	Vaidyanathan Srinivasan <svaidy@...ux.vnet.ibm.com>,
	Srivatsa Vaddagiri <vatsa@...ibm.com>,
	Kamalesh Babulal <kamalesh@...ux.vnet.ibm.com>,
	Hidetoshi Seto <seto.hidetoshi@...fujitsu.com>,
	Ingo Molnar <mingo@...e.hu>,
	Pavel Emelyanov <xemul@...nvz.org>,
	Jason Baron <jbaron@...hat.com>
Subject: Re: [patch 00/18] CFS Bandwidth Control v7.2

How about something like the below on top?


---
 kernel/sched.c |   33 ++++++++++++++++++++++++++++++++-
 1 file changed, 32 insertions(+), 1 deletion(-)

Index: linux-2.6/kernel/sched.c
===================================================================
--- linux-2.6.orig/kernel/sched.c
+++ linux-2.6/kernel/sched.c
@@ -9228,9 +9228,19 @@ long tg_get_cfs_quota(struct task_group 
 	return quota_us;
 }
 
+int tg_set_cfs_period_down(struct task_group *tg, void *data)
+{
+	u64 period = *(u64 *)data;
+	if (ktime_to_ns(tg->cfs_bandwidth.period) == period)
+		return 0;
+
+	return tg_set_cfs_bandwidth(tg, period, tg->cfs_bandwidth.quota);
+}
+
 int tg_set_cfs_period(struct task_group *tg, long cfs_period_us)
 {
 	u64 quota, period;
+	int ret;
 
 	period = (u64)cfs_period_us * NSEC_PER_USEC;
 	quota = tg_cfs_bandwidth(tg)->quota;
@@ -9238,7 +9248,28 @@ int tg_set_cfs_period(struct task_group 
 	if (period <= 0)
 		return -EINVAL;
 
-	return tg_set_cfs_bandwidth(tg, period, quota);
+	/*
+	 * If the parent is bandwidth constrained all its children will
+	 * have to have the same period.
+	 */
+	if (tg->parent && tg->parent->cfs_bandwidth.quota != RUNTIME_INF)
+		return -EINVAL;
+
+	ret = tg_set_cfs_bandwidth(tg, period, quota);
+	if (!ret) {
+		rcu_read_lock();
+		ret = walk_tg_tree_from(tg, tg_set_cfs_period_down, NULL, &period);
+		rcu_read_unlock();
+
+		/*
+		 * If we could change the period on the parent we should be
+		 * able to change the period on all its children since their
+		 * quote is constrained to be equal or less than our.
+		 */
+		WARN_ON_ONCE(ret);
+	}
+
+	return ret;
 }
 
 long tg_get_cfs_period(struct task_group *tg)

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ