From: Xunlei Pang <xlpang@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Steven Rostedt <rostedt@goodmis.org>,
Xunlei Pang <xlpang@redhat.com>
Subject: [PATCH v2 3/3] sched/cpudeadline: Cleanup of duplicate memory initialization
Date: Thu, 3 Dec 2015 12:45:01 +0800 [thread overview]
Message-ID: <1449117901-9561-3-git-send-email-xlpang@redhat.com> (raw)
In-Reply-To: <1449117901-9561-1-git-send-email-xlpang@redhat.com>
There is already a memset clear operation for '*cp', so we can use
alloc_cpumask_var() with __GFP_ZERO instead of zalloc_cpumask_var()
to avoid duplicate clear for systems without CONFIG_CPUMASK_OFFSTACK
set.
Also omit "cp->size = 0;".
Signed-off-by: Xunlei Pang <xlpang@redhat.com>
---
kernel/sched/cpudeadline.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/kernel/sched/cpudeadline.c b/kernel/sched/cpudeadline.c
index 5a75b08..ca780ec 100644
--- a/kernel/sched/cpudeadline.c
+++ b/kernel/sched/cpudeadline.c
@@ -211,7 +211,6 @@ int cpudl_init(struct cpudl *cp)
memset(cp, 0, sizeof(*cp));
raw_spin_lock_init(&cp->lock);
- cp->size = 0;
cp->elements = kcalloc(nr_cpu_ids,
sizeof(struct cpudl_item),
@@ -219,7 +218,7 @@ int cpudl_init(struct cpudl *cp)
if (!cp->elements)
return -ENOMEM;
- if (!zalloc_cpumask_var(&cp->free_cpus, GFP_KERNEL)) {
+ if (!alloc_cpumask_var(&cp->free_cpus, GFP_KERNEL | __GFP_ZERO)) {
kfree(cp->elements);
return -ENOMEM;
}
--
2.5.0
next prev parent reply other threads:[~2015-12-03 4:45 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-03 4:44 [PATCH v2 1/3] sched/core: Clear the root_domain cpumasks in init_rootdomain() Xunlei Pang
2015-12-03 4:45 ` [PATCH v2 2/3] sched/cpupri: Cleanup of duplicate memory initialization Xunlei Pang
2015-12-03 4:45 ` Xunlei Pang [this message]
2015-12-03 15:26 ` [PATCH v2 1/3] sched/core: Clear the root_domain cpumasks in init_rootdomain() Steven Rostedt
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=1449117901-9561-3-git-send-email-xlpang@redhat.com \
--to=xlpang@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
/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®