Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1282703

[PATCH v2 2/3] sched/cpupri: Cleanup of duplicate memory initialization

From Xunlei Pang <xlpang@redhat.com>
Newsgroups linux.kernel
Subject [PATCH v2 2/3] sched/cpupri: Cleanup of duplicate memory initialization
Date 2015-12-03 05:50 +0100
Message-ID <qBu0a-at-5@gated-at.bofh.it> (permalink)
References <qBu0a-at-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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 "atomic_set(&vec->count, 0);".

Signed-off-by: Xunlei Pang <xlpang@redhat.com>
---
 kernel/sched/cpupri.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/kernel/sched/cpupri.c b/kernel/sched/cpupri.c
index 981fcd7..b8f73a7 100644
--- a/kernel/sched/cpupri.c
+++ b/kernel/sched/cpupri.c
@@ -214,8 +214,7 @@ int cpupri_init(struct cpupri *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))
+		if (!alloc_cpumask_var(&vec->mask, GFP_KERNEL | __GFP_ZERO))
 			goto cleanup;
 	}
 
-- 
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 1/3] sched/core: Clear the root_domain cpumasks in init_rootdomain() Xunlei Pang <xlpang@redhat.com> - 2015-12-03 05:50 +0100
  [PATCH v2 2/3] sched/cpupri: Cleanup of duplicate memory initialization Xunlei Pang <xlpang@redhat.com> - 2015-12-03 05:50 +0100
  [PATCH v2 3/3] sched/cpudeadline: Cleanup of duplicate memory initialization Xunlei Pang <xlpang@redhat.com> - 2015-12-03 05:50 +0100
  Re: [PATCH v2 1/3] sched/core: Clear the root_domain cpumasks in  init_rootdomain() Steven Rostedt <rostedt@goodmis.org> - 2015-12-03 16:30 +0100

csiph-web