Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp870767rwi; Wed, 2 Nov 2022 20:22:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7RWM+ae1A8Z5ukWj4U5wZiqHloxlZu+aBf7xnl53Mv43vaq/FBCSZHQLx7wpujDpLgEK7z X-Received: by 2002:a17:907:c00e:b0:7ae:753:13e9 with SMTP id ss14-20020a170907c00e00b007ae075313e9mr5604414ejc.387.1667445740743; Wed, 02 Nov 2022 20:22:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667445740; cv=none; d=google.com; s=arc-20160816; b=WiAmwNzQ159xnZI7zdpwy5kKk2tO8xsLioWr9Y8ZU9ZlM6Ilil9I62nMvcRGz2+1rS K8WYkpvHkjV/DV882y8LF4F7hEyGpCrYNASJBeoDxP2B/aZODEUOOWXfCmGdcgxq040+ i0p1FBIgDatvCvJcEGQJFm3fbpTC1fEIwnnW7r+VhCgVCPg7hhSwOQFc4f/XB9SPuIuZ 78dJndy26DWZ1ZarK6feHUsug/RKb0120LSRBkpqdN1Nat/kIc1R+py16V8XOTcH0V9t qG5HAa2VCzNKeF7vpLyw5TiWiuyChlGzgLe4Uo8mVurSLoIkepiElNiQHzqzn+Dyj6g8 7siQ== 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:subject:user-agent:mime-version:date:message-id :dkim-signature; bh=sMzrvYyYy/W+4cGhBZeoRUR17rUZ1JZqGeV1907ajb4=; b=cIxy5c8svRpG+iTTKaTddOwXNEw+fpvWVdL/E8wpIxQ3/T5G2PeCfyhp92LPOQckMj +GVtpbYnUi144sKiLJe3wM6Ms+cqfiSN2S8EiSj7T9KHL1mwYzscukzVi2tw58AxfxUn 6BoR57NKr6ti3Te4y5E5H8OpARtPAVqk3UAjgxEFcxJYF0hcInM9FhA2evRSml2UwG4F rg516axTtE/I4EWc3bfelx9KTdUll65v6jlH+lNost8srKB1Rqt66TnVEYXL4nCOz0RS qBvh5wKbuRNdtGgk5GNhD/7NZlkg8QxrFz1XdwyC6AJDGjIFNCQ/24a3h4Pb2FOZn+Pa WSMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@shopee.com header.s=shopee.com header.b="POmg/14c"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=shopee.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id va4-20020a170907d00400b007826cb6f57csi14317334ejc.407.2022.11.02.20.21.57; Wed, 02 Nov 2022 20:22:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@shopee.com header.s=shopee.com header.b="POmg/14c"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=shopee.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230056AbiKCCNb (ORCPT + 97 others); Wed, 2 Nov 2022 22:13:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229954AbiKCCN2 (ORCPT ); Wed, 2 Nov 2022 22:13:28 -0400 Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC6EB64C1 for ; Wed, 2 Nov 2022 19:13:27 -0700 (PDT) Received: by mail-pj1-x102e.google.com with SMTP id c15-20020a17090a1d0f00b0021365864446so501519pjd.4 for ; Wed, 02 Nov 2022 19:13:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shopee.com; s=shopee.com; h=content-transfer-encoding:in-reply-to:from:references:cc:to:subject :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=sMzrvYyYy/W+4cGhBZeoRUR17rUZ1JZqGeV1907ajb4=; b=POmg/14cGPQ2xtPMaiDVwNaxOFfwYJ9iR4Zycxg3geAV9EKyOz0uySgFDDvmaKTUZi alFKmuXoeHA1Xjf3nZ8ZTFhTKuwtUpI0Tcd+uu8g8qKOqz6dZO3k0ewtWNsbJwLT5PJ5 370knaA+E40T7Z0QQYhOPZRpZJWH9vBpz59pW0NxDgxiqCQeFGPGGxcacctuBI0/vaYx wD+/+thF2Cko0M7CE6Tgv0oy6f54p6hVyvF24DOOMmbt4bpw/s+gVc7a0ELFUKyAGONu JtM7NGmWmBZQ/8zJHs0JB2AJAN8PkH8DXimsaHM+0wxggkJi7WlFDE0Bmz1iNE0oB7N1 J8Ug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to:subject :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=sMzrvYyYy/W+4cGhBZeoRUR17rUZ1JZqGeV1907ajb4=; b=6W7mJ8chnjnV/4wp6hlElyO3R0DlEuD7VdLLD7D78/rRMtzpSz0jQg+dQmcO8mqUKl PcpX60gJZRXvl72O7BPA7Y7E8jLhPdFcQP28L9r+4viXy4501VmYmpO5DbQ3qcKNr5JN S77GkqqAWGJkg3cJ4U0M+zqR+KgcJjahy4SJ6aHsgCBKUbnqZ9W6P+61dSSPmMgytcHR kcJhaK3yoepaUIygVv8XjbBY8ThYJ80pbqpynrWdAyVHN6V/v0xYP1+NHBJd+3f/ERuB LytCW2VCE5GDCB5JX84A2abc06HDdvVGRT7BMeyKGL/MmHl9Ac4LooRj9jMtXaz+eRGl S/4g== X-Gm-Message-State: ACrzQf3MnIrCN+QDruHfoV4YMyaInXrzvZIeiWphNwvrti0eS5/8YIBE 7tU2s6fGildFQm2U83pRTzjJFQ== X-Received: by 2002:a17:902:ce82:b0:187:3591:edac with SMTP id f2-20020a170902ce8200b001873591edacmr12545688plg.153.1667441607226; Wed, 02 Nov 2022 19:13:27 -0700 (PDT) Received: from [10.54.24.49] ([143.92.118.2]) by smtp.gmail.com with ESMTPSA id z5-20020a170903018500b00186ff402525sm3464941plg.213.2022.11.02.19.13.24 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 02 Nov 2022 19:13:26 -0700 (PDT) Message-ID: <25f6a188-4cc6-dace-1468-fd5645711515@shopee.com> Date: Thu, 3 Nov 2022 10:13:22 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.4.0 Subject: Re: [PATCH] cgroup: Simplify code in css_set_move_task To: =?UTF-8?Q?Michal_Koutn=c3=bd?= Cc: tj@kernel.org, lizefan.x@bytedance.com, hannes@cmpxchg.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org References: <20221020074701.84326-1-haifeng.xu@shopee.com> <20221027080558.GA23269@blackbody.suse.cz> <20221031131140.GC27841@blackbody.suse.cz> From: Haifeng Xu In-Reply-To: <20221031131140.GC27841@blackbody.suse.cz> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2022/10/31 21:11, Michal Koutný wrote: > Hello. > >> 1) If calls 'css_set_update_populated' , the cset is either getting the >> first task or losing the last. There is a need to update the populated >> state of the cset only when 'css_set_populated' returns false. >> In other words, the last has been deleted from from_cset and the first >> hasn't been added to to_cset yet. > > I've likely misread the condition previously. I see how this works now > (update happens after "from_cset" but before "to_cset" migration). > >> 3) In order to update the populated state of to_cset the same way >> from_cset does, 'css_set_update_populated' is also invoked during the >> process of moving a task to to_cset. > > As I think more about this in the context of vertical migrations > (ancestor<->descendant, such as during controller dis- or enablement), > I'm afraid the inverted order would lead to "spurious" emptiness > notifications in ancestors (in the case a there is just a single task > that migrates parent->child, parent/cgroup.populated would generate and > event that'd be nullified by the subsequent population of the child). Hi, Michal. I understand your worries. Can I just check the populated state of css_set in 'css_set_update_populated' and don't change the order any more? I think it can also streamline 'css_set_move_task' a bit. Thanks, Hiafeng. > > So I'm not sure the change is worth it. > > Michal