Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp4838022rwb; Mon, 21 Nov 2022 12:36:46 -0800 (PST) X-Google-Smtp-Source: AA0mqf4Q3DywOO3Pw8babocyyDK4NwbLCEOltJwrRmLm+SWBwIVbxtu8s+U1FGvCvSuF+uumRcX8 X-Received: by 2002:a17:906:7ca:b0:78d:95d8:f8db with SMTP id m10-20020a17090607ca00b0078d95d8f8dbmr16264696ejc.592.1669063006088; Mon, 21 Nov 2022 12:36:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669063006; cv=none; d=google.com; s=arc-20160816; b=CilypbDIxA/iuYGNm1yk8Tnh2ntsGY0A14cMm1+v/qFEB00oqP23Sb0ocD1TnIorxQ Y6SMxP15UhRa5PFFqWSWbjuzfYXM0IFd5fplG70tQ64SoCsuUwuxyDk6znn5k++IvGov 41ktVRNIqcgJ1pQJpWAepngTbjilXG/7gOmGKdwFatTfiQZWTPTolDv5dISuFkTcp6KR T91LpxkCi8JX4tT1pierphzOP+Xu56r7HFf7FA09olKdR/3nUOxNMDliW0/5G9telmx0 AUfaTuhEWvNeMtanyMwBuS+j/62CNpXtZqNooLmipCguL+pdcK+zUOR8HLcSm6J1afJS h9CQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=pCmAWoY/E+D1EdQWKofo3IS5cplA0bKml9JOCiXWhTQ=; b=MIMSpvu03nJzu3A43X5rWh9jWNQYQuGg76mSbmHR6kYZ8vaFxDhJq3jlu5Sc+B6CKc PnrzQBFBYLPjv1luU+zdsG20OZ3k0BE3HlCcmBJFIsmF2TmeGGhTqyWQgTRbVDEr5Ye+ 1EEvk9+SuLY5bgBIWrMwmL5qvOb407NRb2q63fC7zVOgyzHZktLM8PehL2xbDHXs5tLa 5jhS5RA4c6ReHPTzxAzJ23TLEt4Z0Okk4UORGdclLFsi4pve3CQI2i+3h1v28+sH/ARZ MhTTRgCzwlAb7Bzn2g3463mXVN1NhLJhfD8QyQca2m0CvV8MUJC33mgUao+d5MCPWO4P pIbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=P8yOsBNs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c27-20020a170906341b00b007806c7c3fc1si8388658ejb.975.2022.11.21.12.36.24; Mon, 21 Nov 2022 12:36:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=P8yOsBNs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230222AbiKUTMj (ORCPT + 91 others); Mon, 21 Nov 2022 14:12:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41776 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231267AbiKUTMG (ORCPT ); Mon, 21 Nov 2022 14:12:06 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 76556D29AB for ; Mon, 21 Nov 2022 11:11:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1669057871; 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=pCmAWoY/E+D1EdQWKofo3IS5cplA0bKml9JOCiXWhTQ=; b=P8yOsBNsJms5T9BTfHTQbcQdN5NkdVgbRcJ9HAw38mOr0lh7l5iNrTeN4QJau6EEfggqfH Oxdd4YoLT8b39Y1DYa+AHBOLciS5bSCa6A7ZL1RJHffqpvZ4l8JG8XWQQecYBN2QqZ4KFf 5HLv0o+qNQjOZG/Tu/eknzwUhsyOgdY= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-656-MChxLxSOMvCXjIztijKxCw-1; Mon, 21 Nov 2022 14:11:06 -0500 X-MC-Unique: MChxLxSOMvCXjIztijKxCw-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B455D811E84; Mon, 21 Nov 2022 19:11:03 +0000 (UTC) Received: from [10.22.33.92] (unknown [10.22.33.92]) by smtp.corp.redhat.com (Postfix) with ESMTP id 45FFA49BB60; Mon, 21 Nov 2022 19:11:03 +0000 (UTC) Message-ID: <78de73b0-2a27-592b-b70b-ca209962fdef@redhat.com> Date: Mon, 21 Nov 2022 14:11:03 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.0 Subject: Re: [PATCH 2/2] cgroup/cpuset: Optimize cpuset_attach() on v2 Content-Language: en-US To: =?UTF-8?Q?Michal_Koutn=c3=bd?= Cc: Tejun Heo , Zefan Li , Johannes Weiner , cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, Sebastian Andrzej Siewior References: <20221112221939.1272764-1-longman@redhat.com> <20221112221939.1272764-3-longman@redhat.com> <20221121185042.GA15225@blackbody.suse.cz> From: Waiman Long In-Reply-To: <20221121185042.GA15225@blackbody.suse.cz> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/21/22 13:50, Michal Koutný wrote: > On Sat, Nov 12, 2022 at 05:19:39PM -0500, Waiman Long wrote: >> + /* >> + * In the default hierarchy, enabling cpuset in the child cgroups >> + * will trigger a number of cpuset_attach() calls with no change >> + * in effective cpus and mems. In that case, we can optimize out >> + * by skipping the task iteration and update. >> + */ >> + if (cgroup_subsys_on_dfl(cpuset_cgrp_subsys) && >> + !cpus_updated && !mems_updated) { > I'm just wondering -- why is this limited to the default hierarchy only? > IOW why can't v1 skip too (when favorable constness between cpusets). Cpuset v1 is a bit more complex. Besides cpu and node masks, it also have other flags like the spread flags that we need to looks for changes. Unlike cpuset v2, I don't think it is likely that cpuset_attach() will be called without changes in cpu and node masks. That are the reason why this patch focuses on v2. If it is found that this is not the case, we can always extend the support to v1. Cheers, Longman