mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stephen Rothwell <sfr@canb.auug.org.au>
To: Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@elte.hu>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Peter Zijlstra <peterz@infradead.org>
Cc: linux-next@vger.kernel.org, linux-kernel@vger.kernel.org,
	Glauber Costa <glommer@parallels.com>,
	Martin Schwidefsky <schwidefsky@de.ibm.com>
Subject: linux-next: manual merge of the tip tree with the cputime tree
Date: Wed, 7 Dec 2011 15:09:56 +1100	[thread overview]
Message-ID: <20111207150956.52d41fd8580de3b66abd5d2d@canb.auug.org.au> (raw)

[-- Attachment #1: Type: text/plain, Size: 10286 bytes --]

Hi all,

Today's linux-next merge of the tip tree got conflicts in
kernel/sched/core.c, fs/proc/uptime.c, fs/proc/stat.c,
drivers/cpufreq/cpufreq_conservative.c,
drivers/cpufreq/cpufreq_ondemand.c and drivers/macintosh/rack-meter.c
between commit c5927fe412bf ("[S390] cputime: add sparse checking and
cleanup") from the cputime tree and commit 3292beb340c7
("sched/accounting: Change cpustat fields to an array") from the tip tree.

I fixed it up (I hope - see below) and can carry the fix as necessary.  (I
used the tip version of fs/proc/uptime.c, fs/proc/stat.c and
drivers/macintosh/rack-meter.c).
-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --cc kernel/sched/core.c
index 18cad44,3c5b21e..0000000
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@@ -2166,7 -935,7 +935,7 @@@ static int irqtime_account_hi_update(vo
  
  	local_irq_save(flags);
  	latest_ns = this_cpu_read(cpu_hardirq_time);
- 	if (nsecs_to_cputime64(latest_ns) > cpustat->irq)
 -	if (cputime64_gt(nsecs_to_cputime64(latest_ns), cpustat[CPUTIME_IRQ]))
++	if (nsecs_to_cputime64(latest_ns) > cpustat[CPUTIME_IRQ])
  		ret = 1;
  	local_irq_restore(flags);
  	return ret;
@@@ -2181,7 -950,7 +950,7 @@@ static int irqtime_account_si_update(vo
  
  	local_irq_save(flags);
  	latest_ns = this_cpu_read(cpu_softirq_time);
- 	if (nsecs_to_cputime64(latest_ns) > cpustat->softirq)
 -	if (cputime64_gt(nsecs_to_cputime64(latest_ns), cpustat[CPUTIME_SOFTIRQ]))
++	if (nsecs_to_cputime64(latest_ns) > cpustat[CPUTIME_SOFTIRQ])
  		ret = 1;
  	local_irq_restore(flags);
  	return ret;
@@@ -3867,20 -2633,18 +2633,18 @@@ static inline void task_group_account_f
  void account_user_time(struct task_struct *p, cputime_t cputime,
  		       cputime_t cputime_scaled)
  {
- 	struct cpu_usage_stat *cpustat = &kstat_this_cpu.cpustat;
+ 	int index;
  
  	/* Add user time to process. */
 -	p->utime = cputime_add(p->utime, cputime);
 -	p->utimescaled = cputime_add(p->utimescaled, cputime_scaled);
 +	p->utime += cputime;
 +	p->utimescaled += cputime_scaled;
  	account_group_user_time(p, cputime);
  
+ 	index = (TASK_NICE(p) > 0) ? CPUTIME_NICE : CPUTIME_USER;
+ 
  	/* Add user time to cpustat. */
- 	if (TASK_NICE(p) > 0)
- 		cpustat->nice += (__force cputime64_t) cputime;
- 	else
- 		cpustat->user += (__force cputime64_t) cputime;
 -	task_group_account_field(p, index, cputime);
++	task_group_account_field(p, index, (__force cputime64_t) cputime);
  
- 	cpuacct_update_stats(p, CPUACCT_STAT_USER, cputime);
  	/* Account for user time used */
  	acct_update_integrals(p);
  }
@@@ -3894,21 -2658,24 +2658,21 @@@
  static void account_guest_time(struct task_struct *p, cputime_t cputime,
  			       cputime_t cputime_scaled)
  {
- 	struct cpu_usage_stat *cpustat = &kstat_this_cpu.cpustat;
 -	u64 tmp;
+ 	u64 *cpustat = kcpustat_this_cpu->cpustat;
  
 -	tmp = cputime_to_cputime64(cputime);
 -
  	/* Add guest time to process. */
 -	p->utime = cputime_add(p->utime, cputime);
 -	p->utimescaled = cputime_add(p->utimescaled, cputime_scaled);
 +	p->utime += cputime;
 +	p->utimescaled += cputime_scaled;
  	account_group_user_time(p, cputime);
 -	p->gtime = cputime_add(p->gtime, cputime);
 +	p->gtime += cputime;
  
  	/* Add guest time to cpustat. */
  	if (TASK_NICE(p) > 0) {
- 		cpustat->nice += (__force cputime64_t) cputime;
- 		cpustat->guest_nice += (__force cputime64_t) cputime;
 -		cpustat[CPUTIME_NICE] += tmp;
 -		cpustat[CPUTIME_GUEST_NICE] += tmp;
++		cpustat[CPUTIME_NICE] += (__force cputime64_t) cputime;
++		cpustat[CPUTIME_GUEST_NICE] += (__force cputime64_t) cputime;
  	} else {
- 		cpustat->user += (__force cputime64_t) cputime;
- 		cpustat->guest += (__force cputime64_t) cputime;
 -		cpustat[CPUTIME_USER] += tmp;
 -		cpustat[CPUTIME_GUEST] += tmp;
++		cpustat[CPUTIME_USER] += (__force cputime64_t) cputime;
++		cpustat[CPUTIME_GUEST] += (__force cputime64_t) cputime;
  	}
  }
  
@@@ -3921,16 -2688,15 +2685,15 @@@
   */
  static inline
  void __account_system_time(struct task_struct *p, cputime_t cputime,
- 			cputime_t cputime_scaled, cputime64_t *target_cputime64)
+ 			cputime_t cputime_scaled, int index)
  {
  	/* Add system time to process. */
 -	p->stime = cputime_add(p->stime, cputime);
 -	p->stimescaled = cputime_add(p->stimescaled, cputime_scaled);
 +	p->stime += cputime;
 +	p->stimescaled += cputime_scaled;
  	account_group_system_time(p, cputime);
  
  	/* Add system time to cpustat. */
- 	*target_cputime64 += (__force cputime64_t) cputime;
- 	cpuacct_update_stats(p, CPUACCT_STAT_SYSTEM, cputime);
 -	task_group_account_field(p, index, cputime);
++	task_group_account_field(p, index, (__force cputime64_t) cputime);
  
  	/* Account for system time used */
  	acct_update_integrals(p);
@@@ -3970,9 -2735,10 +2732,9 @@@ void account_system_time(struct task_st
   */
  void account_steal_time(cputime_t cputime)
  {
- 	struct cpu_usage_stat *cpustat = &kstat_this_cpu.cpustat;
+ 	u64 *cpustat = kcpustat_this_cpu->cpustat;
 -	u64 cputime64 = cputime_to_cputime64(cputime);
  
- 	cpustat->steal += (__force cputime64_t) cputime;
 -	cpustat[CPUTIME_STEAL] += cputime64;
++	cpustat[CPUTIME_STEAL] += (__force cputime64_t) cputime;
  }
  
  /*
@@@ -3981,13 -2747,14 +2743,13 @@@
   */
  void account_idle_time(cputime_t cputime)
  {
- 	struct cpu_usage_stat *cpustat = &kstat_this_cpu.cpustat;
+ 	u64 *cpustat = kcpustat_this_cpu->cpustat;
  	struct rq *rq = this_rq();
  
  	if (atomic_read(&rq->nr_iowait) > 0)
- 		cpustat->iowait += (__force cputime64_t) cputime;
 -		cpustat[CPUTIME_IOWAIT] += cputime64;
++		cpustat[CPUTIME_IOWAIT] += (__force cputime64_t) cputime;
  	else
- 		cpustat->idle += (__force cputime64_t) cputime;
 -		cpustat[CPUTIME_IDLE] += cputime64;
++		cpustat[CPUTIME_IDLE] += (__force cputime64_t) cputime;
  }
  
  static __always_inline bool steal_account_process_tick(void)
@@@ -4037,15 -2804,16 +2799,15 @@@ static void irqtime_account_process_tic
  						struct rq *rq)
  {
  	cputime_t one_jiffy_scaled = cputime_to_scaled(cputime_one_jiffy);
- 	struct cpu_usage_stat *cpustat = &kstat_this_cpu.cpustat;
 -	u64 tmp = cputime_to_cputime64(cputime_one_jiffy);
+ 	u64 *cpustat = kcpustat_this_cpu->cpustat;
  
  	if (steal_account_process_tick())
  		return;
  
  	if (irqtime_account_hi_update()) {
- 		cpustat->irq += (__force cputime64_t) cputime_one_jiffy;
 -		cpustat[CPUTIME_IRQ] += tmp;
++		cpustat[CPUTIME_IRQ] += (__force cputime64_t) cputime_one_jiffy;
  	} else if (irqtime_account_si_update()) {
- 		cpustat->softirq += (__force cputime64_t) cputime_one_jiffy;
 -		cpustat[CPUTIME_SOFTIRQ] += tmp;
++		cpustat[CPUTIME_SOFTIRQ] += (__force cputime64_t) cputime_one_jiffy;
  	} else if (this_cpu_ksoftirqd() == p) {
  		/*
  		 * ksoftirqd time do not get accounted in cpu_softirq_time.
diff --cc drivers/cpufreq/cpufreq_conservative.c
index 7f31a03,118bff7..0000000
--- a/drivers/cpufreq/cpufreq_conservative.c
+++ b/drivers/cpufreq/cpufreq_conservative.c
@@@ -95,26 -95,26 +95,26 @@@ static struct dbs_tuners 
  	.freq_step = 5,
  };
  
- static inline cputime64_t get_cpu_idle_time_jiffy(unsigned int cpu,
- 							cputime64_t *wall)
+ static inline u64 get_cpu_idle_time_jiffy(unsigned int cpu, u64 *wall)
  {
- 	cputime64_t idle_time;
+ 	u64 idle_time;
  	cputime64_t cur_wall_time;
- 	cputime64_t busy_time;
+ 	u64 busy_time;
  
  	cur_wall_time = jiffies64_to_cputime64(get_jiffies_64());
- 	busy_time  = kstat_cpu(cpu).cpustat.user;
- 	busy_time += kstat_cpu(cpu).cpustat.system;
- 	busy_time += kstat_cpu(cpu).cpustat.irq;
- 	busy_time += kstat_cpu(cpu).cpustat.softirq;
- 	busy_time += kstat_cpu(cpu).cpustat.steal;
- 	busy_time += kstat_cpu(cpu).cpustat.nice;
+ 	busy_time = kcpustat_cpu(cpu).cpustat[CPUTIME_USER] +
+ 		    kcpustat_cpu(cpu).cpustat[CPUTIME_SYSTEM];
+ 
+ 	busy_time += kcpustat_cpu(cpu).cpustat[CPUTIME_IRQ];
+ 	busy_time += kcpustat_cpu(cpu).cpustat[CPUTIME_SOFTIRQ];
+ 	busy_time += kcpustat_cpu(cpu).cpustat[CPUTIME_STEAL];
+ 	busy_time += kcpustat_cpu(cpu).cpustat[CPUTIME_NICE];
  
 -	idle_time = cputime64_sub(cur_wall_time, busy_time);
 +	idle_time = cur_wall_time - busy_time;
  	if (wall)
- 		*wall = (cputime64_t)jiffies_to_usecs(cur_wall_time);
+ 		*wall = jiffies_to_usecs(cur_wall_time);
  
- 	return (cputime64_t)jiffies_to_usecs(idle_time);
+ 	return jiffies_to_usecs(idle_time);
  }
  
  static inline cputime64_t get_cpu_idle_time(unsigned int cpu, cputime64_t *wall)
diff --cc drivers/cpufreq/cpufreq_ondemand.c
index 07cffe2,f3d327c..0000000
--- a/drivers/cpufreq/cpufreq_ondemand.c
+++ b/drivers/cpufreq/cpufreq_ondemand.c
@@@ -119,26 -119,26 +119,26 @@@ static struct dbs_tuners 
  	.powersave_bias = 0,
  };
  
- static inline cputime64_t get_cpu_idle_time_jiffy(unsigned int cpu,
- 							cputime64_t *wall)
+ static inline u64 get_cpu_idle_time_jiffy(unsigned int cpu, u64 *wall)
  {
- 	cputime64_t idle_time;
+ 	u64 idle_time;
  	cputime64_t cur_wall_time;
- 	cputime64_t busy_time;
+ 	u64 busy_time;
  
  	cur_wall_time = jiffies64_to_cputime64(get_jiffies_64());
- 	busy_time  = kstat_cpu(cpu).cpustat.user;
- 	busy_time += kstat_cpu(cpu).cpustat.system;
- 	busy_time += kstat_cpu(cpu).cpustat.irq;
- 	busy_time += kstat_cpu(cpu).cpustat.softirq;
- 	busy_time += kstat_cpu(cpu).cpustat.steal;
- 	busy_time += kstat_cpu(cpu).cpustat.nice;
+ 	busy_time = kcpustat_cpu(cpu).cpustat[CPUTIME_USER] +
+ 		    kcpustat_cpu(cpu).cpustat[CPUTIME_SYSTEM];
+ 
+ 	busy_time += kcpustat_cpu(cpu).cpustat[CPUTIME_IRQ];
+ 	busy_time += kcpustat_cpu(cpu).cpustat[CPUTIME_SOFTIRQ];
+ 	busy_time += kcpustat_cpu(cpu).cpustat[CPUTIME_STEAL];
+ 	busy_time += kcpustat_cpu(cpu).cpustat[CPUTIME_NICE];
  
 -	idle_time = cputime64_sub(cur_wall_time, busy_time);
 +	idle_time = cur_wall_time - busy_time;
  	if (wall)
- 		*wall = (cputime64_t)jiffies_to_usecs(cur_wall_time);
+ 		*wall = jiffies_to_usecs(cur_wall_time);
  
- 	return (cputime64_t)jiffies_to_usecs(idle_time);
+ 	return jiffies_to_usecs(idle_time);
  }
  
  static inline cputime64_t get_cpu_idle_time(unsigned int cpu, cputime64_t *wall)

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

             reply	other threads:[~2011-12-07  4:10 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-07  4:09 Stephen Rothwell [this message]
2011-12-07 11:35 ` Glauber Costa
2011-12-07 11:59   ` Martin Schwidefsky
  -- strict thread matches above, loose matches on Subject: below --
2011-12-19  4:40 Stephen Rothwell
2011-12-19  8:08 ` Ingo Molnar
2011-12-19  9:11   ` Martin Schwidefsky
2011-12-19 10:35     ` Ingo Molnar
2011-12-19 11:25       ` Ingo Molnar
2011-12-19 14:24         ` Martin Schwidefsky
2011-12-19 16:30           ` Ingo Molnar
2011-12-19 19:06             ` Martin Schwidefsky
2011-12-20 11:09               ` Ingo Molnar
2011-12-19 12:31       ` Martin Schwidefsky
2011-12-19 13:43         ` Glauber Costa
2011-12-19 14:19           ` Martin Schwidefsky
2011-12-19 14:08         ` Peter Zijlstra
2011-12-19 14:25           ` Martin Schwidefsky
2011-12-20 10:19           ` Glauber Costa
2011-10-25  7:44 Stephen Rothwell
2011-10-25  7:40 Stephen Rothwell
2011-10-25 15:29 ` Michal Hocko
2011-10-25  7:35 Stephen Rothwell
2011-10-25 15:28 ` Michal Hocko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20111207150956.52d41fd8580de3b66abd5d2d@canb.auug.org.au \
    --to=sfr@canb.auug.org.au \
    --cc=glommer@parallels.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    --cc=schwidefsky@de.ibm.com \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®