Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3374784imm; Tue, 29 May 2018 06:15:41 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpvT/6VxAPSamMQI/wY9aw5Le8gmYHEAfsa/7vUb8Ui+yjVwIATdgzGgpFO0t3Bgb79hWNO X-Received: by 2002:a63:82c7:: with SMTP id w190-v6mr13775797pgd.172.1527599741435; Tue, 29 May 2018 06:15:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527599741; cv=none; d=google.com; s=arc-20160816; b=eagjuhloP+kroOSK7SAaNHpHOMoLP+NynXwOSiVkFMdoYnQV1XnWHO674vEOzSzgJ1 NFQiOSTZrM4/tlcCurPU3blCBhJf6YmiGzMpLcXMHmpHl5ZKqXC2BkLiFXi1UmUl/ffp FxIw6946Yqf7bc/Gas3DxTJIdRFRp0MazY09au6a3AVNpSIbsaYnjpOyISTwzYlF2t1r hA16nnSXq881ZTakhAe7aY0bwVviCbY8aNYh/X04LCj3F5OMDaz9q8dLNaqi+9Fm65Zx dFZ3yOsYC3Tjhe9qjfD4+spCUwCmnA2GSAA0Vbb9t5+7qcb8SP2b/sQMobJdiBY5/qCF telQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=zG2NSpx09U68xnW+SLou28hA+SbbAmjOpxwlt42kit4=; b=qp1sJHoIt/Ii/jsCBjnZPqFuQ8o9YAK92JJ5krZRZ4gQDQkqXrPih7wiZiyfFGuRTv gf1vEqwk8GjG8yYYTwpOQAUsfDVRqVuSKxGnfduMOR/C+szri0ZRAebnSXV/eZViOyys UMD8IBHRSztMECCHwr67T9MJYB/RYHPIwPpRDr5SdDo/Jvd7JlAzezh+ectFKbSa8x/M kObDRoY4V+v5vPUc4U9jWwSzWGI/B35JlzIiKN+iTzg/79FgHacGScvgOox+WPVBFhUx K+D6JCh6zMHdplp8bSRuMWtwj8j5W7x+ocdAuAZ9LP8uAsQRvyoGX91J6oh7X/cOD9Ye 4ulg== 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 v190-v6si32265928pfb.324.2018.05.29.06.15.27; Tue, 29 May 2018 06:15:41 -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 S934738AbeE2NMr (ORCPT + 99 others); Tue, 29 May 2018 09:12:47 -0400 Received: from mail-wr0-f194.google.com ([209.85.128.194]:32917 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934367AbeE2NMn (ORCPT ); Tue, 29 May 2018 09:12:43 -0400 Received: by mail-wr0-f194.google.com with SMTP id a15-v6so25452194wrm.0 for ; Tue, 29 May 2018 06:12:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=zG2NSpx09U68xnW+SLou28hA+SbbAmjOpxwlt42kit4=; b=JDW6ghbia21YjjoqZda6tZZCxWcxKl6cZChgkkgsZ2/I1qJ9FWq2b9vH4edj3eF8Gl Xw1Vs2uTpiOw2xDqxc9i68X+yV+3Vlejtq2/jOr6b4/ar1oxr5wynY5dHLFYwFrxOzyL SSbfNUHGKrGAGDONutEnedJanM81tJf1QgG7jZtcOzRKHepeXVIDeVj5+tmn+7nBX8TW 5oxqLu6G6OyvAsfBRpDnfma5MaQ4h4i+wFYAGioSJ6SzK88gQjk86LL/DIPtw1gQCHJV J5l7RqLCjnxUuyp1sTEmt7o1KWSfs6RpPo0faeIYo8W7gu+k0P2gOsiDeg6vqdSYUxSO 7qVA== X-Gm-Message-State: ALKqPwf6BI0/m+DufL1zc469TaNNZznYBFlkJ3DBvB8xOsADPHziPCgU 5h01jyY0PC8JdqOm26z3q7a8Ew== X-Received: by 2002:adf:f74c:: with SMTP id z12-v6mr14729705wrp.165.1527599561303; Tue, 29 May 2018 06:12:41 -0700 (PDT) Received: from localhost.localdomain ([151.15.207.242]) by smtp.gmail.com with ESMTPSA id y68-v6sm63857132wrb.91.2018.05.29.06.12.39 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 May 2018 06:12:40 -0700 (PDT) Date: Tue, 29 May 2018 15:12:38 +0200 From: Juri Lelli To: Waiman Long 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 Subject: Re: [PATCH v8 4/6] cpuset: Make generate_sched_domains() recognize isolated_cpus Message-ID: <20180529131238.GE8985@localhost.localdomain> 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> <8164a41b-3218-c618-64a6-52747344c4db@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8164a41b-3218-c618-64a6-52747344c4db@redhat.com> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 29/05/18 08:40, Waiman Long wrote: > 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. Fair enough. Thanks, - Juri