From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F2807606A339 for ; Mon, 30 Nov 2026 17:04:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=En0+82LW Received: by kanga.kvack.org (Postfix) id 153D56B05B8; Mon, 30 Nov 2026 12:04:14 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1048E6B05B9; Mon, 30 Nov 2026 12:04:14 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 01ADB6B05BA; Mon, 30 Nov 2026 12:04:13 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id CDCBC6B05B8 for ; Mon, 30 Nov 2026 12:04:13 -0500 (EST) Received: from smtpin15.hostedemail.com (lb01a-stub [10.200.18.249]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 2C5321A0A9F for ; Mon, 30 Nov 2026 17:04:08 +0000 (UTC) X-FDA: 85492408176.15.B51CB1A Received: from mta1.migadu.com (out-53.mta1.migadu.com [95.215.58.53]) by imf14.hostedemail.com (Postfix) with ESMTP id BC105100016 for ; Mon, 30 Nov 2026 17:04:05 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=En0+82LW; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf14.hostedemail.com: domain of shakeel.butt@linux.dev designates 95.215.58.53 as permitted sender) smtp.mailfrom=shakeel.butt@linux.dev ARC-Seal: i=1; a=rsa-sha256; d=hostedemail.com; s=arc-20220608; cv=none; t=1796058246; b=x9AYrM387qh8RVIcwnlTL0ZHa3vSRPMgUFyiY7wbPZF+nLhpu+eO35fVEajmJiUKPlzIYQ SwWZszrt3JpiBmKGRG/pzsQF7tMHM8ivglv6nPryq4dNsyPQHk5J2OYDGNfWkCkPZPPrb6 1VHrohbFJP62iEAAduDhWgurKtLhSrw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1796058246; h=from:from:sender: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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=E7iHHBLi0X4NtJquKgp6wHCC4DcyIs7JTT3jPkI0xO0=; b=5FILwojRqqxf6PLHs/DFLMnbYqwkYZWgOAsLzhQ2mQFE44djqjh4JSXZEm1BzEB9Rc7u1s EurF1r0TLFqFpqc7Pwl6PyMTKRZiSTtiyVG4s8kHFl4LpW3kN9miDvWk+OP8Wgdsp57g7Z 4gztqy5GMsRTMR7UXxog0I2q3wF/wm4= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=En0+82LW; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf14.hostedemail.com: domain of shakeel.butt@linux.dev designates 95.215.58.53 as permitted sender) smtp.mailfrom=shakeel.butt@linux.dev X-Envelope-To: linux-mm@kvack.org DKIM-Signature: a=rsa-sha256; bh=aotvP3sJVyajPlHFcO/7iO4QcdEbpQQ+0Nqu0Ep+3AY=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1796058243; v=1; x=1796663043; b=En0+82LW667MJQkdjyRDSaoJoKzFCN54Mbi8GsXo40bkZs0wn76wkUDbN4MnUaBECwKJlFWz lhDbnYfJ6Q6x2DzJQJ4cLEznRzsTUTE+xlRU9790vm36tmHEO68gBkbAN/0pxi7PjX3hc7pne8+ kvlZLVaFnsmkWbbxHC8Y0vdo= X-Envelope-To: linux-mm@kvack.org Received: by smtp.migadu.com with ESMTPS id 8c2adcc0e1a51ddd; Mon, 30 Nov 2026 17:04:03 +0000 X-Mizu-Trace-ID: 8c2adcc0e1a51ddd X-Migadu-Flow: FLOW_OUT Date: Mon, 30 Nov 2026 09:04:01 -0800 From: Shakeel Butt To: Tejun Heo Cc: Andrew Morton , Johannes Weiner , Michal Koutny , Michal Hocko , Roman Gushchin , Christian Brauner , Oleg Nesterov , Sebastian Andrzej Siewior , Suren Baghdasaryan , "T . J . Mercier" , Usama Arif , Meta kernel team , cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 0/9] cgroup: don't hold cgroup_mutex for cgroup.kill and cgroup.freeze Message-ID: References: <20261129183524.1052436-1-shakeel.butt@linux.dev> X-Archived-By: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspam-User: X-Stat-Signature: xny7eq4xbn4baa4wjt3ifpgq8w7zmeq7 X-Rspamd-Queue-Id: BC105100016 X-Rspamd-Server: rspam10 X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-HE-Tag: 1796058245-163145 X-HE-Meta: U2FsdGVkX1+x2Jd9a2OMTQfQSOJsJuIqT4zY/3vFOadqAuJhbAL/2tX22lhOrjLRpFkTPxzlDLONyQBn88xqwyv+u27uVe/EQ68nWxhYxC0cA1furHGwM2/WNrNw3zuhIsL+nnJ76g5nq/zzE4Y+odRnLf2Hk92fHtvMCXAPOXI1GVGV5j3Rc0rJy5D31mDfFM0UGdy8UWzW1+q4W8C7AgN0bAERQb5gS/ZfAeSqSgbx1zAyArqP0YjhDg0/6RPd02HQ0h/jFgrUFJdkJoHHhj+GHVd5fL3pTEFLSPcdCoW0JHhywpzSu/ChY2k1XBNT6wGI6EWI7wfQHA6r+7WSUM9Uz7Y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ZztX7oahwRKv7DlrT4SzyilUDghB/nXkU10QIJO00e09XfeEvP70Pjezvq0QrStSy5tFFl7oFAOHC9XqF5ua0utKXkv7Ybw== Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 On Sun, Nov 29, 2026 at 06:25:21PM -1000, Tejun Heo wrote: > Hello, Shakeel. > > The following is a Claude-generated review. > > Two problems were found, in 8/9 and 9/9. Both were reproduced in a VM > with delays added to widen the windows. The debug patch and the > reproducer are attached. Thanks a lot for taking a look. > > 1. A migration that fails before it commits makes the task walk skip a > task (8/9 and 9/9). > > cgroup_migrate_add_task() calls css_set_skip_task_iters() and moves > the task to cset->mg_tasks. When ->can_attach() then fails, > out_release_tset in cgroup_migrate_execute() splices mg_tasks back > onto cset->tasks. An iterator whose next task was that one has > already moved past the end of cset->tasks and never returns it. The > task didn't change css_set, so neither the kill in > cgroup_migrate_execute() nor cgroup_freezer_migrate_task() runs for > it. cgroup_mutex used to keep migrations out of the walks. > > The task has to be the last one on its css_set that the iterator > hasn't returned, so a cgroup with one task is enough. With the failed > attach between css_task_iter_start() and the first > css_task_iter_next(): > > - cgroup.kill returns success and the task survives. > - A freeze leaves cgroup.freeze at 1 with the task running, and the > cgroup never reports frozen. > - A thaw leaves cgroup.freeze at 0 and "frozen 0" in cgroup.events > with the task still frozen. I think this failed migration issue is in css_task_iter and has been present since the commit 5ee01f1a7343. Will fix as a separate patch in v2. > > 2. The SIGKILL sent from cgroup_migrate_execute() isn't forced (8/9). > > send_sig(SIGKILL, task, 0) sends SEND_SIG_NOINFO, which > send_signal_locked() forces only when current is outside the target's > pid namespace. current is the migrator there, not the cgroup.kill > writer. A pid namespace init which writes its own pid to cgroup.procs > of a cgroup that the walk has already passed ignores the signal and > survives a kill written from the host. The same move made from the > host kills it. > > The other direction follows from the code and wasn't run: a host > migration during a kill written inside the container kills an init > which that kill would have left alone. Here I think we need to remember the writer and for the migration path, if the writer is outside the target's pid namespace, only then force the kill. I will address the remaining points as well in v2.