Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3339957imm; Tue, 29 May 2018 05:41:10 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoDdy7L7CzZo94ELOjnCP0dnPx9bfIul6EK655HeH/y1n0DjdCCZHZJITNUpJJ3NdCbgDyJ X-Received: by 2002:a17:902:b184:: with SMTP id s4-v6mr17043307plr.359.1527597670802; Tue, 29 May 2018 05:41:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527597670; cv=none; d=google.com; s=arc-20160816; b=Lg50seGYnz4PWB13+WBhnWvL8e2eW4Ktpip834F4KGReTNBYBatSrdPQzrsbO6PjNb LH2MdKGSLaC+XHcWw7mHDGYpZiyyxhnYjZ3LXV3Qmona9Kb++f0MHMCmhgARBWoAcZgf Ra5N2vO+IOSZp2YyQ64SKhu6ouLU5dqAxd+/3neVVqZytHz80gzMLx1ddNjS61x16z4Q p9O//Uaww++zlE9KsoXJQ0yHssn+kCz0092Bwiuk/a6cW2VeX7kU5CfLT486/JJAXVtJ rhS2d+r0lp2lr00dmTOUEAIU1uJUEGreefPwc3kmJWMONuGmGEllsbh/oynVnsEmnoYh ng9w== 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=+JLD1Rzp0hOGUzzwYNQXF5Ju95PrywLkxvQ0xQikHKA=; b=YdGlYmFO38mmD0a7Nl1zBZzdZJZAeZYKNGvEuh4qQyhsemEZn1yC3TvokFdUAyB2ut 4krLO3quWFIeFJP1MwEqDE1XzZU9xmqKhtOnSOuxtM74e579JAeX5rSdHGW66gZqCyMI oCn+ltmzs+2tD8flbW2GVO72LV3UM4wOq+w4+htEP0GjJAxqBAUC3EZdqYBYF3txXJOw e16A5+mCiPefqMC6cT7NyJp7ZMQLXQSwKcN0LVO493zfotR4RPVLoxO55AgIUdqAPOB1 OIPBK6gwxUrdp9+oNUQpreCjX+fhduNO7RdluFO/L6hnl2UkyLX3AVNc5YebmeRqECEb +svQ== 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 k18-v6si6452377pll.404.2018.05.29.05.40.55; Tue, 29 May 2018 05:41:10 -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 S934012AbeE2Mka convert rfc822-to-8bit (ORCPT + 99 others); Tue, 29 May 2018 08:40:30 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:34356 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933697AbeE2MkY (ORCPT ); Tue, 29 May 2018 08:40:24 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id ADC3E40BC05F; Tue, 29 May 2018 12:40:23 +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 EC9042166BB2; Tue, 29 May 2018 12:40:21 +0000 (UTC) Subject: Re: [PATCH v8 4/6] cpuset: Make generate_sched_domains() recognize isolated_cpus To: Juri Lelli Cc: Tejun Heo , Li Zefan , Johannes Weiner , Peter Zijlstra , 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 References: <1526590545-3350-1-git-send-email-longman@redhat.com> <1526590545-3350-5-git-send-email-longman@redhat.com> <20180524102837.GA3948@localhost.localdomain> <45d70c88-e9f5-716a-ee9a-33dc111159cc@redhat.com> <8e610b98-970c-a309-5821-fc8e6aca892f@redhat.com> <20180529062703.GA8985@localhost.localdomain> From: Waiman Long Organization: Red Hat Message-ID: <8164a41b-3218-c618-64a6-52747344c4db@redhat.com> Date: Tue, 29 May 2018 08:40:21 -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: <20180529062703.GA8985@localhost.localdomain> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT Content-Language: en-US X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Tue, 29 May 2018 12:40:23 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Tue, 29 May 2018 12:40:23 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.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/29/2018 02:27 AM, Juri Lelli wrote: > On 28/05/18 21:24, Waiman Long wrote: >> On 05/28/2018 09:12 PM, Waiman Long wrote: >>> On 05/24/2018 06:28 AM, Juri Lelli wrote: >>>> On 17/05/18 16:55, Waiman Long wrote: >>>> >>>> [...] >>>> >>>>> @@ -849,7 +860,12 @@ static void rebuild_sched_domains_locked(void) >>>>> * passing doms with offlined cpu to partition_sched_domains(). >>>>> * Anyways, hotplug work item will rebuild sched domains. >>>>> */ >>>>> - if (!cpumask_equal(top_cpuset.effective_cpus, cpu_active_mask)) >>>>> + if (!top_cpuset.isolation_count && >>>>> + !cpumask_equal(top_cpuset.effective_cpus, cpu_active_mask)) >>>>> + goto out; >>>>> + >>>>> + if (top_cpuset.isolation_count && >>>>> + !cpumask_subset(top_cpuset.effective_cpus, cpu_active_mask)) >>>>> goto out; >>>> Do we cover the case in which hotplug removed one of the isolated cpus >>>> from cpu_active_mask? >>> Yes, you are right. That is the remnant of my original patch that allows >>> only one isolated_cpus at root. Thanks for spotting that. >> I am sorry. I would like to take it back my previous comment. The code >> above looks for inconsistency in the state of the effective_cpus mask to >> find out if it is racing with a hotplug event. If it is, we can skip the >> domain generation as the hotplug event will do that too. The checks are >> still valid with the current patchset. So I don't think we need to make >> any change here. > Yes, these checks are valid, but don't we also need to check for hotplug > races w.r.t. isolated CPUs (of some other sub domain)? It is not actually a race. Both the hotplug event and any changes to cpu lists or flags are serialized by the cpuset_mutex. It is just that we may be doing the same work twice that we are wasting cpu cycles. So we are doing a quick check to avoid this. The check isn't exhaustive and we can certainly miss some cases. Doing a more throughout check may need as much time as doing the sched domain generation itself and so you are actually wasting more CPU cycles on average as the chance of a hotplug event is very low. Cheers, Longman