Skip to contentSkip to conversation

Staging: lustre: linux-cpu: Remove unnecessary wrapper functions

PATCH In review Shivani Bhardwaj 2 participants 4 messages Nov 2, 2015 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: lustre: linux-cpu: Remove unnecessary wrapper functions

Remove the functions cfs_cpu_core_siblings(), cfs_cpu_ht_siblings(), cfs_node_to_cpumask() and replace their calls with the functions they wrapped.

---
 .../staging/lustre/lustre/libcfs/linux/linux-cpu.c | 30 +++++-----------------
 1 file changed, 7 insertions(+), 23 deletions(-)
drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c +7 -23
index 2097364..31719af 100644
@@ -78,23 +78,6 @@ struct cfs_cpt_data {
 
 static struct cfs_cpt_data	cpt_data;
 
-static void cfs_cpu_core_siblings(int cpu, cpumask_t *mask)
-{
-	/* return cpumask of cores in the same socket */
-	cpumask_copy(mask, topology_core_cpumask(cpu));
-}
-
-/* return cpumask of HTs in the same core */
-static void cfs_cpu_ht_siblings(int cpu, cpumask_t *mask)
-{
-	cpumask_copy(mask, topology_sibling_cpumask(cpu));
-}
-
-static void cfs_node_to_cpumask(int node, cpumask_t *mask)
-{
-	cpumask_copy(mask, cpumask_of_node(node));
-}
-
 void
 cfs_cpt_table_free(struct cfs_cpt_table *cptab)
 {
@@ -426,7 +409,7 @@ cfs_cpt_set_node(struct cfs_cpt_table *cptab, int cpt, int node)
 	mutex_lock(&cpt_data.cpt_mutex);
 
 	mask = cpt_data.cpt_cpumask;
-	cfs_node_to_cpumask(node, mask);
+	cpumask_copy(mask, cpumask_of_node(node));
 
 	rc = cfs_cpt_set_cpumask(cptab, cpt, mask);
 
@@ -450,7 +433,7 @@ cfs_cpt_unset_node(struct cfs_cpt_table *cptab, int cpt, int node)
 	mutex_lock(&cpt_data.cpt_mutex);
 
 	mask = cpt_data.cpt_cpumask;
-	cfs_node_to_cpumask(node, mask);
+	cpumask_copy(mask, cpumask_of_node(node));
 
 	cfs_cpt_unset_cpumask(cptab, cpt, mask);
 
@@ -643,7 +626,7 @@ cfs_cpt_choose_ncpus(struct cfs_cpt_table *cptab, int cpt,
 		cpu = cpumask_first(node);
 
 		/* get cpumask for cores in the same socket */
-		cfs_cpu_core_siblings(cpu, socket);
+		cpumask_copy(socket, topology_core_cpumask(cpu));
 		cpumask_and(socket, socket, node);
 
 		LASSERT(!cpumask_empty(socket));
@@ -652,7 +635,7 @@ cfs_cpt_choose_ncpus(struct cfs_cpt_table *cptab, int cpt,
 			int     i;
 
 			/* get cpumask for hts in the same core */
-			cfs_cpu_ht_siblings(cpu, core);
+			cpumask_copy(socket, topology_sibling_cpumask(cpu));
 			cpumask_and(core, core, node);
 
 			LASSERT(!cpumask_empty(core));
@@ -769,7 +752,7 @@ cfs_cpt_table_create(int ncpt)
 	}
 
 	for_each_online_node(i) {
-		cfs_node_to_cpumask(i, mask);
+		cpumask_copy(mask, cpumask_of_node(i));
 
 		while (!cpumask_empty(mask)) {
 			struct cfs_cpu_partition *part;
@@ -968,7 +951,8 @@ cfs_cpu_notify(struct notifier_block *self, unsigned long action, void *hcpu)
 
 		mutex_lock(&cpt_data.cpt_mutex);
 		/* if all HTs in a core are offline, it may break affinity */
-		cfs_cpu_ht_siblings(cpu, cpt_data.cpt_cpumask);
+		cpumask_copy(cpt_data.cpt_cpumask,
+			     topology_sibling_cpumask(cpu));
 		warn = cpumask_any_and(cpt_data.cpt_cpumask,
 				       cpu_online_mask) >= nr_cpu_ids;
 		mutex_unlock(&cpt_data.cpt_mutex);
Signature · 1 line
2.1.0
maintainer
#1 lore raw
Quoted 24 lines · Shivani Bhardwaj

Remove the functions cfs_cpu_core_siblings(), cfs_cpu_ht_siblings(), cfs_node_to_cpumask() and replace their calls with the functions they wrapped.

---
 .../staging/lustre/lustre/libcfs/linux/linux-cpu.c | 30 +++++-----------------
 1 file changed, 7 insertions(+), 23 deletions(-)
drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c +0 -7
index 2097364..31719af 100644
@@ -78,23 +78,6 @@ struct cfs_cpt_data {
 
 static struct cfs_cpt_data	cpt_data;
 
-static void cfs_cpu_core_siblings(int cpu, cpumask_t *mask)
-{
-	/* return cpumask of cores in the same socket */
-	cpumask_copy(mask, topology_core_cpumask(cpu));
-}
-
-/* return cpumask of HTs in the same core */

drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c struct cfs_cpt_data { · line 81

Quoted 10 lines
drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c +0 -9
-static void cfs_cpu_ht_siblings(int cpu, cpumask_t *mask)
-{
-	cpumask_copy(mask, topology_sibling_cpumask(cpu));
-}
-
-static void cfs_node_to_cpumask(int node, cpumask_t *mask)
-{
-	cpumask_copy(mask, cpumask_of_node(node));
-}
 

Please remove one of these at a time, it makes it much easier to review the patch.

thanks,

greg k-h

#2 lore raw
Quoted 30 lines · Greg KH
Quoted 29 lines · Shivani Bhardwaj

Remove the functions cfs_cpu_core_siblings(), cfs_cpu_ht_siblings(), cfs_node_to_cpumask() and replace their calls with the functions they wrapped.

---
 .../staging/lustre/lustre/libcfs/linux/linux-cpu.c | 30 +++++-----------------
 1 file changed, 7 insertions(+), 23 deletions(-)
drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c +0 -12
index 2097364..31719af 100644
@@ -78,23 +78,6 @@ struct cfs_cpt_data {
 
 static struct cfs_cpt_data   cpt_data;
 
-static void cfs_cpu_core_siblings(int cpu, cpumask_t *mask)
-{
-     /* return cpumask of cores in the same socket */
-     cpumask_copy(mask, topology_core_cpumask(cpu));
-}
-
-/* return cpumask of HTs in the same core */
-static void cfs_cpu_ht_siblings(int cpu, cpumask_t *mask)
-{
-     cpumask_copy(mask, topology_sibling_cpumask(cpu));
-}
-
Quoted 9 lines

drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c struct cfs_cpt_data {

Quoted 5 lines
drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c +0 -4
-static void cfs_node_to_cpumask(int node, cpumask_t *mask)
-{
-     cpumask_copy(mask, cpumask_of_node(node));
-}
 

Please remove one of these at a time, it makes it much easier to review the patch.

Should I resend this one as well? I'll take care next time.

Thank you

Quoted 3 lines

thanks,

greg k-h

maintainer
#3 lore raw
Quoted 41 lines · Shivani Bhardwaj
Quoted 30 lines · Greg KH
Quoted 29 lines · Shivani Bhardwaj

Remove the functions cfs_cpu_core_siblings(), cfs_cpu_ht_siblings(), cfs_node_to_cpumask() and replace their calls with the functions they wrapped.

---
 .../staging/lustre/lustre/libcfs/linux/linux-cpu.c | 30 +++++-----------------
 1 file changed, 7 insertions(+), 23 deletions(-)
drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c +0 -12
index 2097364..31719af 100644
@@ -78,23 +78,6 @@ struct cfs_cpt_data {
 
 static struct cfs_cpt_data   cpt_data;
 
-static void cfs_cpu_core_siblings(int cpu, cpumask_t *mask)
-{
-     /* return cpumask of cores in the same socket */
-     cpumask_copy(mask, topology_core_cpumask(cpu));
-}
-
-/* return cpumask of HTs in the same core */
-static void cfs_cpu_ht_siblings(int cpu, cpumask_t *mask)
-{
-     cpumask_copy(mask, topology_sibling_cpumask(cpu));
-}
-
Quoted 9 lines

drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c struct cfs_cpt_data {

Quoted 5 lines
drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c +0 -4
-static void cfs_node_to_cpumask(int node, cpumask_t *mask)
-{
-     cpumask_copy(mask, cpumask_of_node(node));
-}
 

Please remove one of these at a time, it makes it much easier to review the patch.

Quoted 1 line

Should I resend this one as well?

Yes.