[Devel] [PATCH RHEL7 COMMIT] kstat: Drop cpu argument in KSTAT_LAT_PCPU_ADD()

Konstantin Khorenko khorenko at virtuozzo.com
Wed Dec 20 12:00:08 MSK 2017


The commit is pushed to "branch-rh7-3.10.0-693.11.1.vz7.39.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-693.11.1.vz7.39.8
------>
commit a07adc716d40fd57c48c368a8631ed6a97e830cb
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Wed Dec 20 12:00:08 2017 +0300

    kstat: Drop cpu argument in KSTAT_LAT_PCPU_ADD()
    
    This function is always called for smp_processor_id().
    So, the argument is useless, and it has to be removed.
    
    Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 include/linux/vzstat.h  | 4 ++--
 kernel/sched/fair.c     | 8 ++------
 kernel/ve/vzstat_core.c | 5 ++---
 mm/memory.c             | 5 ++---
 mm/page_alloc.c         | 2 +-
 5 files changed, 9 insertions(+), 15 deletions(-)

diff --git a/include/linux/vzstat.h b/include/linux/vzstat.h
index 879b93b5aad2..43a50f736887 100644
--- a/include/linux/vzstat.h
+++ b/include/linux/vzstat.h
@@ -105,14 +105,14 @@ extern void KSTAT_PERF_ADD(struct kstat_perf_pcpu_struct *ptr, u64 real_time,
 	sleep_time = current->se.statistics->sum_sleep_runtime - sleep_time; \
 	KSTAT_PERF_ADD(&kstat_glob.name, start, start - sleep_time);
 
-extern void KSTAT_LAT_PCPU_ADD(struct kstat_lat_pcpu_struct *p, int cpu, u64 dur);
+extern void KSTAT_LAT_PCPU_ADD(struct kstat_lat_pcpu_struct *p, u64 dur);
 extern void KSTAT_LAT_PCPU_UPDATE(struct kstat_lat_pcpu_struct *p);
 
 #else
 #define KSTAT_PERF_ADD(ptr, real_time, cpu_time)
 #define KSTAT_PERF_ENTER(name)
 #define KSTAT_PERF_LEAVE(name)
-#define KSTAT_LAT_PCPU_ADD(p, cpu, dur)
+#define KSTAT_LAT_PCPU_ADD(p, dur)
 #define KSTAT_LAT_PCPU_UPDATE(p)
 #define KSTAT_LAT_PCPU_UPDATE(p)
 #endif
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 569777864212..16c53d348c0f 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -880,18 +880,14 @@ update_stats_wait_start(struct cfs_rq *cfs_rq, struct sched_entity *se)
 static inline void update_sched_lat(struct task_struct *t, u64 now)
 {
 #ifdef CONFIG_VE
-	int cpu;
 	u64 ve_wstamp;
 
 	/* safe due to runqueue lock */
-	cpu = smp_processor_id();
 	ve_wstamp = t->se.statistics->wait_start;
 
 	if (ve_wstamp && now > ve_wstamp) {
-		KSTAT_LAT_PCPU_ADD(&kstat_glob.sched_lat,
-				cpu, now - ve_wstamp);
-		KSTAT_LAT_PCPU_ADD(&t->task_ve->sched_lat_ve,
-				cpu, now - ve_wstamp);
+		KSTAT_LAT_PCPU_ADD(&kstat_glob.sched_lat, now - ve_wstamp);
+		KSTAT_LAT_PCPU_ADD(&t->task_ve->sched_lat_ve, now - ve_wstamp);
 	}
 #endif
 }
diff --git a/kernel/ve/vzstat_core.c b/kernel/ve/vzstat_core.c
index 24a0e1e56101..f048bcc0fe89 100644
--- a/kernel/ve/vzstat_core.c
+++ b/kernel/ve/vzstat_core.c
@@ -43,12 +43,11 @@ void KSTAT_PERF_ADD(struct kstat_perf_pcpu_struct *ptr, u64 real_time, u64 cpu_t
  *      ktime_get()
  *       read_seqcount_begin(&xtime_lock);
  */
-void KSTAT_LAT_PCPU_ADD(struct kstat_lat_pcpu_struct *p, int cpu,
-		u64 dur)
+void KSTAT_LAT_PCPU_ADD(struct kstat_lat_pcpu_struct *p, u64 dur)
 {
 	struct kstat_lat_pcpu_snap_struct *cur;
 
-	cur = per_cpu_ptr(p->cur, cpu);
+	cur = this_cpu_ptr(p->cur);
 	write_seqcount_begin(&cur->lock);
 	cur->count++;
 	if (cur->maxlat < dur)
diff --git a/mm/memory.c b/mm/memory.c
index 13e9dc577dbd..54c447ee7648 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -2673,7 +2673,7 @@ static int do_swap_page(struct mm_struct *mm, struct vm_area_struct *vma,
 	pte_unmap_unlock(page_table, ptl);
 out:
 	local_irq_disable();
-	KSTAT_LAT_PCPU_ADD(&kstat_glob.swap_in, smp_processor_id(), get_cycles() - start);
+	KSTAT_LAT_PCPU_ADD(&kstat_glob.swap_in, get_cycles() - start);
 	local_irq_enable();
 
 	return ret;
@@ -2818,8 +2818,7 @@ static int __do_fault(struct vm_area_struct *vma, unsigned long address,
 		VM_BUG_ON_PAGE(!PageLocked(vmf.page), vmf.page);
 
 	local_irq_disable();
-	KSTAT_LAT_PCPU_ADD(&kstat_glob.page_in, smp_processor_id(),
-			get_cycles() - start);
+	KSTAT_LAT_PCPU_ADD(&kstat_glob.page_in, get_cycles() - start);
 	local_irq_enable();
 
 	*page = vmf.page;
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 40700c3bd133..6f7cb012508e 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -3131,7 +3131,7 @@ static void __alloc_collect_stats(gfp_t gfp_mask, unsigned int order,
 
 	local_irq_save(flags);
 	cpu = smp_processor_id();
-	KSTAT_LAT_PCPU_ADD(&kstat_glob.alloc_lat[ind], cpu, time);
+	KSTAT_LAT_PCPU_ADD(&kstat_glob.alloc_lat[ind], time);
 	if (!page)
 		kstat_glob.alloc_fails[cpu][ind]++;
 	local_irq_restore(flags);


More information about the Devel mailing list