Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp606612imm; Thu, 31 May 2018 06:24:29 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLmky9+5yl4lK5hq/dZOy6skdyi5FhU3rBLsnE4P027r/+zokWw9XogCDC+Xkd+iKiHrk4a X-Received: by 2002:a17:902:6e08:: with SMTP id u8-v6mr6915487plk.96.1527773069640; Thu, 31 May 2018 06:24:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527773069; cv=none; d=google.com; s=arc-20160816; b=oF0MIiTgzc8lq+eeGNisqLP3CQJloCI9YHBOOXpvO9l4VnxffMZPbKEfRGHZLIhgPA yeLfgPANcjq8gh6vMu1YE/PdCvcE5DHArk/dWdNp/54h57zcBfMXbZigIRefnBXOT/Oc k2z/m8S35FVNp0TcEQdla13zUVrywQ4qHjL6iMAnVxOE/o3S3Hfe4/LgK5XiUdK13w/k WXPKR5JAhcegxA5hsN/rDRWdVXNgORSv7H2YfxgaTETQ06L4kl8SqvzZPXESz96iaMzh 8ZEutGNYa2xa25WKdGza4AZ7wwwSMF6kRBbQObetETl9qMyAGdYPB1zW+OhmijflYoGJ /6tw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject :arc-authentication-results; bh=nC3wspjOWE7UXKWfrxq0WSUILGVEoKCKscN68w7uh9o=; b=I6Hn7awkAIUsF83fJxlxB5nAj9ucxjhiFiXcoRRSiIe8Ldh4yweaKvbGzWB90xlgqE Swz2M6aSWFSgzi7VxxufAQaE2cwbOTXeoITZFIEGMJ9Wxry0ZkZIZMv7qJ1Nemz+0N6n wvPhcqjpFQ6Kk0p0PgpQu4ZcgjlGwO1U3lSKf/QoUh4NMsNvX+dYa/kpj4YXNBURcPji CWtqv+GKH+66u4ZXJplM7JcgI1IXr7hH1ejwD+V6ESCDjcwalsPL8gAUizYBp/iCeg6C eMHKo4iO02tLmroT95s3XFzM8basIvWQGmrCw2BsvchM2lwtnOJfbghtxHKImuElqigF mK1Q== 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 t188-v6si28082645pgc.458.2018.05.31.06.24.15; Thu, 31 May 2018 06:24:29 -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 S1755187AbeEaNWc (ORCPT + 99 others); Thu, 31 May 2018 09:22:32 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:45476 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755006AbeEaNW3 (ORCPT ); Thu, 31 May 2018 09:22:29 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 95C2C40201A1; Thu, 31 May 2018 13:22:28 +0000 (UTC) Received: from llong.remote.csb (dhcp-17-81.bos.redhat.com [10.18.17.81]) by smtp.corp.redhat.com (Postfix) with ESMTP id 778FF63AF9; Thu, 31 May 2018 13:22:23 +0000 (UTC) Subject: Re: [PATCH] cpuset: Enforce that a child's cpus must be a subset of the parent To: Zefan Li , Peter Zijlstra Cc: Tejun Heo , Johannes Weiner , Ingo Molnar , cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, kernel-team@fb.com, pjt@google.com, luto@amacapital.net, Mike Galbraith , torvalds@linux-foundation.org, Roman Gushchin , Juri Lelli , Patrick Bellasi References: <1527687991-1431-1-git-send-email-longman@redhat.com> <5B0F4F09.9050100@huawei.com> <5B0FAE72.1090204@huawei.com> <20180531082613.GF12180@hirez.programming.kicks-ass.net> <5B0FB58C.9030705@huawei.com> From: Waiman Long Organization: Red Hat Message-ID: <4dc718bc-4bd5-4998-853b-9c6ba67b89a0@redhat.com> Date: Thu, 31 May 2018 09:22:23 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 MIME-Version: 1.0 In-Reply-To: <5B0FB58C.9030705@huawei.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Content-Language: en-US X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Thu, 31 May 2018 13:22:28 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Thu, 31 May 2018 13:22:28 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'longman@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/31/2018 04:42 AM, Zefan Li wrote: > On 2018/5/31 16:26, Peter Zijlstra wrote: >> On Thu, May 31, 2018 at 04:12:34PM +0800, Zefan Li wrote: >>> On 2018/5/31 9:25, Zefan Li wrote: >>>> Hi Waiman, >>>> >>>> On 2018/5/30 21:46, Waiman Long wrote: >>>>> It was found that the cpuset.cpus could contain CPUs that are not listed >>>>> in their parent's cpu list as shown by the command sequence below: >>>>> >>>>> # echo "+cpuset" >cgroup.subtree_control >>>>> # mkdir g1 >>>>> # echo 0-5 >g1/cpuset.cpus >>>>> # mkdir g1/g11 >>>>> # echo "+cpuset" > g1/cgroup.subtree_control >>>>> # echo 6-11 >g1/g11/cpuset.cpus >>>>> # grep -R . g1 | grep "\.cpus" >>>>> g1/cpuset.cpus:0-5 >>>>> g1/cpuset.cpus.effective:0-5 >>>>> g1/g11/cpuset.cpus:6-11 >>>>> g1/g11/cpuset.cpus.effective:0-5 >>>>> >>>>> As the intersection of g11's cpus and that of g1 is empty, the effective >>>>> cpus of g11 is just that of g1. The check in update_cpumask() is now >>>>> corrected to make sure that cpus in a child cpus must be a subset of >>>>> its parent's cpus. The error "write error: Invalid argument" will now >>>>> be reported in the above case. >>>>> >>>> We made the distinction between user-configured CPUs and effective CPUs >>>> in commit 7e88291beefbb758, so actually it's not a bug. >>>> >>> I remember the original reason is to support restoration of the original >>> cpu after cpu offline->online. We use user-configured CPUs to remember >>> if the cpu should be restored in the cpuset after it's onlined. >> AFAICT you can do that and still have the child a subset of the parent, >> no? >> . > Sure. IIRC this was suggested by Tejun as he had done something similar to devcgroup. > OK, let wait until Tejun has time to chime in. For me, it just look weird to be able to do that. Another corner case that is not handled is when cpus_allowed is empty. In this case, it falls back to the parent's effective cpus. On the other hand, it can also be argued that an empty cpus_allowed is a transient state and a cpuset shouldn't have cpus undefined while creating children. Cheers, Longman