Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp758240rwr; Wed, 3 May 2023 05:56:16 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4HCer46zz8+G6lN+7D3H4kefQ37tEnV3zz4v/MeKygh9eCXyWZ6lp7ZhUPVCjo0yFN8EZN X-Received: by 2002:a05:6a20:3d83:b0:f3:6746:ba37 with SMTP id s3-20020a056a203d8300b000f36746ba37mr21735507pzi.13.1683118575751; Wed, 03 May 2023 05:56:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683118575; cv=none; d=google.com; s=arc-20160816; b=YWgg/ThEpcBRUEAZk1vRdc4srtwvexnzlHOqjRGEscK5cQGO9W9THop3stgqasgruy RlM+CzfIQangEqgCrX0HbxL/LmHKTyKN0DcVXUFDeFRr3eqbY7SOCYuCBuQDG5RE0oh8 QId9/+eChyWYINtOb7ddQajO7L+PjZ2oUuVRQUvX9Hv2Ot3LJ9CQCDO9pRmiZZ9oKtDW cNKaVdD+8j81qAzE9axsIzVZpyBZTIgBMnA39bNGjp3G6VRLI6MnLkVgLdHhW+qsPZdD v6VA70H96b7mk3M2iX6YEMNhAGfkWL0pVZavgZs/a8LzdkZjppRHFqF6hmp8Wgj1T5c2 HOpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=XGQuVbsJSpb3XLS+PmIsQvClRUbeKXxErey9Ewqz9fM=; b=lq0bvArp32WIRrs2SkwgXue3Aj8s28hIG9VuIRvJqRUTaqoMxRH2FxjX5oAY6ey2Ar h6ki3epAHQG/i4GTQ8rozRmeEDP5n80c1esmIEF9tfvg6VMxalvcMYlAVgcyrrRPAS16 mNrNcLp81hfqoidV+uTW0NI6YyDXyEOsBZDwr+vI9idqi4shAL3zzxUzWBiAKz9/HKN9 Q3eTdA5HibfyYNQsvKA7lUDccIUryi4OODJ4DPKZ1FyaYqWWS3DEp2yMqjzGEUSLj6Nx N2g95bW8wkvxtRDD5B1vzna1OqzXtzbDowX7A2/K9M9CAYwkXPz3L94voGFGD6o4J/pZ AsEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=chZi2O4e; 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 c1-20020a656181000000b0050fb1a00d3dsi31931250pgv.46.2023.05.03.05.56.04; Wed, 03 May 2023 05:56:15 -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=chZi2O4e; 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 S229901AbjECMy0 (ORCPT + 99 others); Wed, 3 May 2023 08:54:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54700 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229916AbjECMyU (ORCPT ); Wed, 3 May 2023 08:54:20 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 107BA59FB; Wed, 3 May 2023 05:54:04 -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 B7B38227F7; Wed, 3 May 2023 12:54:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1683118442; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=XGQuVbsJSpb3XLS+PmIsQvClRUbeKXxErey9Ewqz9fM=; b=chZi2O4e9/GB1oKRKC9Hfqkl6IfrkSSPGMUBfDu9Vj7bOqk3o22tv2oyX3AvbbHqWiE8xK FQGsfFkRsAvGEXzIwnGGKoI7/5atVK12eFnEpLC8iBeRSvv6QsESycZXHZ6S2Wa/i/OSIU OexiNAKjs9f7vG6vfdJfQ4anBsioP8M= 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 983AE13584; Wed, 3 May 2023 12:54:02 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id ojRRJGpZUmSWDQAAMHmgww (envelope-from ); Wed, 03 May 2023 12:54:02 +0000 From: =?UTF-8?q?Michal=20Koutn=C3=BD?= To: cgroups@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Tejun Heo , Zefan Li , Johannes Weiner , Benjamin Berg Subject: [RFC PATCH] cgroup: Return error when attempting to migrate a zombie process Date: Wed, 3 May 2023 14:53:59 +0200 Message-Id: <20230503125359.14789-1-mkoutny@suse.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Zombies aren't migrated. However, return value of a migration write may suggest a zombie process was migrated and causing confusion about lack of cgroup.events:populated between origin and target cgroups (e.g. target cgroup rmdir). Notify the users about no effect of their action by a return value. (update_dfl_csses migration of zombies still silently passes since it is not meant to be user-visible migration anyway.) Suggested-by: Benjamin Berg Signed-off-by: Michal Koutný --- kernel/cgroup/cgroup.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) Reasons for RFC: 1) Some users may notice the change, 2) EINVAL vs ESCHR, 3) add a selftest? diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c index 625d7483951c..306547dd7b76 100644 --- a/kernel/cgroup/cgroup.c +++ b/kernel/cgroup/cgroup.c @@ -2968,7 +2968,8 @@ struct task_struct *cgroup_procs_write_start(char *buf, bool threadgroup, * become trapped in a cpuset, or RT kthread may be born in a * cgroup with no rt_runtime allocated. Just say no. */ - if (tsk->no_cgroup_migration || (tsk->flags & PF_NO_SETAFFINITY)) { + if (tsk->no_cgroup_migration || (tsk->flags & PF_NO_SETAFFINITY) || + !atomic_read(&tsk->signal->live)) { tsk = ERR_PTR(-EINVAL); goto out_unlock_threadgroup; } -- 2.40.1