Received: by 2002:a05:7412:b795:b0:e2:908c:2ebd with SMTP id iv21csp273162rdb; Thu, 2 Nov 2023 03:28:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGwbJkoEkF9rw26VSzBoB4bBvO89iH8FXGg2RDbRXPCQlMS6AbR5pHuPH+2b1Zb0eKEjgXF X-Received: by 2002:a17:902:ea0a:b0:1cc:4ae8:dadc with SMTP id s10-20020a170902ea0a00b001cc4ae8dadcmr13499563plg.64.1698920885009; Thu, 02 Nov 2023 03:28:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698920884; cv=none; d=google.com; s=arc-20160816; b=APUYcOmPnjDX5L0uAXJVB7wKW05BD0hrK3YUedUg742Js4D2iCWTwMnUwDSQNUhKUD Nhs59hlJiGvXYZCbsyDlE8r2kG+MbER6yB/oG0uqUc+aLR4P3Cq7fOP6JnfJS+1VqSw9 yCJYGKqc9HUSB/8pSZpKoRLpQCUgUfYF7J0QW30I0MuHDtqV35SrifSmZi8B+WsGXNDd gXXJAxx9GDHa7M1PxuiEmAf4+2NzbmLXi7IbMntzmQux2muxXnX/SHjCXZk6Em494Q+5 nKg+MU8NYdNQMWHHEf4J9sgGco1pDGFboYDY/3SXs9fqcg/c42T3YCj9PWQZp2kYxKQN qBQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=+cHxlEPIDbvrN3Wa2WIuH++2PNSEmRnJ4aw0+ivxO1Y=; fh=6O+VxGib2VdQyqYNHxKOSc4RY0VV2QABd/z+9j3JsOY=; b=SH1sJxjWOzClGpm5iiPNbXHV+y+QUv4L6kljDa9rf89Q8HY3U+Jhi+IeJw9xu9yzjQ K9VtBZyiym5JO74omks78ZoJbFLC2Z7MpJeBYawViilEfcEiCzfu7OEWpshkEypQ3uaw 16uvHaetFoFx+lNV3neCU2A805JdBIYR7vJLBpRMTHOL6oBo1KOhECc1JPvmAvQVo5ko rU86gE1nNp5AOkUj9tXc5rfta7N5LhPGmmbEQQbuI0t9JgXUh7PE2fH9gXY7k78M23ta cFob8q3Y3lcEpsIDMwaTXjUT43YSEVUYRDq0LpisQixjuVeLfGuUM9lzslZfidyaU6Fb GeYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=TKQus1Ru; 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 jc11-20020a17090325cb00b001bf1a9dbcc9si4537876plb.549.2023.11.02.03.28.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 03:28:04 -0700 (PDT) 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=TKQus1Ru; 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 73D4380EBCCE; Thu, 2 Nov 2023 03:28:02 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346369AbjKBK1k (ORCPT + 99 others); Thu, 2 Nov 2023 06:27:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60472 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346371AbjKBK1h (ORCPT ); Thu, 2 Nov 2023 06:27:37 -0400 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 BE26C131 for ; Thu, 2 Nov 2023 03:26:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1698920808; 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=+cHxlEPIDbvrN3Wa2WIuH++2PNSEmRnJ4aw0+ivxO1Y=; b=TKQus1RueitYYbkRWV1QNkb990bm4rhPCV2v/x/qXAMm/3ttlxx0z4Q20WZrNDnAcz2UXT jUNl3ytb5bFAMbrnkPK4hGE1dIbJ0lK2cGwE8k2TiWjkdUGVLBxiFg5A0g5O2gMXYn33gl v0C5Oo+70bHYVBxZNvUEtoDT/mXgpo0= Received: from mail-ot1-f72.google.com (mail-ot1-f72.google.com [209.85.210.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-290-cR6ail7iMJerGA1-vxtFOA-1; Thu, 02 Nov 2023 06:26:46 -0400 X-MC-Unique: cR6ail7iMJerGA1-vxtFOA-1 Received: by mail-ot1-f72.google.com with SMTP id 46e09a7af769-6ce322bbb63so817798a34.0 for ; Thu, 02 Nov 2023 03:26:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698920806; x=1699525606; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=+cHxlEPIDbvrN3Wa2WIuH++2PNSEmRnJ4aw0+ivxO1Y=; b=SoAgvEYl3wyb6X9eDxYqjg2lODojtd/U7+TEqjVefiNz3wgpxGD0xuPaOAPgK+Pt4C ji2Vv9XTOUVi4xr3QT1x62sPN94z3jpP/efUo/gtlDeeNWMRrtpTmMHWrt29YNFkJqzc fDhScB8jYB8tLxWDrIKAyifpd0rD61tu5Yrr4cEk8u39hJw+l5xQuSZ8iZ4yU9boNqXb 8sPyrCApcMpcaeeOP8JrVhNwz+R+9NJuMfh2EpcFcYo70MJiHunnMJS9ffVY1cym9N6d 4PuA1G4my0PrtBFtzlhoJegA9Utt6iOg0JkzNRV2ZX23LQLGY8ADtanx/gwI54ZfaTrY cmnQ== X-Gm-Message-State: AOJu0Yw1lG9ub3zW6UXqW1dbvDrM6KbEkb9wCfrIJCrHI/ypri53SL4a nlEOQb4G1QMcplSjcyyyWeBfUDfibUqZqNQO761aHgY1nAclXGnT6HfRb/bbzLVMaB8yZSANEdw 14l4+KAX/iHcSFz6dhnqX1s84 X-Received: by 2002:a05:6830:2703:b0:6bd:a47:7bb6 with SMTP id j3-20020a056830270300b006bd0a477bb6mr18573850otu.14.1698920806124; Thu, 02 Nov 2023 03:26:46 -0700 (PDT) X-Received: by 2002:a05:6830:2703:b0:6bd:a47:7bb6 with SMTP id j3-20020a056830270300b006bd0a477bb6mr18573840otu.14.1698920805849; Thu, 02 Nov 2023 03:26:45 -0700 (PDT) Received: from localhost.localdomain ([151.29.57.115]) by smtp.gmail.com with ESMTPSA id fg8-20020a05622a580800b0040399fb5ef3sm2172854qtb.0.2023.11.02.03.26.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 03:26:45 -0700 (PDT) Date: Thu, 2 Nov 2023 11:26:39 +0100 From: Juri Lelli To: Waiman Long Cc: Michal =?iso-8859-1?Q?Koutn=FD?= , Tejun Heo , Zefan Li , Johannes Weiner , linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, Peter Zijlstra , Ingo Molnar , Qais Yousef , Hao Luo , Dietmar Eggemann , Steven Rostedt , Xia Fukun Subject: Re: [PATCH v2] cgroup/cpuset: Change nr_deadline_tasks to an atomic_t value Message-ID: References: <20231024141834.4073262-1-longman@redhat.com> <8e1b5497-d4ca-50a0-7cb1-ffa098e0a1c2@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <8e1b5497-d4ca-50a0-7cb1-ffa098e0a1c2@redhat.com> X-Spam-Status: No, score=0.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SORBS_WEB,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no 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]); Thu, 02 Nov 2023 03:28:02 -0700 (PDT) Hi Waiman, On 01/11/23 13:59, Waiman Long wrote: > On 11/1/23 12:34, Michal Koutn? wrote: > > On Tue, Oct 24, 2023 at 10:18:34AM -0400, Waiman Long wrote: > > > The nr_deadline_tasks field in cpuset structure was introduced by > > > commit 6c24849f5515 ("sched/cpuset: Keep track of SCHED_DEADLINE task > > > in cpusets"). Unlike nr_migrate_dl_tasks which is only modified under > > > cpuset_mutex, nr_deadline_tasks can be updated under two different > > > locks - cpuset_mutex in most cases or css_set_lock in cgroup_exit(). As > > > a result, data races can happen leading to incorrect nr_deadline_tasks > > > value. > > The effect is that dl_update_tasks_root_domain() processes tasks > > unnecessarily or that it incorrectly skips dl_add_task_root_domain()? > The effect is that dl_update_tasks_root_domain() may return incorrectly or > it is doing unnecessary work. Will update the commit log to reflect that. > > > > > Since it is not practical to somehow take cpuset_mutex in cgroup_exit(), > > > the easy way out to avoid this possible race condition is by making > > > nr_deadline_tasks an atomic_t value. > > If css_set_lock is useless for this fields and it's going to be atomic, > > could you please add (presumably) a cleanup that moves dec_dl_tasks_cs() > > from under css_set_lock in cgroup_exit() to a (new but specific) > > cpuset_cgrp_subsys.exit() handler? > > But css_set_lock is needed for updating other css data. It is true that we > can move dec_dl_tasks_cs() outside of the lock. I can do that in the next > version. Not sure if you had a chance to check my last question/comment on your previous posting? https://lore.kernel.org/lkml/ZSjfBWgZf15TchA5@localhost.localdomain/ Thanks, Juri