From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3693627702E for ; Mon, 17 Nov 2025 20:37:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763411845; cv=none; b=Y8Oo0uFqIKKniC+puhkTtAWY9AjbOcPZcOmUpsP/zi5+2vttSYUDRghvjfWqJDr5GNoq3CglEy0+CTEKw5X/wo9j7shMTkS+ZpScsszaFvKEfzmuHBG7/dEyxK7aRgoevOXKgN3mlM35UGCnrvbLbym9SmaQ8TMO7hsdGRVSaAo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763411845; c=relaxed/simple; bh=SmPR+A59MooYRc2WJidnDJCDD3wZZK2HbZ/vnM2OMwo=; h=From:Message-ID:Date:MIME-Version:Subject:To:Cc:References: In-Reply-To:Content-Type; b=hMTL8aEWvqrvlltm+8KqYJ8QHCRdJWqUi7E7afFmVTKyep+XCn5mTIgX+ngUBCUeqxI9puBw0Q09SF7XdeyeA0PyHv207m4CQcGU4Tz15pBuimQFP6i5CmP1nCX+61lF4udxzBsNrXL/78TuH5ByfwxXYZK9QGo9irqHAnUAvDE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=SKpk+ct+; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=p2rYetMs; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="SKpk+ct+"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="p2rYetMs" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1763411842; 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=NH+JjbVFS4evMnwZjaAY2ijL6D93KhWvJesUB02vD9U=; b=SKpk+ct++Sl6yVxCe/mnTFsrPDxLFbgJt9Rn24CuXeSSV6lG7AaVtDYYFPp/H5hh0EVzIq PHKzoTvhN+Eoghbm4+vvDPM+UEq8Fg+WXBrV8V/SzqniZGN1yXs1ME67nLtHG3YEFXrbnw QDXaXbf+ac2LbJaGPiO3itqvyhQF2z0= Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-29-ZHKAs1igMkGSvdTbFReqtw-1; Mon, 17 Nov 2025 15:37:20 -0500 X-MC-Unique: ZHKAs1igMkGSvdTbFReqtw-1 X-Mimecast-MFC-AGG-ID: ZHKAs1igMkGSvdTbFReqtw_1763411840 Received: by mail-qv1-f70.google.com with SMTP id 6a1803df08f44-8823c1345c0so66025646d6.2 for ; Mon, 17 Nov 2025 12:37:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1763411840; x=1764016640; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:subject:user-agent:mime-version:date:message-id:from:from:to :cc:subject:date:message-id:reply-to; bh=NH+JjbVFS4evMnwZjaAY2ijL6D93KhWvJesUB02vD9U=; b=p2rYetMsI9iu5LY/aflJHZME2Ueb2rsolz/ywTVeKVIu1cq4PXyELw2q9SKb6nZ6Jz nnLNCcD5O5adtIxRjrakd4c8Q7n2XtNajKKU4O+nYGLgdpNqnpc0Av3rbut5Eoc8qSOG 1AjujrCBmD7uTjYgyUCoTOoDKVI9Mn2OKQPME1oHYz0l0YQ7QynF4E0cHMHC8mouFRtZ ++VSC4w6XdZf0yS/O+M9ttXVHhzRgBDgw4BfGoNu2yHpmP5Lq/LBFZ+bpfCfl2beNQIo NgFFjvrhVZ3pMiCbFhWoTmUXZutyt6vWc9E7E0Z2Zl9g2kZzgx/4t8tucry63864HzNl b4YA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763411840; x=1764016640; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:subject:user-agent:mime-version:date:message-id:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=NH+JjbVFS4evMnwZjaAY2ijL6D93KhWvJesUB02vD9U=; b=jXzZ/1Oe+TJ7SzZV78bj/EvA9P7jQE9dxLqPApn81RnyoDXc/XeFj0rirDP1bZKWjS 88sqh6nKyh4kK7qN99R7ZI6mpgUqfIY5hvZuyxOYqSwwoGuWJMCSLwD5CJwHSXE64K9O J24xiecbD6vBoz0cuSN+2WI++J7zVc3YpdECkjnhs9bljUBR4vz60dbL13UguOuSRpYX hB9FcjFOC3hGkQ/jh7lsAs/W4M+53H5qlfPBCBRi1CHYX8fv2ZQCTxVVh4+W4QyyH/Rd eh3kxL0JjMCADu85hIPYqwpXplVtEP95cz9NCSJM597IJuQtta/CUyZ409m7H+wf7ZZs f/8Q== X-Forwarded-Encrypted: i=1; AJvYcCWMRuGr/vkEDhY5wu2q3v9w8JHaYz17ual2INeNl79HBobwlD8fJlSPnajlOTCdi3TZVHHrbg9Fi7C3IoM=@vger.kernel.org X-Gm-Message-State: AOJu0YxV7ChsQ9XMJx0Uxi3Iq4Gd0ASm7Yyaf84DxtkgF2okVyeqtzCb e3qBkmHi3bbtYpsksP4HZOKk3ibKVDQWaW26aRKS1VlgELjDXrLwKp3Ee/adVb8HpIZeSSvLX0a 3WhUU4YP99y5QrR6hs/mETUt/yvDRzV8BiCGO/AzaM0XaCI8QWM2cpCNth/GvOIzPsw== X-Gm-Gg: ASbGncs8uDO5U2K3L5Nqwk+BhqUEjuOEdpVMsJPZK20BsBXOTpB1xkildH5aOj3XePS UHXDeNlOGUqo25F+k89w+Rbfq8pPQcl9LBkPTjkWwcsBK40o5vx6EOjk3lS14kB/iVTue4dzD75 Z9QKZpMuYpPdC90WwLHG7A6P1PkLKYOII51EknJ/aTCnECHS8mmIkkSwUAuU8sdu25NFu8YZXBT b1hlWKzYLP3SvmYMZ/RjooLpnyxfyIujh20ZMB8QqQtvwPbiUC+RGtsJq3jECvhcgdayTttdfog 6Zj0G0yBlBOT7yK4GCqanphB5lG0TgR9JQzuzU2+G2x8mvf4FlkT86XNuib0H9kZOnviNt8VblT 7dTP3zg6AFR4EFQCGI9oxI656IHT0j27nRru6hh5OjEGDhQ== X-Received: by 2002:a05:6214:c65:b0:882:4dec:42b9 with SMTP id 6a1803df08f44-882925f280amr200935276d6.26.1763411840284; Mon, 17 Nov 2025 12:37:20 -0800 (PST) X-Google-Smtp-Source: AGHT+IGFBq9DDNquaCKU7McYtmHMkXKL2oozerHAJiNvFCEr30jW86RIcnuOYpR+b7DJwQSQmAjbcg== X-Received: by 2002:a05:6214:c65:b0:882:4dec:42b9 with SMTP id 6a1803df08f44-882925f280amr200934896d6.26.1763411839858; Mon, 17 Nov 2025 12:37:19 -0800 (PST) Received: from ?IPV6:2601:188:c102:b180:1f8b:71d0:77b1:1f6e? ([2601:188:c102:b180:1f8b:71d0:77b1:1f6e]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-8828652c882sm101791536d6.32.2025.11.17.12.37.18 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 17 Nov 2025 12:37:19 -0800 (PST) From: Waiman Long X-Google-Original-From: Waiman Long Message-ID: <97ec2e86-cb4f-4467-8930-d390519f12a6@redhat.com> Date: Mon, 17 Nov 2025 15:37:17 -0500 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCHv6 1/2] cgroup/cpuset: Introduce cpuset_cpus_allowed_locked() To: Pingfan Liu , cgroups@vger.kernel.org Cc: Chen Ridong , Peter Zijlstra , Juri Lelli , Pierre Gondois , Ingo Molnar , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Valentin Schneider , Tejun Heo , Johannes Weiner , mkoutny@suse.com, linux-kernel@vger.kernel.org References: <20251117092732.16419-1-piliu@redhat.com> <20251117092732.16419-2-piliu@redhat.com> Content-Language: en-US In-Reply-To: <20251117092732.16419-2-piliu@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 11/17/25 4:27 AM, Pingfan Liu wrote: > cpuset_cpus_allowed() uses a reader lock that is sleepable under RT, > which means it cannot be called inside raw_spin_lock_t context. > > Introduce a new cpuset_cpus_allowed_locked() helper that performs the > same function as cpuset_cpus_allowed() except that the caller must have > acquired the cpuset_mutex so that no further locking will be needed. > > Suggested-by: Waiman Long > Signed-off-by: Pingfan Liu > Cc: Waiman Long > Cc: Tejun Heo > Cc: Johannes Weiner > Cc: "Michal Koutný" > Cc: linux-kernel@vger.kernel.org > To: cgroups@vger.kernel.org > --- > include/linux/cpuset.h | 1 + > kernel/cgroup/cpuset.c | 51 +++++++++++++++++++++++++++++------------- > 2 files changed, 37 insertions(+), 15 deletions(-) > > diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h > index 2ddb256187b51..e057a3123791e 100644 > --- a/include/linux/cpuset.h > +++ b/include/linux/cpuset.h > @@ -75,6 +75,7 @@ extern void dec_dl_tasks_cs(struct task_struct *task); > extern void cpuset_lock(void); > extern void cpuset_unlock(void); > extern void cpuset_cpus_allowed(struct task_struct *p, struct cpumask *mask); > +extern void cpuset_cpus_allowed_locked(struct task_struct *p, struct cpumask *mask); > extern bool cpuset_cpus_allowed_fallback(struct task_struct *p); > extern bool cpuset_cpu_is_isolated(int cpu); > extern nodemask_t cpuset_mems_allowed(struct task_struct *p); Ah, the following code should be added to to !CONFIG_CPUSETS section after cpuset_cpus_allowed(). #define cpuset_cpus_allowed_locked(p, m)  cpuset_cpus_allowed(p, m) Or you can add another inline function that just calls cpuset_cpus_allowed(). Cheers, Longman