Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp4499763img; Tue, 26 Mar 2019 10:32:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqzx3GfOrgso9e0MHmgxoO3qIf1v3iqXILQEMHzrVD2HMNGTzYp3wwFYzAfwEJLKJ1t80RhB X-Received: by 2002:a17:902:5c5:: with SMTP id f63mr29225287plf.64.1553621562317; Tue, 26 Mar 2019 10:32:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553621562; cv=none; d=google.com; s=arc-20160816; b=qCGc7UrZFOlON75sZoheRF6X+ZakqYMjsGoN648DJovX3LzhGG61ifa4jMLVzJOJ9l GJbDWwXEV7NKLMb2JxjlsJzH0maBue2RNWo1at+MqZ0QrY1gifbQQiRUbzkQcFMcizL2 p2U871LqWRwVh8myXiLstesJxY+UhEcGOtQR756hyJk9ssxhNVlGWqVj1d9dVDOAb/2V cIR1eMDEUxqGZGnvsyd0bR+XTfAsZXfpW9WVxxacFcqnEgwA6mR2mHnXFVK/5+Y/nTlo flRrijG9ivkcFL/w71QbkgLSwss8+X8RNIoRipcR0tPAFx3g60DQmGfRkkMP9UaJak/r 7H+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=qoGR01Blsxr1nYNpNinV2ykk7p6CnofcdlpSEMZSsw0=; b=NjfeVCnCl2QIM4tus5OdCYoKg+kcr6MDYFIRMYNN1kYfuKp8BwLteY4H67p0Ici+56 gX8Sysqs67kv0MgCIyg7HYCM97+cXDliLy6lv83eqfM57ydRjk7zetRU4tNigWAS8svo 5lUUlM3psu4y1kRMqj6+EelH4LmEqN5zL/Ux3eZphLg/FFQ2khQ1SNo7tU33ERwxpmav 0xmkxzOtY43FdoEYLwhHafhay+C9iVwtpnXP5XH8Pjo72g2rEAMtP6JXl/qKWlkZZf3z xTmgX4J7EL1lFnS7eP8hr+cp+wLbwOEeYbHIJaDvk0cW9NJh8g2sA5vUwQH7/CORW0Jw FlNw== 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 y2si10163954pgl.527.2019.03.26.10.32.23; Tue, 26 Mar 2019 10:32:42 -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 S1730449AbfCZRbf (ORCPT + 99 others); Tue, 26 Mar 2019 13:31:35 -0400 Received: from mail-ot1-f67.google.com ([209.85.210.67]:36454 "EHLO mail-ot1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726111AbfCZRbf (ORCPT ); Tue, 26 Mar 2019 13:31:35 -0400 Received: by mail-ot1-f67.google.com with SMTP id o74so12259940ota.3 for ; Tue, 26 Mar 2019 10:31:35 -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; bh=qoGR01Blsxr1nYNpNinV2ykk7p6CnofcdlpSEMZSsw0=; b=bjYSXQAB/WrMPF7v6N08WTrj6sa7+V5VG2S7yxx/vLlVa7FXVqnHX+jlWCqNs7F8ew 8ZRbvTQXv3EfIIC0AqkW0A8m0gg5/2WcFxQDSn9HaYej+J+DMhvtXNr63PNrqeIY6i9Z rVIRCOHK513YmiQO8O4wa8SBEbxanX16mDX5yXyFa9dPhxpLlmNcdc6FXsFLRRcSOoJp MXQgMsr/X8ZslotcpqnR1h/+KGrs4l//Nrw+I1SpPtj7kCALz3SAqHqvSaSWc8UuVIUx pV82aOf5od+mwpORYeccdU2hlASzN/22e2cqfC1RxFrgD00vE/PQxMZr5jejhU/ZuCqA pz0w== X-Gm-Message-State: APjAAAW/Tv8trayujYvfQlT+v/BPENdYJ9IvaEHa+ev0M4Kf7cSaEi3t mmEFYlTxnPeOvlAGMGzfeRQ9SQayle0xjuQJlLqfM5Tpfl0= X-Received: by 2002:a9d:5a02:: with SMTP id v2mr13447905oth.70.1553621494248; Tue, 26 Mar 2019 10:31:34 -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:31:23 -0400 Message-ID: Subject: Re: [PATCH] cpuset: restore sanity to cpuset_cpus_allowed_fallback() To: linux-kernel@vger.kernel.org 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 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 > >