Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1607386 > unrolled thread
| Started by | Viresh Kumar <viresh.kumar@linaro.org> |
|---|---|
| First post | 2017-03-23 12:40 +0100 |
| Last post | 2017-04-10 11:40 +0200 |
| Articles | 6 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH 0/4] sched: Minor cleanups Viresh Kumar <viresh.kumar@linaro.org> - 2017-03-23 12:40 +0100
[PATCH 1/4] sched: topology: drop memset() from init_rootdomain() Viresh Kumar <viresh.kumar@linaro.org> - 2017-03-23 12:40 +0100
[PATCH 4/4] sched: core: drop useless expression from sched_init() Viresh Kumar <viresh.kumar@linaro.org> - 2017-03-23 12:40 +0100
[PATCH 3/4] sched: cpupri: don't re-initialize struct cpupri Viresh Kumar <viresh.kumar@linaro.org> - 2017-03-23 12:40 +0100
Re: [PATCH 0/4] sched: Minor cleanups Peter Zijlstra <peterz@infradead.org> - 2017-03-27 16:00 +0200
Re: [PATCH 0/4] sched: Minor cleanups Viresh Kumar <viresh.kumar@linaro.org> - 2017-04-10 11:40 +0200
| From | Viresh Kumar <viresh.kumar@linaro.org> |
|---|---|
| Date | 2017-03-23 12:40 +0100 |
| Subject | [PATCH 0/4] sched: Minor cleanups |
| Message-ID | <to9fY-1zG-11@gated-at.bofh.it> |
Hi, Here are few minor cleanups for the sched core. The first three tries to avoid reinitializing memory which is already set to zero and the last one drops an unused statement. -- viresh Viresh Kumar (4): sched: topology: drop memset() from init_rootdomain() sched: cpudeadline: don't re-initialize struct cpudl sched: cpupri: don't re-initialize struct cpupri sched: core: drop useless expression from sched_init() kernel/sched/core.c | 1 - kernel/sched/cpudeadline.c | 2 -- kernel/sched/cpupri.c | 3 --- kernel/sched/topology.c | 4 +--- 4 files changed, 1 insertion(+), 9 deletions(-) -- 2.12.0.432.g71c3a4f4ba37
[toc] | [next] | [standalone]
| From | Viresh Kumar <viresh.kumar@linaro.org> |
|---|---|
| Date | 2017-03-23 12:40 +0100 |
| Subject | [PATCH 1/4] sched: topology: drop memset() from init_rootdomain() |
| Message-ID | <to9fZ-1zG-21@gated-at.bofh.it> |
| In reply to | #1607386 |
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
[toc] | [prev] | [next] | [standalone]
| From | Viresh Kumar <viresh.kumar@linaro.org> |
|---|---|
| Date | 2017-03-23 12:40 +0100 |
| Subject | [PATCH 4/4] sched: core: drop useless expression from sched_init() |
| Message-ID | <to9fZ-1zG-23@gated-at.bofh.it> |
| In reply to | #1607386 |
'ptr' is never used after setting 'rt_rq' and there is no need to update it. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> --- kernel/sched/core.c | 1 - 1 file changed, 1 deletion(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 6d6cad9a46af..bd33a05d038b 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -5992,7 +5992,6 @@ void __init sched_init(void) ptr += nr_cpu_ids * sizeof(void **); root_task_group.rt_rq = (struct rt_rq **)ptr; - ptr += nr_cpu_ids * sizeof(void **); #endif /* CONFIG_RT_GROUP_SCHED */ } -- 2.12.0.432.g71c3a4f4ba37
[toc] | [prev] | [next] | [standalone]
| From | Viresh Kumar <viresh.kumar@linaro.org> |
|---|---|
| Date | 2017-03-23 12:40 +0100 |
| Subject | [PATCH 3/4] sched: cpupri: don't re-initialize struct cpupri |
| Message-ID | <to9fZ-1zG-29@gated-at.bofh.it> |
| In reply to | #1607386 |
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 | 3 ---
1 file changed, 3 deletions(-)
diff --git a/kernel/sched/cpupri.c b/kernel/sched/cpupri.c
index 981fcd7dc394..d6165d87ef3e 100644
--- a/kernel/sched/cpupri.c
+++ b/kernel/sched/cpupri.c
@@ -209,12 +209,9 @@ 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];
- atomic_set(&vec->count, 0);
if (!zalloc_cpumask_var(&vec->mask, GFP_KERNEL))
goto cleanup;
}
--
2.12.0.432.g71c3a4f4ba37
[toc] | [prev] | [next] | [standalone]
| From | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| Date | 2017-03-27 16:00 +0200 |
| Message-ID | <tpDlE-r8-15@gated-at.bofh.it> |
| In reply to | #1607386 |
On Thu, Mar 23, 2017 at 05:05:55PM +0530, Viresh Kumar wrote: > Hi, > > Here are few minor cleanups for the sched core. The first three tries to > avoid reinitializing memory which is already set to zero and the last > one drops an unused statement. > I'm OK with the kzalloc/memset thing, but I'd prefer to keep all those other bits. Yes they're superfluous, but this is init code, so nobody cares about performance and having those things explitic makes it easier to read. As to the very latest patch, that's there so that if/when we extend that array we can simply continue. Also its more symmetric/consistent. Any half sane DCE pass should get rid of it anyway, as the result is unused.
[toc] | [prev] | [next] | [standalone]
| From | Viresh Kumar <viresh.kumar@linaro.org> |
|---|---|
| Date | 2017-04-10 11:40 +0200 |
| Message-ID | <tuDXI-7jz-17@gated-at.bofh.it> |
| In reply to | #1609862 |
On 27-03-17, 15:58, Peter Zijlstra wrote: > On Thu, Mar 23, 2017 at 05:05:55PM +0530, Viresh Kumar wrote: > > Hi, > > > > Here are few minor cleanups for the sched core. The first three tries to > > avoid reinitializing memory which is already set to zero and the last > > one drops an unused statement. > > > > I'm OK with the kzalloc/memset thing, I assume that you are fine with removal of memset as done in the first 3 patches. Or you are fine with just the first patch? > but I'd prefer to keep all those > other bits. > > Yes they're superfluous, but this is init code, so nobody cares about > performance and having those things explitic makes it easier to read. Sure. > As to the very latest patch, that's there so that if/when we extend that > array we can simply continue. Also its more symmetric/consistent. Any > half sane DCE pass should get rid of it anyway, as the result is unused. But we aren't going to extend the array all the time and keeping a statement like that just for symmetry doesn't sound that great :). Anyway, I will drop the last patch as you suggested. -- viresh
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web