Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758616AbbLCEpc (ORCPT ); Wed, 2 Dec 2015 23:45:32 -0500 Received: from mx1.redhat.com ([209.132.183.28]:36228 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758558AbbLCEpb (ORCPT ); Wed, 2 Dec 2015 23:45:31 -0500 From: Xunlei Pang To: linux-kernel@vger.kernel.org Cc: Peter Zijlstra , Ingo Molnar , Steven Rostedt , Xunlei Pang Subject: [PATCH v2 2/3] sched/cpupri: Cleanup of duplicate memory initialization Date: Thu, 3 Dec 2015 12:45:00 +0800 Message-Id: <1449117901-9561-2-git-send-email-xlpang@redhat.com> In-Reply-To: <1449117901-9561-1-git-send-email-xlpang@redhat.com> References: <1449117901-9561-1-git-send-email-xlpang@redhat.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1107 Lines: 34 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 --- 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/