Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A5296C433EF for ; Wed, 15 Dec 2021 03:24:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239557AbhLODYn (ORCPT ); Tue, 14 Dec 2021 22:24:43 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:57031 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230073AbhLODYm (ORCPT ); Tue, 14 Dec 2021 22:24:42 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639538682; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wHvqWA9pCAW9hO772UCEPBtSbiKtXLn9xS2Zet02foU=; b=D7XpqjJxZk1k/LrdSMz/4bLf2yxhg23ndlYStXLLubyHq36HkRjzH3ePi6cmypQHrBKjwm VHKrsTeH9XiILdS8JDJfYy9BIjchp2OymSpx8k6cYGoQDDX0gx4bB8f4JcXQCu1KzLtpCd uIWGkDBtlnxYbqFjPADZJW5SieXGrbM= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-529-9OCunupRPaCWWCdihpXOZA-1; Tue, 14 Dec 2021 22:24:38 -0500 X-MC-Unique: 9OCunupRPaCWWCdihpXOZA-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E277581CCB7; Wed, 15 Dec 2021 03:24:35 +0000 (UTC) Received: from [10.22.16.35] (unknown [10.22.16.35]) by smtp.corp.redhat.com (Postfix) with ESMTP id B73C18276C; Wed, 15 Dec 2021 03:24:22 +0000 (UTC) Message-ID: <810204ce-7967-e470-1267-7c3cfb521c89@redhat.com> Date: Tue, 14 Dec 2021 22:24:22 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.3.0 Subject: Re: [PATCH v9 2/7] cgroup/cpuset: Allow no-task partition to have empty cpuset.cpus.effective Content-Language: en-US To: Tejun Heo Cc: Zefan Li , Johannes Weiner , Jonathan Corbet , Shuah Khan , cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org, Andrew Morton , Roman Gushchin , Phil Auld , Peter Zijlstra , Juri Lelli , Frederic Weisbecker , Marcelo Tosatti , =?UTF-8?Q?Michal_Koutn=c3=bd?= References: <20211205183220.818872-1-longman@redhat.com> <20211205183220.818872-3-longman@redhat.com> From: Waiman Long In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/13/21 15:45, Tejun Heo wrote: > On Sun, Dec 05, 2021 at 01:32:15PM -0500, Waiman Long wrote: >> adding = deleting = false; >> old_prs = new_prs = cpuset->partition_root_state; >> if (cmd == partcmd_enable) { >> + /* >> + * Enabling partition root is not allowed if not all the CPUs >> + * can be granted from parent's effective_cpus. >> + */ >> + if (!cpumask_subset(cpuset->cpus_allowed, parent->effective_cpus)) >> + return -EINVAL; >> + >> + /* >> + * A parent can be left with no CPU as long as there is no >> + * task directly associated with the parent partition. For >> + * such a parent, no new task can be moved into it. >> + */ >> + if (partition_is_populated(parent, cpuset) && >> + cpumask_equal(cpuset->cpus_allowed, parent->effective_cpus)) >> + return -EINVAL; > So, given that this only happens with threaded domains, can we just not > allow partitions within threaded domains? The combination doesn't make whole > lot of sense to me anyway. AFAICS, there are code in cpuset.c that disallows the an non-child node to hold tasks, but the check doesn't cover all the possible cases. I remembered that I was able to create such a scenario without using threaded domains. That is why I put in this conditional check. It has nothing to do with the use of threaded domains. >> + /* >> + * On default hierarchy, task cannot be moved to a cpuset with empty >> + * effective cpus. >> + */ >> + if (is_in_v2_mode() && cpumask_empty(cs->effective_cpus)) >> + goto out_unlock; > And then we can avoid this extra restriction too, right? This check is supposed to prevent a task to be moved to a leaf cpuset partition with just offlined cpus and hence no effective cpu. A possible alternative is to force the partition to become invalid, but I think not allowing the move is easier until one or more offlined cpus are onlined. Cheers, Longman