Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp5567156rwr; Tue, 9 May 2023 03:25:38 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4oq8rnQIq6QfNdiYHrd/4QyVSQnQeFZjW8T/9yeJ0leOZL2rBj5NIgYhFnbyrUQMBNJqGF X-Received: by 2002:a05:6a20:3d85:b0:ef:ef0a:f92a with SMTP id s5-20020a056a203d8500b000efef0af92amr17449903pzi.25.1683627938349; Tue, 09 May 2023 03:25:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683627938; cv=none; d=google.com; s=arc-20160816; b=FTe3JD9aHfpipRGSpKJbtLUsYK/vZ+yW8Er4P8KZthdaxXfnRZHRzFd+LylMjrQmem R4szUqmWSTAQ8Q5GaCBh9Av8mD7WeBsvbwNio/IqCCLViDvfJ5b04YRezJnws8ZtPx2t Oh0+5RosIoNPuD2RXIuBCFpSNiAeHlIeQdWeXaMHGv72D3wW+q9WfZJ3+f9uqQckw26/ o9JVWutPztZCVPigsxL1tbRMWcMwEwszH1vGtSHl0kL9/lNAxPFOybXNRLpgvrgOe1id W98URWEc3buqS/MQxMaVafW0YhppPlLD1Wy3Dz7R0n2H/8ZC7NdQ8TlBRfhCT8HWdvhy zeVA== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=jVOcH3ojLkF2oleErumS69jiq2T/Qhx9NHw4f5gaQfM=; b=ZpARxdyND9PT903xAAoO/48Tmv87z4v2bqYOk7/8ZZ4daDSQ8I4SKv8A5jp92H3qb2 AHVOWvZxyv9cY+5KOq5qZg6pj6ua1YFEOOSCwr4aWMQJ1fWoXQg+G0Dky8DU96WpgPQ5 idwABNfAyib0R0Xv479ikfLmGGVaDaAvt+VXd/IzfZd3IQfQhoGgsAzt+2RpdkNb7ged Nacn2IGybS1+vA/oTZROHEEK2Xd+STEL1B+JOavtoZR0c9OKssv+kZvSfexPMYjrIrQq fdV85SAh8vp2ukNJCel3K5vsFsHV6UObgHebI6IMjW548Ny3sJG7ZuLgpMjncikRyJNR 7iDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=EkRevYyx; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m129-20020a633f87000000b005285958c85bsi1071779pga.807.2023.05.09.03.25.26; Tue, 09 May 2023 03:25:38 -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=@suse.com header.s=susede1 header.b=EkRevYyx; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234635AbjEIKDx (ORCPT + 99 others); Tue, 9 May 2023 06:03:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42736 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230286AbjEIKDw (ORCPT ); Tue, 9 May 2023 06:03:52 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E1572126; Tue, 9 May 2023 03:03:51 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id BB6B221B45; Tue, 9 May 2023 10:03:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1683626629; h=from:from:reply-to: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=jVOcH3ojLkF2oleErumS69jiq2T/Qhx9NHw4f5gaQfM=; b=EkRevYyx8PlFZqTaDOGZUy0A3OlcDuXYp+8WnEwhteSXOC+jm4o+uVjFd3PqkV3+b9/ULI 0fNxYIR1s/7M3CIJ0OYb6jixod9/IoCmGW47JhMnPPfc/6tkEpp0AwQZ+bpEwLtv8cNBQK PRSt9u7dk3pavlC5Dqdk0gMzT0d5s1w= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 98490139B3; Tue, 9 May 2023 10:03:49 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id ibwyJIUaWmTgeAAAMHmgww (envelope-from ); Tue, 09 May 2023 10:03:49 +0000 Date: Tue, 9 May 2023 12:03:48 +0200 From: Michal =?utf-8?Q?Koutn=C3=BD?= To: Tejun Heo Cc: cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, Zefan Li , Johannes Weiner , Benjamin Berg Subject: Re: [RFC PATCH] cgroup: Return error when attempting to migrate a zombie process Message-ID: References: <20230503125359.14789-1-mkoutny@suse.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="kajz4hm6ew66s2tm" Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 --kajz4hm6ew66s2tm Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, May 05, 2023 at 09:04:37AM -1000, Tejun Heo wrote: > This seems racy to me. The liveness state can change between here and the > PF_EXITING check in cgroup_migrate_add_task(), right? You're right, threadgroup lock won't prevent that (as I got wrongly in the patch): cgroup_procs_write_start =20 do_exit exit_signals cgroup_threadgroup= _change_begin tsk->flags |=3D = PF_EXITING cgroup_threadgroup= _change_end percpu_down_write(&cgroup_threadgroup_rwsem) =20 ... =20 atomic_read(&live) =20 ... atomic_dec_and_test(= live) ... =20 cgroup_migrate_add_task =20 ... =20 percpu_up_write(&cgroup_threadgroup_rwsem) > Wouldn't it be better to just track how many tasks are tracked and > return -ESRCH if none was migrated? Thanks, such an integral sounds better, will see. Michal --kajz4hm6ew66s2tm Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQTrXXag4J0QvXXBmkMkDQmsBEOquQUCZFoagQAKCRAkDQmsBEOq uV58AP0YJRo7aRKynt665xXOLH1SQSTX1MShDbDSZVr+4pBULgEAx887fE5n3Mar tkkG4OI6a6Bof2v6liLPXWWg50Giigo= =CdaX -----END PGP SIGNATURE----- --kajz4hm6ew66s2tm--