Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp5211397rwl; Tue, 28 Mar 2023 18:33:28 -0700 (PDT) X-Google-Smtp-Source: AKy350YzWyreweK0snyADwOUPLonyhC+ZZ5xIwJeAtvwVv12jqbBiCO6df+SZwHn3UR597wyAO0+ X-Received: by 2002:aa7:9578:0:b0:627:e49a:871a with SMTP id x24-20020aa79578000000b00627e49a871amr16213004pfq.23.1680053608534; Tue, 28 Mar 2023 18:33:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680053608; cv=none; d=google.com; s=arc-20160816; b=HFvltZLzjjSCaCHy0Q19ISFTp0Nxa856LpL8nJ6VyCUTOjNoY318PT30WbmXci5g03 GAk284WlNFvotjUG+MdL8zxFX8i2Ln1GsMIOFhhVJDUIWb79OGzeGkf4BXUpsAx25N7u b9ZnjykkoGincgEU28hankDUvaF1lzonFVkMpcQYdWg8e3hc/WyOG8UCsKg8bgqrjYKC kgW2nK6BxRB7uoCgaCZIChuoJuxSrr77pILmCrmX3aMOzE0fUuD/Wf6KDPii4BkYHwXn bfINJWx/C1raSZb6m1CmJZB3daBU+9K/n9DhE5+ylNkObvmVHsCgvJP7ocO+wfShufwC Y6iw== 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:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=CspT4SBj2OPAfTD4GX2xH3Q/n47a5hkXe6pVA2r6P70=; b=yIch2wjPFPH2nnSuUEcQuN48w2ByQ4ztluewM+qU8PHUfp7kmZXlqUDM+WmH3Q1QlG A2zX41Sbnqmj/dSCHN9Z6J2qu4EGvioHbDVPVN3ImgpcfkopIaftnT4/+dpcdEX91W3K Ev3oKNx0UWPOjYzeV45XOWkNKkDaTHLSIPLKXKxlaecIu4j/xNAQl4EYcrB5KVJoHSpH cmL/HuOPdwUIdaypf7z965Fh5zZKpizUPc+P4lyZQ5ppxSDNmfNXVuLhQHpzvJbXd48v OV6tZi9E1WWcaNLHP0qH0ebNbO7vA3qHM6R6QI9go8gbPFB7jYrdfw42AnputAvIwluz lCDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="cqR/3z/j"; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g70-20020a636b49000000b00513601ad3d0si5314019pgc.383.2023.03.28.18.33.07; Tue, 28 Mar 2023 18:33:28 -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=@redhat.com header.s=mimecast20190719 header.b="cqR/3z/j"; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229665AbjC2BbT (ORCPT + 99 others); Tue, 28 Mar 2023 21:31:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229573AbjC2BbS (ORCPT ); Tue, 28 Mar 2023 21:31:18 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8749510E7 for ; Tue, 28 Mar 2023 18:30:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1680053427; 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=CspT4SBj2OPAfTD4GX2xH3Q/n47a5hkXe6pVA2r6P70=; b=cqR/3z/jV6E7nlWrqMpjJ0LXU8eyWdqLl1SOfFA7czIwSor0TcJsptZmuaUXvq83KPUJJx jvg3AfbzN9U5Bm1ed+8lGOzgyiuUhMHDz5iZ1wODbglVDaIllVIEPNc1uf7gtYb9LUmoCd pcJbT82w19hPaJk0WL1fQGkZwQO4arU= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-673-CbtxejbKMCSLt1DqU1M2Lw-1; Tue, 28 Mar 2023 21:30:22 -0400 X-MC-Unique: CbtxejbKMCSLt1DqU1M2Lw-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9F318101A54F; Wed, 29 Mar 2023 01:30:21 +0000 (UTC) Received: from [10.22.18.156] (unknown [10.22.18.156]) by smtp.corp.redhat.com (Postfix) with ESMTP id 12153202701E; Wed, 29 Mar 2023 01:30:21 +0000 (UTC) Message-ID: Date: Tue, 28 Mar 2023 21:30:20 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 Subject: Re: CLONE_INTO_CGROUP probably needs to call controller attach handlers Content-Language: en-US To: Christian Brauner , Tejun Heo , Johannes Weiner Cc: Zefan Li , cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, gscrivan@redhat.com References: <20230328153943.op62j3sw7qaixdsq@wittgenstein> From: Waiman Long In-Reply-To: <20230328153943.op62j3sw7qaixdsq@wittgenstein> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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 3/28/23 11:39, Christian Brauner wrote: > Hey, > > Giuseppe reported that the the affinity mask isn't updated when a > process is spawned directly into the target cgroup via > CLONE_INTO_CGROUP. However, migrating a process will cause the affinity > mask to be updated (see the repro at [1]. > > I took a quick look and the issue seems to be that we don't call the > various attach handlers during CLONE_INTO_CGROUP whereas we do for > migration. So the solution seems to roughly be that we need to call the > various attach handlers during CLONE_INTO_CGROUP as well when the > parent's cgroups is different from the child cgroup. I think we need to > call all of them, can, cancel and attach. > > The plumbing here might be a bit intricate since the arguments that the > fork handlers take are different from the attach handlers. > > Christian > > [1]: https://paste.centos.org/view/f434fa1a > I saw that the current cgroup code already have the can_fork, fork and cancel_fork callbacks. Unfortunately such callbacks are not defined for cpuset yet. That is why the cpu affinity isn't correctly updated. I can post a patch to add those callback functions to cpuset which should then able to correctly address this issue. Cheers, Longman