All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V2 0/3] sched: Minor cleanups
@ 2017-04-13  9:15 Viresh Kumar
  2017-04-13  9:15 ` [PATCH V2 1/3] sched: topology: drop memset() from init_rootdomain() Viresh Kumar
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Viresh Kumar @ 2017-04-13  9:15 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra
  Cc: linaro-kernel, linux-kernel, Vincent Guittot, Viresh Kumar

Hi,

Avoid reinitializing memory which is already set to zero.

V1->V2:
- Don't remove field initializers from 2nd and 3rd patch.
- Drop 4th patch (sched: core: drop useless expression from sched_init()).

--
viresh

Viresh Kumar (3):
  sched: topology: drop memset() from init_rootdomain()
  sched: cpudeadline: don't re-initialize struct cpudl
  sched: cpupri: don't re-initialize struct cpupri

 kernel/sched/cpudeadline.c | 1 -
 kernel/sched/cpupri.c      | 2 --
 kernel/sched/topology.c    | 4 +---
 3 files changed, 1 insertion(+), 6 deletions(-)

-- 
2.12.0.432.g71c3a4f4ba37

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH V2 1/3] sched: topology: drop memset() from init_rootdomain()
  2017-04-13  9:15 [PATCH V2 0/3] sched: Minor cleanups Viresh Kumar
@ 2017-04-13  9:15 ` Viresh Kumar
  2017-08-10 12:05   ` [tip:sched/core] sched/topology: Drop " tip-bot for Viresh Kumar
  2017-04-13  9:15 ` [PATCH V2 2/3] sched: cpudeadline: don't re-initialize struct cpudl Viresh Kumar
  2017-04-13  9:15 ` [PATCH V2 3/3] sched: cpupri: don't re-initialize struct cpupri Viresh Kumar
  2 siblings, 1 reply; 7+ messages in thread
From: Viresh Kumar @ 2017-04-13  9:15 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra
  Cc: linaro-kernel, linux-kernel, Vincent Guittot, Viresh Kumar

There are only two callers of init_rootdomain(). One of them passes a
global to it and another one sends dynamically allocated root-domain.

There is no need to memset the root-domain in the first case as the
structure is already reset.

Update alloc_rootdomain() to allocate the memory with kzalloc() and
remove the memset() call from init_rootdomain().

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 kernel/sched/topology.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c
index 1b0b4fb12837..a2497702e628 100644
--- a/kernel/sched/topology.c
+++ b/kernel/sched/topology.c
@@ -242,8 +242,6 @@ void rq_attach_root(struct rq *rq, struct root_domain *rd)
 
 static int init_rootdomain(struct root_domain *rd)
 {
-	memset(rd, 0, sizeof(*rd));
-
 	if (!zalloc_cpumask_var(&rd->span, GFP_KERNEL))
 		goto out;
 	if (!zalloc_cpumask_var(&rd->online, GFP_KERNEL))
@@ -292,7 +290,7 @@ static struct root_domain *alloc_rootdomain(void)
 {
 	struct root_domain *rd;
 
-	rd = kmalloc(sizeof(*rd), GFP_KERNEL);
+	rd = kzalloc(sizeof(*rd), GFP_KERNEL);
 	if (!rd)
 		return NULL;
 
-- 
2.12.0.432.g71c3a4f4ba37

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH V2 2/3] sched: cpudeadline: don't re-initialize struct cpudl
  2017-04-13  9:15 [PATCH V2 0/3] sched: Minor cleanups Viresh Kumar
  2017-04-13  9:15 ` [PATCH V2 1/3] sched: topology: drop memset() from init_rootdomain() Viresh Kumar
@ 2017-04-13  9:15 ` Viresh Kumar
  2017-08-10 12:06   ` [tip:sched/core] sched/deadline: Don't re-initialize 'struct cpudl' tip-bot for Viresh Kumar
  2017-04-13  9:15 ` [PATCH V2 3/3] sched: cpupri: don't re-initialize struct cpupri Viresh Kumar
  2 siblings, 1 reply; 7+ messages in thread
From: Viresh Kumar @ 2017-04-13  9:15 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra
  Cc: linaro-kernel, linux-kernel, Vincent Guittot, Viresh Kumar

The struct cpudl passed to cpudl_init() is already initialized to zero.
Don't do that again.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 kernel/sched/cpudeadline.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/kernel/sched/cpudeadline.c b/kernel/sched/cpudeadline.c
index fba235c7d026..bdf448b6556f 100644
--- a/kernel/sched/cpudeadline.c
+++ b/kernel/sched/cpudeadline.c
@@ -246,7 +246,6 @@ int cpudl_init(struct cpudl *cp)
 {
 	int i;
 
-	memset(cp, 0, sizeof(*cp));
 	raw_spin_lock_init(&cp->lock);
 	cp->size = 0;
 
-- 
2.12.0.432.g71c3a4f4ba37

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH V2 3/3] sched: cpupri: don't re-initialize struct cpupri
  2017-04-13  9:15 [PATCH V2 0/3] sched: Minor cleanups Viresh Kumar
  2017-04-13  9:15 ` [PATCH V2 1/3] sched: topology: drop memset() from init_rootdomain() Viresh Kumar
  2017-04-13  9:15 ` [PATCH V2 2/3] sched: cpudeadline: don't re-initialize struct cpudl Viresh Kumar
@ 2017-04-13  9:15 ` Viresh Kumar
  2017-08-10 12:06   ` [tip:sched/core] sched/cpupri: Don't re-initialize 'struct cpupri' tip-bot for Viresh Kumar
  2 siblings, 1 reply; 7+ messages in thread
From: Viresh Kumar @ 2017-04-13  9:15 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra
  Cc: linaro-kernel, linux-kernel, Vincent Guittot, Viresh Kumar

The struct cpupri passed to cpupri_init() is already initialized to
zero. Don't do that again.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 kernel/sched/cpupri.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/kernel/sched/cpupri.c b/kernel/sched/cpupri.c
index 981fcd7dc394..2511aba36b89 100644
--- a/kernel/sched/cpupri.c
+++ b/kernel/sched/cpupri.c
@@ -209,8 +209,6 @@ int cpupri_init(struct cpupri *cp)
 {
 	int i;
 
-	memset(cp, 0, sizeof(*cp));
-
 	for (i = 0; i < CPUPRI_NR_PRIORITIES; i++) {
 		struct cpupri_vec *vec = &cp->pri_to_cpu[i];
 
-- 
2.12.0.432.g71c3a4f4ba37

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [tip:sched/core] sched/topology: Drop memset() from init_rootdomain()
  2017-04-13  9:15 ` [PATCH V2 1/3] sched: topology: drop memset() from init_rootdomain() Viresh Kumar
@ 2017-08-10 12:05   ` tip-bot for Viresh Kumar
  0 siblings, 0 replies; 7+ messages in thread
From: tip-bot for Viresh Kumar @ 2017-08-10 12:05 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: viresh.kumar, peterz, vincent.guittot, mingo, tglx, linux-kernel,
	torvalds, hpa

Commit-ID:  4d13a06d54c415238325b0fe2c14f1052da4512f
Gitweb:     http://git.kernel.org/tip/4d13a06d54c415238325b0fe2c14f1052da4512f
Author:     Viresh Kumar <viresh.kumar@linaro.org>
AuthorDate: Thu, 13 Apr 2017 14:45:48 +0530
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Thu, 10 Aug 2017 12:18:13 +0200

sched/topology: Drop memset() from init_rootdomain()

There are only two callers of init_rootdomain(). One of them passes a
global to it and another one sends dynamically allocated root-domain.

There is no need to memset the root-domain in the first case as the
structure is already reset.

Update alloc_rootdomain() to allocate the memory with kzalloc() and
remove the memset() call from init_rootdomain().

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Vincent Guittot <vincent.guittot@linaro.org>
Cc: linaro-kernel@lists.linaro.org
Link: http://lkml.kernel.org/r/fc2f6cc90b098040970c85a97046512572d765bc.1492065513.git.viresh.kumar@linaro.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 kernel/sched/topology.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c
index 79895ae..216fee0 100644
--- a/kernel/sched/topology.c
+++ b/kernel/sched/topology.c
@@ -261,8 +261,6 @@ void rq_attach_root(struct rq *rq, struct root_domain *rd)
 
 static int init_rootdomain(struct root_domain *rd)
 {
-	memset(rd, 0, sizeof(*rd));
-
 	if (!zalloc_cpumask_var(&rd->span, GFP_KERNEL))
 		goto out;
 	if (!zalloc_cpumask_var(&rd->online, GFP_KERNEL))
@@ -311,7 +309,7 @@ static struct root_domain *alloc_rootdomain(void)
 {
 	struct root_domain *rd;
 
-	rd = kmalloc(sizeof(*rd), GFP_KERNEL);
+	rd = kzalloc(sizeof(*rd), GFP_KERNEL);
 	if (!rd)
 		return NULL;
 

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [tip:sched/core] sched/deadline: Don't re-initialize 'struct cpudl'
  2017-04-13  9:15 ` [PATCH V2 2/3] sched: cpudeadline: don't re-initialize struct cpudl Viresh Kumar
@ 2017-08-10 12:06   ` tip-bot for Viresh Kumar
  0 siblings, 0 replies; 7+ messages in thread
From: tip-bot for Viresh Kumar @ 2017-08-10 12:06 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: hpa, linux-kernel, mingo, viresh.kumar, torvalds, tglx, peterz,
	vincent.guittot

Commit-ID:  42d394d41ab90f4ed9d7a7403ed22e8f7590948a
Gitweb:     http://git.kernel.org/tip/42d394d41ab90f4ed9d7a7403ed22e8f7590948a
Author:     Viresh Kumar <viresh.kumar@linaro.org>
AuthorDate: Thu, 13 Apr 2017 14:45:49 +0530
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Thu, 10 Aug 2017 12:18:13 +0200

sched/deadline: Don't re-initialize 'struct cpudl'

The 'struct cpudl' passed to cpudl_init() is already initialized to zero.
Don't do that again.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Vincent Guittot <vincent.guittot@linaro.org>
Cc: linaro-kernel@lists.linaro.org
Link: http://lkml.kernel.org/r/bd4c229806bc96694b15546207afcc221387d2f5.1492065513.git.viresh.kumar@linaro.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 kernel/sched/cpudeadline.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/kernel/sched/cpudeadline.c b/kernel/sched/cpudeadline.c
index fba235c..bdf448b 100644
--- a/kernel/sched/cpudeadline.c
+++ b/kernel/sched/cpudeadline.c
@@ -246,7 +246,6 @@ int cpudl_init(struct cpudl *cp)
 {
 	int i;
 
-	memset(cp, 0, sizeof(*cp));
 	raw_spin_lock_init(&cp->lock);
 	cp->size = 0;
 

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [tip:sched/core] sched/cpupri: Don't re-initialize 'struct cpupri'
  2017-04-13  9:15 ` [PATCH V2 3/3] sched: cpupri: don't re-initialize struct cpupri Viresh Kumar
@ 2017-08-10 12:06   ` tip-bot for Viresh Kumar
  0 siblings, 0 replies; 7+ messages in thread
From: tip-bot for Viresh Kumar @ 2017-08-10 12:06 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: hpa, tglx, linux-kernel, torvalds, viresh.kumar, mingo,
	vincent.guittot, peterz

Commit-ID:  1c2a4861dbfca373fea1ff2cf9e9793933d024ce
Gitweb:     http://git.kernel.org/tip/1c2a4861dbfca373fea1ff2cf9e9793933d024ce
Author:     Viresh Kumar <viresh.kumar@linaro.org>
AuthorDate: Thu, 13 Apr 2017 14:45:50 +0530
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Thu, 10 Aug 2017 12:18:14 +0200

sched/cpupri: Don't re-initialize 'struct cpupri'

The 'struct cpupri' passed to cpupri_init() is already initialized to
zero. Don't do that again.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Vincent Guittot <vincent.guittot@linaro.org>
Cc: linaro-kernel@lists.linaro.org
Link: http://lkml.kernel.org/r/8a71d48c5a077500b6ddc1a41484c0ac8d3aad94.1492065513.git.viresh.kumar@linaro.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 kernel/sched/cpupri.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/kernel/sched/cpupri.c b/kernel/sched/cpupri.c
index 981fcd7..2511aba 100644
--- a/kernel/sched/cpupri.c
+++ b/kernel/sched/cpupri.c
@@ -209,8 +209,6 @@ int cpupri_init(struct cpupri *cp)
 {
 	int i;
 
-	memset(cp, 0, sizeof(*cp));
-
 	for (i = 0; i < CPUPRI_NR_PRIORITIES; i++) {
 		struct cpupri_vec *vec = &cp->pri_to_cpu[i];
 

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-08-10 12:09 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-13  9:15 [PATCH V2 0/3] sched: Minor cleanups Viresh Kumar
2017-04-13  9:15 ` [PATCH V2 1/3] sched: topology: drop memset() from init_rootdomain() Viresh Kumar
2017-08-10 12:05   ` [tip:sched/core] sched/topology: Drop " tip-bot for Viresh Kumar
2017-04-13  9:15 ` [PATCH V2 2/3] sched: cpudeadline: don't re-initialize struct cpudl Viresh Kumar
2017-08-10 12:06   ` [tip:sched/core] sched/deadline: Don't re-initialize 'struct cpudl' tip-bot for Viresh Kumar
2017-04-13  9:15 ` [PATCH V2 3/3] sched: cpupri: don't re-initialize struct cpupri Viresh Kumar
2017-08-10 12:06   ` [tip:sched/core] sched/cpupri: Don't re-initialize 'struct cpupri' tip-bot for Viresh Kumar

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.