From nobody Wed Feb 11 20:55:53 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ACDB3C7EE2C for ; Wed, 3 May 2023 12:54:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230005AbjECMy3 (ORCPT ); Wed, 3 May 2023 08:54:29 -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: quoted-printable 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=C3=BD --- 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 *bu= f, 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 =3D ERR_PTR(-EINVAL); goto out_unlock_threadgroup; } --=20 2.40.1