Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp4502345img; Tue, 26 Mar 2019 10:35:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqwz2f8gYQ2roL/7gP6px3NYI0rzbfgwLhzqytXqHBFNAvHyN9hyR0HezYUjkiHDeStwVkOb X-Received: by 2002:a63:6bc6:: with SMTP id g189mr30339531pgc.427.1553621738213; Tue, 26 Mar 2019 10:35:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553621738; cv=none; d=google.com; s=arc-20160816; b=O13fJOBVBV781cebhVMKc2l0kRb6fNdIpoPDE/qcnlJF5OanLkKOKLsLV2n6z4BlB5 pH1nhAVENhKvwP0USqL1WqUIqN9dsI++nqfybnmvDSOayGSmZMTauR+QqZxABsSQ76/j xZPBJ0WG7zTrSQ5nPh0Oq1jahbVEcwpFzfN66mWiBoNRT8JIUZ56MEZLU2VCQj9HXfkd bYu+GSjsBuUpz695/FDAfSpm71v62DeMgQ/AxgzcouSeNYWx+nkJHXF96J+n/X4M41lj ClZxoQELbWg6MMXZ+qPJ6IlHOxFfkja4QXpWT8hMKif0BmBLXLk1Dd5x35azMnbyCMk4 dKbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=DLuJ0wj4n+0ibLZZrTu59HKM35jmmkFdA9L8eoJFKoI=; b=cRg1NnPbSV1Cx4dQe8dkl3REsTb3WS4V8FCtJcoGGzia+IXCHDRmfw47/s1B6GyL6T shbySIpJ9BqkJC9TZISpML4ytmm8bT16Gi0s5X4esNCN/ZfOMotRtI+7BaNssjNnH8n0 qglRPcpc3dzB9tKGhTq32f66o0OOkpR3vr0bVh6aDw4fY6Saxrkgv/BqECCq+udOHSZZ eM1tNKZqmtvw+0uQSFZXoOX27fi3W3aNIZFWRjGrVu1FvZAdUIkyNPZE7vq7Wacl0Rkc T9N8P1j14UA/SvwhI2JToWKxEcVsqdbva0gvOXfwPpu4KEbV1HpaOdMB4zn+WX3/2yc8 8tgg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h13si3114350pgr.133.2019.03.26.10.35.22; Tue, 26 Mar 2019 10:35:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732423AbfCZRdM (ORCPT + 99 others); Tue, 26 Mar 2019 13:33:12 -0400 Received: from mail-oi1-f195.google.com ([209.85.167.195]:43575 "EHLO mail-oi1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732406AbfCZRdL (ORCPT ); Tue, 26 Mar 2019 13:33:11 -0400 Received: by mail-oi1-f195.google.com with SMTP id 67so10541542oif.10 for ; Tue, 26 Mar 2019 10:33:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=DLuJ0wj4n+0ibLZZrTu59HKM35jmmkFdA9L8eoJFKoI=; b=DMLEWF6zC6/ibMk1LzlT+q8t++w/QByoFKd2SQB/tvNZzjlwjnflaB/8kmZDq75/NN bl6F8RguWM8/GGRumtnsFAoor4Am43I6b8z1KRVA6riu1bC+p9hbX/zxzYTQGK5ixUvH U0wSDmNbq3Arpr6DCuZfAydEHdv/bDmFOUTJby985VQwwq1bHRXGTgk0TfHsQ/4zfA+K Fxfu+5F0gBfMOKwcMrW4mvXcMR/Ypx3EBhELDV/QXJEz0ljmgRgqXBfh79hQKWt0f7Un v5RL5gJc08BtlOiySndhCX6N8/NTNnC3cEY/TmVuwkialkCjh2mglUBLJLyz4frxa6iW zR7g== X-Gm-Message-State: APjAAAXwUJ9WCujQ1VrfXy9RGOu+/oWsUGzSVMnctJe8CGcOmkHJYvVO VjzQf2m6XO/MgV4uFqDRc0hK6jMTy2BBGtkFYBvCpqj0Spo= X-Received: by 2002:aca:af56:: with SMTP id y83mr16730188oie.17.1553621590480; Tue, 26 Mar 2019 10:33:10 -0700 (PDT) MIME-Version: 1.0 References: <1551920088-30685-1-git-send-email-jsavitz@redhat.com> In-Reply-To: From: Joel Savitz Date: Tue, 26 Mar 2019 13:32:59 -0400 Message-ID: Subject: Re: [PATCH] cpuset: restore sanity to cpuset_cpus_allowed_fallback() To: linux-kernel@vger.kernel.org Cc: Li Zefan , cgroups@vger.kernel.org, Philip Auld Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Forgot to add cc's... my bad. Best, Joel Savitz On Tue, Mar 26, 2019 at 1:31 PM Joel Savitz wrote: > > Ping! > > Does anyone have any comments or concerns about this patch? > > Best, > Joel Savitz > > Best, > Joel Savitz > > > On Thu, Mar 7, 2019 at 9:42 AM Joel Savitz wrote: > > > > On Wed, Mar 6, 2019 at 7:55 PM Joel Savitz wrote: > > > > > > If a process is limited by taskset (i.e. cpuset) to only be allowed to > > > run on cpu N, and then cpu N is offlined via hotplug, the process will > > > be assigned the current value of its cpuset cgroup's effective_cpus field > > > in a call to do_set_cpus_allowed() in cpuset_cpus_allowed_fallback(). > > > This argument's value does not makes sense for this case, because > > > task_cs(tsk)->effective_cpus is modified by cpuset_hotplug_workfn() > > > to reflect the new value of cpu_active_mask after cpu N is removed from > > > the mask. While this may make sense for the cgroup affinity mask, it > > > does not make sense on a per-task basis, as a task that was previously > > > limited to only be run on cpu N will be limited to every cpu _except_ for > > > cpu N after it is offlined/onlined via hotplug. > > > > > > Pre-patch behavior: > > > > > > $ grep Cpus /proc/$$/status > > > Cpus_allowed: ff > > > Cpus_allowed_list: 0-7 > > > > > > $ taskset -p 4 $$ > > > pid 19202's current affinity mask: f > > > pid 19202's new affinity mask: 4 > > > > > > $ grep Cpus /proc/self/status > > > Cpus_allowed: 04 > > > Cpus_allowed_list: 2 > > > > > > # echo off > /sys/devices/system/cpu/cpu2/online > > > $ grep Cpus /proc/$$/status > > > Cpus_allowed: 0b > > > Cpus_allowed_list: 0-1,3 > > > > > > # echo on > /sys/devices/system/cpu/cpu2/online > > > $ grep Cpus /proc/$$/status > > > Cpus_allowed: 0b > > > Cpus_allowed_list: 0-1,3 > > > > > > On a patched system, the final grep produces the following > > > output instead: > > > > > > $ grep Cpus /proc/$$/status > > > Cpus_allowed: ff > > > Cpus_allowed_list: 0-7 > > > > > > This patch changes the above behavior by instead simply resetting the mask > > > to cpu_possible_mask. > > > > > > Signed-off-by: Joel Savitz > > > --- > > > kernel/cgroup/cpuset.c | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c > > > index 479743db6c37..5f65a2167bdf 100644 > > > --- a/kernel/cgroup/cpuset.c > > > +++ b/kernel/cgroup/cpuset.c > > > @@ -3243,7 +3243,7 @@ void cpuset_cpus_allowed(struct task_struct *tsk, struct cpumask *pmask) > > > void cpuset_cpus_allowed_fallback(struct task_struct *tsk) > > > { > > > rcu_read_lock(); > > > - do_set_cpus_allowed(tsk, task_cs(tsk)->effective_cpus); > > > + do_set_cpus_allowed(tsk, cpu_possible_mask); > > > rcu_read_unlock(); > > > > > > /* > > > -- > > > 2.20.1 > > >