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 59F263EEAF5 for ; Wed, 1 Jul 2026 09:01:10 +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=1782896472; cv=none; b=VGQnC1y1TpdVPyuUgaiseaBEmVbkPUtY4z9WTMJ4X0tXfPuSd6KPvBS94wWieRDout+t6VViyD6xBiJwSLg91CjCeQ0fwmz+JzopapCtAzfO6fuQmFLLa5tjzUiAMWvAA8NkNHcyuyYQ8pq18/Xa3l6y650j/w9WYW2HSCthaXE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782896472; c=relaxed/simple; bh=H2yu1v4BLA1CXFpBBWR+UOBqEFBs+Yl1kR9v6PncV2w=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=EfwFMYF+QB4vw5U4CSRoYcZV8vC4PVeaaOoHovvBiIAWl4UdS3dKQJX2yJHc6WmaFpty7j8o0JF7fndsooTKeAoAjLoYwBZVh+c//JM2SkN4IM/7DGpMTMiS1odpnPxL9GAl73kcuP23yl7fHYfi9lEZCFtsLgFlO9ELoHMagXc= 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=U3iUoSrd; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=Fvyvrm7s; 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="U3iUoSrd"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="Fvyvrm7s" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1782896470; 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=aun8Zor665Yj5HaVE7uoEpAdyksulZLzu/u1QogbXXQ=; b=U3iUoSrdRZp3loWWwxN+d3ht1X4KfLzwVsdu+v9Z7Ox7M3OMM1y8rZ67pA+4GFLjc8Pm7I RgkEmj9q5g+k/ynzf9RiTKDMWbVa6mBFeN7c/hZQxK4pxUV7y13bxLCwNg4Ap5xyHhjHul /FKH62R7D4UcEGpXeAA9QTxK6WyYuDQ= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-655-HBLbEu9dOT6fuAJEsKx_IA-1; Wed, 01 Jul 2026 05:01:09 -0400 X-MC-Unique: HBLbEu9dOT6fuAJEsKx_IA-1 X-Mimecast-MFC-AGG-ID: HBLbEu9dOT6fuAJEsKx_IA_1782896468 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-476608a9fefso196099f8f.1 for ; Wed, 01 Jul 2026 02:01:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1782896468; x=1783501268; 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=aun8Zor665Yj5HaVE7uoEpAdyksulZLzu/u1QogbXXQ=; b=Fvyvrm7suS5GoNG4n/3K+ZvTPyj28o6ckplHNLvdAdlirvGvxV8DddUOL4xUnSZYfy BEvz0HL32PkCPKkzxuL74FqUNVEdqddLCbte/I0RZuhcBCi+yxn9e9dMIwxcGWXeKNrt O4jaclIz/tfQFQTwZblmS6Geh52/Q3XA7V6FZKEa5PitJFf+iv981rfFXO4lJQOPoq8k BIc5MfggskPUS66Zx8YlehS+CsbQOZS2xduMAMLx5TqN9iV5MQ3DvRmKVO1NfBrBuCTF aA6wXtYsDIaBq34X01YVzfcqGOcUMfIGzcOCwJRndhrxDa37xuRZGAMT5e32QTdWy4zl SKWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782896468; x=1783501268; 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=aun8Zor665Yj5HaVE7uoEpAdyksulZLzu/u1QogbXXQ=; b=EYiZxOxRltcMrb2CI5rs7R3s90maZEWdSlK/7fhyPYX951+WFNOpeSntOG3vJQbTHy LD1R9V6XT5pxMY75n/pMZ7c5g46BclbxbgdTvFhX6GgNNTQwlaLAIWHydterl1eVHVGJ spaPQhdblCFQbORz5q3IFeO0fli4wUevfzc6g5hqVZ6sQ+G/kMDPesQ3i1j47JWfHo8v +F/PvMhH5dSiLCGnUvkCoUonC/HaEhZhIN35gonn0Vv8JqDR9GEi+DQ2WzRyQN+mMcaI yRdRjJPMtqEK8a39PnQ9hXINC3f0O2a2owavylnoeA3TEHCRaM0iaOVfb5Rl26PRH0m7 784w== X-Forwarded-Encrypted: i=1; AHgh+Rrm6w52xZPJMnp9v/uYFf/dmzyl/XtZEQEexqe25uBDEVH3EkEPZq9fh6okCf5aTL+E2R9W0q5ETOBR0PQ=@vger.kernel.org X-Gm-Message-State: AOJu0YzB1SHsKNUfBM+6ds8VZ1FQbb1s7shqwq7MYv6m7HpSK3thdMPg 5+Q34m1a5bRxJ6VOFa3QvO6ZB4soQ0KfJi3plgzVXVbhzu3EH5HdjdYIn7+FqVmQpeL5xx5fO6e Bfv94YN2IXYjk3EnfSA2YzPrXTx8xN2KKaZKIpOyPn6KWC0SJ0k3oEpu/mB0RQmXqQw== X-Gm-Gg: AfdE7cnwQu3jAencoEsdQPlcZvCtQ5iinSQ+MBU4dehIxHOpMewCz/0i9ATrQwzVRBp MvZjUBeAeX5Ne+CdeM0O5hHDzQeIGLXiRcxZ3d74L8mdyWHNEa3SHeUbmAVFSeMrOkJH/URzE8p AOySihQ5OIJAmLTmU8TpKkADtCk+HEYNEa+G74fo53H9vZ+gXyNtTqtzv2UZhGrHaoIt83lR5VW Qsv+HJnVIl4+EYkw6HIwghJ+cwC6ZKv4TIDAKJTJgpTZ8cQzfay1dJNg4t/TAJi4Od0oOEgzgjv MT1jccowdQgnInr2Mc7GHSLfVLeBjMxnbuIKNxx2MdW3K6ZrcTiztNpF6/dLmujoFRJ8J811FHr Ehk03dyPQG7yeMeHkmGc0G66Adgax/G+R7SVGPal7nA== X-Received: by 2002:a05:6000:2c04:b0:475:f0c2:75b3 with SMTP id ffacd0b85a97d-477469108dfmr1356071f8f.30.1782896449018; Wed, 01 Jul 2026 02:00:49 -0700 (PDT) X-Received: by 2002:a05:6000:2c04:b0:475:f0c2:75b3 with SMTP id ffacd0b85a97d-477469108dfmr1353851f8f.30.1782896433637; Wed, 01 Jul 2026 02:00:33 -0700 (PDT) Received: from jlelli-thinkpadt14gen4.remote.csb ([151.29.133.86]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-475643ce016sm15420805f8f.16.2026.07.01.02.00.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jul 2026 02:00:32 -0700 (PDT) Date: Wed, 1 Jul 2026 11:00:31 +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: On 30/06/26 13:56, Waiman Long wrote: > > On 6/30/26 10:01 AM, Juri Lelli wrote: > > 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. > > Yes, I am aware of that. This patch can only partially close the race > window. It doesn't completely eliminate it. > > My current thought is for inc_dl_tasks_cs() to check if the in_progress flag > is set. If so, it sets another flag for cpuset_attach() to double check the > DL data for consistency. It will be a rather complicated solution in order > to eliminate the race window. So I am postponing it to a later time when I > have more free time to think about it. Ah yes of course, makes sense. Thanks! Juri