Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp545128ybt; Wed, 17 Jun 2020 07:46:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzqKYX2jW/bS300TDGYdZRG1RUqSydqkanvt8BFYptIWiyFymB6Js9aSkfKfftVaHWRo95v X-Received: by 2002:a50:8ad3:: with SMTP id k19mr7511377edk.162.1592405213429; Wed, 17 Jun 2020 07:46:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592405213; cv=none; d=google.com; s=arc-20160816; b=lmuq13nKB6inemo3VGMdyY5rmIZ6lF2Lz5slFThZia7kRpvR0tEoE4IaxrHSZSbw26 359yvBDD9hi8lDisdjXO2Yes7QCQk38RyCD/akyrtOwoqwzNN/1orQHKZo3Q4M5/keHv NBMgVtxbQtFJ3nv9RZ9l02KcqdJPPzVie0kJR0Rx8wa9jsiYTS9oGeUWHcc+QEOpCC+U rd7KfomfeF5jchCkvq2ex2joxonHzNtSiKz00NHcy4tCJL3maq4Jx6YnNe1JueffNxvO 7wIWzruO5iT6yfL/O39F4gNSV+grubcY+/dxuQX6eOH6zWmRU3nXsdUJ60Yn+oHwUVMS 3vFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:in-reply-to :subject:cc:to:from:user-agent:references; bh=QQJPBNKVncbysqc6+NS6L1tP0JybZGsNzALPkmz9Wlo=; b=lVPGiExOPAkiYxumZyclb3uFsRHi1fw8+aO56boBz8/cqBdakl4Trytg/MBL6AG6p9 IWSd06xoOcIRdUzbJYpKacjepWwoVSH/rXXmnnx7zM+Wz0aPd2EhwHQ0zy3Mh/V0Tp7c RpuNrhd+l+G1zGEiuYINSXCvQebV9Zrri2YvHKXxI7fRLlPkWz+/HhlhOfBOAV+IYxLp 2E0NvKCoNFMHou2BGQI6pW0KAGJOOC+bH50fu3yQdlIEMIOL/qmRNejNuwKeyEY7LFms 6tf4fmFsSbW4cQoe0QeNyzP+yJ4IE4AjcpDN7ng9mY5925hoEHF6mnvuoEJlGjFUIEfE yRDA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w27si93980edi.519.2020.06.17.07.46.28; Wed, 17 Jun 2020 07:46:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727003AbgFQOPj (ORCPT + 99 others); Wed, 17 Jun 2020 10:15:39 -0400 Received: from foss.arm.com ([217.140.110.172]:58646 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726328AbgFQOPi (ORCPT ); Wed, 17 Jun 2020 10:15:38 -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 3239B31B; Wed, 17 Jun 2020 07:15:38 -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 A08603F73C; Wed, 17 Jun 2020 07:15:36 -0700 (PDT) References: <20200617121742.cpxppyi7twxmpin7@linutronix.de> User-agent: mu4e 0.9.17; emacs 26.3 From: Valentin Schneider To: Sebastian Andrzej Siewior Cc: linux-kernel@vger.kernel.org, Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Thomas Gleixner , Scott Wood Subject: Re: [PATCH] sched: __set_cpus_allowed_ptr(): Check cpus_mask, not cpus_ptr In-reply-to: <20200617121742.cpxppyi7twxmpin7@linutronix.de> Date: Wed, 17 Jun 2020 15:15:31 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 17/06/20 13:17, Sebastian Andrzej Siewior wrote: > From: Scott Wood > > This function is concerned with the long-term cpu mask, not the > transitory mask the task might have while migrate disabled. Before > this patch, if a task was migrate disabled at the time > __set_cpus_allowed_ptr() was called, and the new mask happened to be > equal to the cpu that the task was running on, then the mask update > would be lost. > > Signed-off-by: Scott Wood > Signed-off-by: Sebastian Andrzej Siewior > --- > kernel/sched/core.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > --- a/kernel/sched/core.c > +++ b/kernel/sched/core.c > @@ -1637,7 +1637,7 @@ static int __set_cpus_allowed_ptr(struct > goto out; > } > > - if (cpumask_equal(p->cpus_ptr, new_mask)) > + if (cpumask_equal(&p->cpus_mask, new_mask)) > goto out; > > /* Makes sense, but what about the rest of the checks? Further down there is /* Can the task run on the task's current CPU? If so, we're done */ if (cpumask_test_cpu(task_cpu(p), new_mask)) goto out; If the task is currently migrate disabled and for some stupid reason it gets affined elsewhere, we could try to move it out - which AFAICT we don't want to do because migrate disabled. So I suppose you'd want an extra bailout condition here when the task is migrate disabled. ISTR in RT you do re-check the affinity and potentially move the task away when re-enabling migration, so that should work out all fine.