From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E660AC433DF for ; Mon, 19 Oct 2020 17:36:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 93251222EC for ; Mon, 19 Oct 2020 17:36:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728308AbgJSRgV (ORCPT ); Mon, 19 Oct 2020 13:36:21 -0400 Received: from foss.arm.com ([217.140.110.172]:34538 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727673AbgJSRgV (ORCPT ); Mon, 19 Oct 2020 13:36:21 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A032C30E; Mon, 19 Oct 2020 10:36:20 -0700 (PDT) Received: from e113632-lin (e113632-lin.cambridge.arm.com [10.1.194.46]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 862593F66B; Mon, 19 Oct 2020 10:36:18 -0700 (PDT) References: <20201015110532.738127234@infradead.org> <20201015110923.910090294@infradead.org> User-agent: mu4e 0.9.17; emacs 26.3 From: Valentin Schneider To: Tao Zhou Cc: Peter Zijlstra , tglx@linutronix.de, mingo@kernel.org, linux-kernel@vger.kernel.org, bigeasy@linutronix.de, qais.yousef@arm.com, swood@redhat.com, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, bristot@redhat.com, vincent.donnefort@arm.com, tj@kernel.org Subject: Re: [PATCH v3 10/19] sched: Fix migrate_disable() vs set_cpus_allowed_ptr() In-reply-to: Date: Mon, 19 Oct 2020 18:36:16 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 19/10/20 17:32, Tao Zhou wrote: > Hi Valentin, >> >> Side thought: don't we need to NULL p->migration_pending in __sched_fork()? >> > > No need, if fork happen, the forked task will inherit that pending. Which is what I'm worrying about. I think we can ignore migrate_disable() for now and just consider a task fork()'ing while another tries to sched_setaffinity() it; say the fork() happens just after the pending has been installed. Unless I'm overthinking it, we could end up with a dangling pending reference, which will wreck havock to any later affine_move_task() (see the if (p->migration_pending) paths). > If pending is NULL, when call SCA, it will install pending. If pending > is not NULL, it means it is in migrate region and wait for complete. > If NULL pending in __sched_fork() it will install a new pending in this > case which is not right to me. Add a flag(ENABLE_MIGRATE) to arg will > differ the path where in. > > Always likely miss something. > > Tao >