Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp4056908rdh; Tue, 28 Nov 2023 10:33:28 -0800 (PST) X-Google-Smtp-Source: AGHT+IEEAoAGGzKD4znN8RXCpPWZaJw8kxtl5iYz8x3xlfCSd4D8LI9NiXc2kPWEIFBjXJvm8Vrf X-Received: by 2002:a05:6a20:729c:b0:187:a455:2758 with SMTP id o28-20020a056a20729c00b00187a4552758mr17808428pzk.30.1701196408245; Tue, 28 Nov 2023 10:33:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701196408; cv=none; d=google.com; s=arc-20160816; b=HDfdivOOyIM3icIkYduPBSYAUaZSdayxUPxTQZDdLOSHtcxcG7PE4Eehxr7Ft3AAEH hwOFk5bU7mrVK1tj8H4jwUy9mhFrJhWsGGM/cOzzsfGFE6Ptk9dskxqOPRxbyJthW0IY zKzjKbdCx/LBZGbjnvlB50hsXtpWXzBvredoo9mhSVdRHO7Sp23ddHmtUQ0+3aYEObZF 9f8FLsfnL1ZCHk8QBpmm/43yQ5rqfnLy9gMfpug/91wgvwQEdmBxG6jGCZ3rH+I2vdBG LX0P1FGJo43DGTPJkTqjutgI02USQtesdsP3nZM6RGBq7htNb/JqLGNpXeNwhPF2p8ez Vukg== 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=VLioCArnr0IJqhFqguaq4z/iJ7qIOy5O8bw1FPJnvLM=; fh=GJ9nPAfdyg+RFw+tise/ZBKF2ZyRNR1hejCFIiBbhpA=; b=Fti1ZgLG+saxdtoOPj0QELzzxl9jjP2+QVMoN0anqVO2XE68TXOEFfSHElelnDDitq PQmDTHtM7Addoc45IZIaQMzElpFJaEIwMK/8cRZR8lvYl1aqTEyrGe3OgFNhQcFjj3lo 1yuT0YRx7tFx2kqqpoOyJ8FG2vDQri8T5i5hZyfCgjdCa567s23CONbs283DOXkO9iga NTl0GeH6OEgI3rzvfs/dgJNXWzkCWL827DzgezCzADAny+NxsokrkvUKYR0I9zBBLqJ5 F5pig6ZAjc6UopewiVGLOjMFgD7HRlFXUZTTfh5CJqyY5W6UCJFFLHUbikhoR51AKXVY 8vXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=BLLZ++Ap; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id jc19-20020a056a006c9300b006cbf0148335si11884756pfb.344.2023.11.28.10.33.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 10:33:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=BLLZ++Ap; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 50A8F80A8525; Tue, 28 Nov 2023 10:33:25 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346093AbjK1SdE (ORCPT + 99 others); Tue, 28 Nov 2023 13:33:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234971AbjK1Scw (ORCPT ); Tue, 28 Nov 2023 13:32:52 -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 D9FAE112 for ; Tue, 28 Nov 2023 10:32:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1701196378; 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=VLioCArnr0IJqhFqguaq4z/iJ7qIOy5O8bw1FPJnvLM=; b=BLLZ++Ap4imUlg+uy3DNJ7u8Q1xffYbra6P5B4+hnJb2jOs6au0Ll2hSfXigOHPheQ+P+O hI0QXAnDCcUnmHk1AuB2SSJ91zx+9jcJ17LdfezzcVoYYN9lEYvyBEqe3jHAUaZtBB2iHb xI4eqpDwj/m5VYNSGaxoDmZ1wT67DWU= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-694-Tle2EXXqM5CbNcW1fP27HA-1; Tue, 28 Nov 2023 13:32:54 -0500 X-MC-Unique: Tle2EXXqM5CbNcW1fP27HA-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3067F1C05135; Tue, 28 Nov 2023 18:32:54 +0000 (UTC) Received: from [10.22.17.248] (unknown [10.22.17.248]) by smtp.corp.redhat.com (Postfix) with ESMTP id 48FDE40C6EB9; Tue, 28 Nov 2023 18:32:53 +0000 (UTC) Message-ID: <8de482b5-1942-4312-8de4-6f54565ab517@redhat.com> Date: Tue, 28 Nov 2023 13:32:53 -0500 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH-cgroup 2/2] cgroup/cpuset: Include isolated cpuset CPUs in cpu_is_isolated() check Content-Language: en-US To: Tejun Heo Cc: Zefan Li , Johannes Weiner , Andrew Morton , Michal Hocko , Frederic Weisbecker , cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, Mrunal Patel , Ryan Phillips , Brent Rowsell , Peter Hunt References: <20231127041956.266026-1-longman@redhat.com> <20231127041956.266026-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 3.4.1 on 10.11.54.2 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Tue, 28 Nov 2023 10:33:25 -0800 (PST) On 11/28/23 11:56, Tejun Heo wrote: > Hello, > > On Sun, Nov 26, 2023 at 11:19:56PM -0500, Waiman Long wrote: >> +bool cpuset_cpu_is_isolated(int cpu) >> +{ >> + unsigned int seq; >> + bool ret; >> + >> + do { >> + seq = read_seqcount_begin(&isolcpus_seq); >> + ret = cpumask_test_cpu(cpu, isolated_cpus); >> + } while (read_seqcount_retry(&isolcpus_seq, seq)); >> + return ret; >> +} >> +EXPORT_SYMBOL_GPL(cpuset_cpu_is_isolated); > We're testing a bit in a bitmask. I don't think we need to worry about value > integrity from RMW updates being broken up. ie. We can just test the bit > without seqlock and drop the first patch? My concern is that if we have an isolated partition with a set of isolated CPUs (say 2-4), I don't want any addition, deletion of changes made to another isolated partition affects the test of the pre-existing one. Testing result of the partition being change is fair game. Depending on how the cpumask operators are implemented, we may not have a guarantee that testing CPU 2, for instance, will always return true. That is why I am adding some synchronization primitive to prevent racing. My original plan was to take the callback_lock. However, that can be somewhat costly if this API is used rather frequently, especially on systems with large # of CPUs. So I change it to use seqcount for read protection which has a much lower cost. Regarding patch 1 on converting callback_lock to raw_spinlock_t, I can drop it if you have concern about that change. I just need to surround the write_seqcount_begin()/write_seqcount_end() calls with preempt_disabled()/preempt_enabled(). Cheers, Longman