OpenVZ Forum


Home » Mailing lists » Devel » [PATCH 1/5] make steal time's to-tick routine generic
[PATCH 1/5] make steal time's to-tick routine generic [message #45155] Thu, 02 February 2012 14:19
Glauber Costa is currently offline  Glauber Costa
Messages: 916
Registered: October 2011
Senior Member
In this patchset, I am exposing other data as ticks as well,
that are originally nanoseconds. Whether or not I should do it,
it is open for debate, and I am happy to drop this patch if we
decide not to. But right now this exists to support the
further patch that uses it.

Signed-off-by: Glauber Costa <glommer@parallels.com>
---
kernel/sched/core.c | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index b9be4ba..455810f 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -850,13 +850,18 @@ EXPORT_SYMBOL_GPL(account_system_vtime);

#endif /* CONFIG_IRQ_TIME_ACCOUNTING */

+static inline u64 nsec_to_tick(u64 nsec)
+{
+ if (unlikely(nsec > NSEC_PER_SEC))
+ return div_u64(nsec, TICK_NSEC);
+
+ return __iter_div_u64_rem(nsec, TICK_NSEC, &nsec);
+}
+
#ifdef CONFIG_PARAVIRT
static inline u64 steal_ticks(u64 steal)
{
- if (unlikely(steal > NSEC_PER_SEC))
- return div_u64(steal, TICK_NSEC);
-
- return __iter_div_u64_rem(steal, TICK_NSEC, &steal);
+ return nsec_to_tick(steal);
}
#endif

--
1.7.7.4
Previous Topic: [PATCH 0/6] Lockd: make it network namespace aware
Next Topic: [PATCH 00/11] SUNRPC: make sysctl per network namespcase context
Goto Forum:
  


Current Time: Wed Oct 02 06:45:46 GMT 2024

Total time taken to generate the page: 0.04641 seconds