From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751564AbdINUpZ (ORCPT ); Thu, 14 Sep 2017 16:45:25 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40738 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751335AbdINUpY (ORCPT ); Thu, 14 Sep 2017 16:45:24 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 33AE090E69 Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=longman@redhat.com From: Waiman Long To: Tejun Heo , Li Zefan Cc: cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, Waiman Long Subject: [PATCH] cgroup: Properly init nr_tasks in cgroup_taskset Date: Thu, 14 Sep 2017 13:45:13 -0700 Message-Id: <1505421913-29577-1-git-send-email-longman@redhat.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 14 Sep 2017 20:45:24 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit 610467270fb3 ("cgroup: don't call migration methods if there are no tasks to migrate") introduces a new field nr_tasks to the cgroup_taskset structure for keeping track of the number of tasks contained in the structure. The initial value of this field, however, is not guaranteed to be 0 as all the cgroup_taskset structures are allocated from stack. Therefore, we need to explicitly initilized it in the CGROUP_TASKSET_INIT() macro for the new code to behave correctly. Signed-off-by: Waiman Long --- kernel/cgroup/cgroup-internal.h | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/cgroup/cgroup-internal.h b/kernel/cgroup/cgroup-internal.h index 5151ff2..6b4c04e 100644 --- a/kernel/cgroup/cgroup-internal.h +++ b/kernel/cgroup/cgroup-internal.h @@ -76,6 +76,7 @@ struct cgroup_mgctx { .src_csets = LIST_HEAD_INIT(tset.src_csets), \ .dst_csets = LIST_HEAD_INIT(tset.dst_csets), \ .csets = &tset.src_csets, \ + .nr_tasks = 0, \ } #define CGROUP_MGCTX_INIT(name) \ -- 1.8.3.1