time.c (f83eeb1a01689b2691f6f56629ac9f66de8d41c2) time.c (eb8e20f89093b64f48975c74ccb114e6775cee22)
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * Common time routines among all ppc machines.
4 *
5 * Written by Cort Dougan (cort@cs.nmt.edu) to merge
6 * Paul Mackerras' version and mine for PReP and Pmac.
7 * MPC8xx/MBX changes by Dan Malek (dmalek@jlc.net).
8 * Converted for 64-bit by Mike Corrigan (mikejc@us.ibm.com)

--- 218 unchanged lines hidden (view full) ---

227 local_paca->dtl_curr = dtl;
228 return stolen;
229}
230
231/*
232 * Accumulate stolen time by scanning the dispatch trace log.
233 * Called on entry from user mode.
234 */
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * Common time routines among all ppc machines.
4 *
5 * Written by Cort Dougan (cort@cs.nmt.edu) to merge
6 * Paul Mackerras' version and mine for PReP and Pmac.
7 * MPC8xx/MBX changes by Dan Malek (dmalek@jlc.net).
8 * Converted for 64-bit by Mike Corrigan (mikejc@us.ibm.com)

--- 218 unchanged lines hidden (view full) ---

227 local_paca->dtl_curr = dtl;
228 return stolen;
229}
230
231/*
232 * Accumulate stolen time by scanning the dispatch trace log.
233 * Called on entry from user mode.
234 */
235void accumulate_stolen_time(void)
235void notrace accumulate_stolen_time(void)
236{
237 u64 sst, ust;
238 unsigned long save_irq_soft_mask = irq_soft_mask_return();
239 struct cpu_accounting_data *acct = &local_paca->accounting;
240
241 /* We are called early in the exception entry, before
242 * soft/hard_enabled are sync'ed to the expected state
243 * for the exception. We are hard disabled but the PACA

--- 89 unchanged lines hidden (view full) ---

333
334 *stime_scaled = vtime_delta_scaled(acct, now, stime);
335
336 *steal_time = calculate_stolen_time(now);
337
338 return stime;
339}
340
236{
237 u64 sst, ust;
238 unsigned long save_irq_soft_mask = irq_soft_mask_return();
239 struct cpu_accounting_data *acct = &local_paca->accounting;
240
241 /* We are called early in the exception entry, before
242 * soft/hard_enabled are sync'ed to the expected state
243 * for the exception. We are hard disabled but the PACA

--- 89 unchanged lines hidden (view full) ---

333
334 *stime_scaled = vtime_delta_scaled(acct, now, stime);
335
336 *steal_time = calculate_stolen_time(now);
337
338 return stime;
339}
340
341void vtime_account_kernel(struct task_struct *tsk)
341void vtime_account_system(struct task_struct *tsk)
342{
343 unsigned long stime, stime_scaled, steal_time;
344 struct cpu_accounting_data *acct = get_accounting(tsk);
345
346 stime = vtime_delta(tsk, &stime_scaled, &steal_time);
347
348 stime -= min(stime, steal_time);
349 acct->steal_time += steal_time;

--- 11 unchanged lines hidden (view full) ---

361 else
362 acct->stime += stime;
363
364#ifdef CONFIG_ARCH_HAS_SCALED_CPUTIME
365 acct->stime_scaled += stime_scaled;
366#endif
367 }
368}
342{
343 unsigned long stime, stime_scaled, steal_time;
344 struct cpu_accounting_data *acct = get_accounting(tsk);
345
346 stime = vtime_delta(tsk, &stime_scaled, &steal_time);
347
348 stime -= min(stime, steal_time);
349 acct->steal_time += steal_time;

--- 11 unchanged lines hidden (view full) ---

361 else
362 acct->stime += stime;
363
364#ifdef CONFIG_ARCH_HAS_SCALED_CPUTIME
365 acct->stime_scaled += stime_scaled;
366#endif
367 }
368}
369EXPORT_SYMBOL_GPL(vtime_account_kernel);
369EXPORT_SYMBOL_GPL(vtime_account_system);
370
371void vtime_account_idle(struct task_struct *tsk)
372{
373 unsigned long stime, stime_scaled, steal_time;
374 struct cpu_accounting_data *acct = get_accounting(tsk);
375
376 stime = vtime_delta(tsk, &stime_scaled, &steal_time);
377 acct->idle_time += stime + steal_time;

--- 12 unchanged lines hidden (view full) ---

390 acct->utime_sspurr = 0;
391 acct->stime_scaled = 0;
392#endif
393}
394
395/*
396 * Account the whole cputime accumulated in the paca
397 * Must be called with interrupts disabled.
370
371void vtime_account_idle(struct task_struct *tsk)
372{
373 unsigned long stime, stime_scaled, steal_time;
374 struct cpu_accounting_data *acct = get_accounting(tsk);
375
376 stime = vtime_delta(tsk, &stime_scaled, &steal_time);
377 acct->idle_time += stime + steal_time;

--- 12 unchanged lines hidden (view full) ---

390 acct->utime_sspurr = 0;
391 acct->stime_scaled = 0;
392#endif
393}
394
395/*
396 * Account the whole cputime accumulated in the paca
397 * Must be called with interrupts disabled.
398 * Assumes that vtime_account_kernel/idle() has been called
398 * Assumes that vtime_account_system/idle() has been called
399 * recently (i.e. since the last entry from usermode) so that
400 * get_paca()->user_time_scaled is up to date.
401 */
402void vtime_flush(struct task_struct *tsk)
403{
404 struct cpu_accounting_data *acct = get_accounting(tsk);
405
406 if (acct->utime)

--- 838 unchanged lines hidden ---
399 * recently (i.e. since the last entry from usermode) so that
400 * get_paca()->user_time_scaled is up to date.
401 */
402void vtime_flush(struct task_struct *tsk)
403{
404 struct cpu_accounting_data *acct = get_accounting(tsk);
405
406 if (acct->utime)

--- 838 unchanged lines hidden ---