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.133.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 DEBA1450F2 for ; Tue, 30 Jun 2026 14:01:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782828084; cv=none; b=Y7ZDkxSDtW6V53Onk/tmEEyA+ndCJ9pdpwbCqBR5xE71o7Wf4rd3iYJ8crTfOX67BhIEgD2vt5Y3GXvw2922NI2IFsYxGx++o4RY3UVaTpaBdhB+UP6/zcb9YPK7KyhWOA4K+gh3b3XxKvA0jC/7Q1T5J6GOAemdCRAWIUSVHXo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782828084; c=relaxed/simple; bh=QF5ZIU+eSuGBSWH3Y7w253rOOR0PTkKglaTKtKLVVAE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Lxt5JicOnJgpKwirsGki8mAJXfAxhJMDuO1r+TR5IJhMK3NR+LXG1f/TLyJ4gvo0kNY14yd7Z50Tf07pHBjpvOSHTD4MeR5kRqkm0AQ17hBGM3truo0ncq7ajsa1sEFJjqjqVksRKuVVA4BcqEaO/pqnwx1LhzF7U4TGUBoGcxw= 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=QX5rhFas; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=pPZD5fGJ; arc=none smtp.client-ip=170.10.133.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="QX5rhFas"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="pPZD5fGJ" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1782828082; 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: in-reply-to:in-reply-to:references:references; bh=vL1cQBm4V9bkdhZZPfpOnFBHfOM80jV2SOxmu4s9TC8=; b=QX5rhFasJEQNnxIOVKQ2mM/ixkop1ZkWQZ1ROt6fqtEfQPerUZtLPtRn2tAvUjabDc0oeV w9CwdYkm08v+rIbZfap5W9yODccG8b/Y4QaiQxgjIBjPM9dSM+tpQxX5+1HgHSFxzb8RNc e8VzFMc6GR8yCs65QhOI57USu8rr0VM= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-354-DQWQtxaqPZO3dBm970saxw-1; Tue, 30 Jun 2026 10:01:19 -0400 X-MC-Unique: DQWQtxaqPZO3dBm970saxw-1 X-Mimecast-MFC-AGG-ID: DQWQtxaqPZO3dBm970saxw_1782828079 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-49246459bc4so34958895e9.2 for ; Tue, 30 Jun 2026 07:01:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1782828078; x=1783432878; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=vL1cQBm4V9bkdhZZPfpOnFBHfOM80jV2SOxmu4s9TC8=; b=pPZD5fGJhKrb+98lyFVkxTrcjbfZvmFB7XFcZQn74ZyUSRkLgcLOYI8qqG0aA/JgY6 RnujmuvVNiIzcrU+BtBKVg5wHABn7E2cMRQYEXA1kBmeKuo1s5GPeOazkcGxgsR6u0MG TfoiVdlbq4wdZwjYTN3xRCjCXoJYlMsyCYdZ2USyah+NiTu/fkPWSzRZEunKDifBFRZ/ uDJJ0L9qDI7N82snwcmHJ2yFWY42kmezrNKwWNIQhVMC2oBkb2XAZqWid96L/WMTRgGG xDpXKCE/CbHRGCs2/pIDNwu5GLtatsZsUp1w3ClSxzkXAfOV63/9czncR+flFbWIbgM5 r/Rw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782828078; x=1783432878; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vL1cQBm4V9bkdhZZPfpOnFBHfOM80jV2SOxmu4s9TC8=; b=QmelNi3e3nu7g8HWFlFmNJwTaKfHRxaqx0AuAyEOmWIA5VYHxrSLgQbX6d2k/vFJFF qaVcXB6gQpCeMnpzBRPyMH9KqgzardX8MzvNT997s6PeiTA7NkbQ6jz5f4PF9FTaa2E0 axXF2hS97osLIM3X3gZsQyHTGbJqdFT5rHNXDpAnEnuOEyPya1ewAydF4w28drh1e4sr g39IB/fiiqPpqgQyONoaRpJTbGwwY0ylomso5/x01maJa94Mahxbbwmuirulx/+JFRuu hqtecB3j1kdRU54PA3pqekrZZIz2CMZf5N5Low1Jf7eP1BwjZcolQvUFadQgg9pK4agD KgZA== X-Forwarded-Encrypted: i=1; AFNElJ9+TxdlNIeNHk1HvONeZKeCxLJioZ1mDy3lHPASmgvM+gEpHG/dG5N0Irx3isWakYETt1m4j3il1fyJOI4=@vger.kernel.org X-Gm-Message-State: AOJu0YzyT8ARhVDWrLcLBg0mKwAsuBVCZRk+Z68WA5IXk/63qPxtJ3lL uzzOTHEHofhEGhwkNNPos8CEWzVOgCQvFNfgaCSFUc4qm5lO8wnK6E4rkYefM4kXZ2u5/lDfCJu 0dLYkCGUjIVRQNSigNyscFH8NiyfPA1Ugdeee296uw3FUNjiFJkJQpmDISWYpulP3Eg== X-Gm-Gg: AfdE7ckKw75oZRCvuMW8Fkpp5XKY5uATPbRtOn/a3SFpgPGT9lDwZoS/12z73MJnFxT s5vxmcTxDK0+W1V7hkpieDFFbgKjQS7rPBqN7M1MHJiJDwY2lx+kHee2SgDeISZkHOwfhEqQwFQ 2tTiXCZTTiObMZbzHz3FYdm3KTWfVypVFwl0h8XL1hOw7UuLhX6lNuIkLqjAK2OKAco8fzgJBN8 XkErC78VomCTLA38oXXAdoPTuMG+Ms+ICHRkhTQcbmPvYkS5puUbD1HPoVyNzK28bvM+1O0xk80 AgJ285ToG48ZxSIionMTSTXj/aW3QBDDV9qnjOSlbXf8gfQZfQADRr8esVN2egUYe8rFbPEuVif ovgLd3w+YCEL2hqPKHsc6uoEFpPAOLCVgSt8veB7TBg== X-Received: by 2002:a05:600c:a317:b0:493:ae5d:8c40 with SMTP id 5b1f17b1804b1-493b82b63c2mr55410605e9.27.1782828078338; Tue, 30 Jun 2026 07:01:18 -0700 (PDT) X-Received: by 2002:a05:600c:a317:b0:493:ae5d:8c40 with SMTP id 5b1f17b1804b1-493b82b63c2mr55407775e9.27.1782828076370; Tue, 30 Jun 2026 07:01:16 -0700 (PDT) Received: from jlelli-thinkpadt14gen4.remote.csb ([151.29.133.86]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-493b8d0afacsm79749845e9.12.2026.06.30.07.01.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jun 2026 07:01:15 -0700 (PDT) Date: Tue, 30 Jun 2026 16:01:13 +0200 From: Juri Lelli To: Waiman Long Cc: Ridong Chen , Tejun Heo , Johannes Weiner , Michal =?iso-8859-1?Q?Koutn=FD?= , Shuah Khan , cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Aaron Tomlin , Guopeng Zhang Subject: Re: [PATCH-next v9 01/11] cgroup/cpuset: Make nr_deadline_tasks an atomic_t Message-ID: References: <20260630033344.352702-1-longman@redhat.com> <20260630033344.352702-2-longman@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260630033344.352702-2-longman@redhat.com> Hi Waiman, On 29/06/26 23:33, Waiman Long wrote: > The nr_deadline_tasks variable in the cpuset structure was introduced by > commit 6c24849f5515 ("sched/cpuset: Keep track of SCHED_DEADLINE task > in cpusets"). It is reported by sashiko [1] that nr_deadline_tasks > can currently be modified by inc_dl_tasks_cs() under rq->lock and > by cpuset_attach() under cpuset_mutex. So if both updates happen > simultaneously, the nr_deadline_tasks variable can be corrupted leading > to incorrect operations down the road. > > Fix that by changing its type to atomic_t so that nr_deadline_tasks are > always atomically updated. > > [1] https://sashiko.dev/#/patchset/20260626181923.133658-1-longman%40redhat.comk > > Fixes: 6c24849f5515 ("sched/cpuset: Keep track of SCHED_DEADLINE task in cpusets") > Signed-off-by: Waiman Long > --- Looks like Sashiko is yet not completely happy with this: https://sashiko.dev/#/patchset/20260630033344.352702-1-longman%40redhat.com I actually wondered the same and couldn't convince myself we don't actually have that problem with the window between sched_setscheduler() and cpuset_attach(). If issue is confirmed, not sure if wait_attach_ done_lock() could help here as well? It's kind of a big lock for the scheduler, but maybe only affecting DEADLINE tasks and if migrations are ongoing. Thanks, Juri