mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Waiman Long <longman@redhat.com>
To: Tejun Heo <tj@kernel.org>
Cc: Li Zefan <lizefan@huawei.com>,
	cgroups@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] cgroup: Properly init nr_tasks in cgroup_taskset
Date: Fri, 15 Sep 2017 11:28:35 -0700	[thread overview]
Message-ID: <d34d2f65-ef68-29d1-05e8-7f0ba0e0e6cf@redhat.com> (raw)
In-Reply-To: <20170915154743.GF378890@devbig577.frc2.facebook.com>

On 09/15/2017 08:47 AM, Tejun Heo wrote:
> Hello, Waiman.
>
> On Thu, Sep 14, 2017 at 01:45:13PM -0700, Waiman Long wrote:
>> 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 <longman@redhat.com>
>> ---
>>  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,	Y			\
>> +	.nr_tasks		= 0,						\
> But it's an initialization macro, which means that the only way thhese
> are used is as a part of whole struct initialization and the compiler
> would always set the unspecified fields to zero.
>
> Thanks.
>
You are right. I checked the assembly code and it did initialize the
other fields of the structure to 0. So my fix is bogus.

I sent this patch out because our QE people were still seeing the same
panic in PPC machines even with your patch applied. So I mistakenly
thought maybe the structure initialization wasn't complete. I will have
to further into why this was still happening.

Sorry for bothering you.

Cheers,
Longman

      reply	other threads:[~2017-09-15 18:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-14 20:45 Waiman Long
2017-09-15 15:47 ` Tejun Heo
2017-09-15 18:28   ` Waiman Long [this message]

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=d34d2f65-ef68-29d1-05e8-7f0ba0e0e6cf@redhat.com \
    --to=longman@redhat.com \
    --cc=cgroups@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizefan@huawei.com \
    --cc=tj@kernel.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®