From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=91.218.175.203 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796058246; b=WrDQkLHS6Tump1UNidwvPhpq6hwp4km3itJcoDbqOy+pyPaalNNFwp168nHzA82zdFHo AEW/QbvTT2hrzEHgSsVjC4YlzgOJjvlt4r7Jhc/F+TzMYQTk8PKFj3FGgFdRs3Vw8eS03 YBzxEvMmAFfEQMK1GZ/9OfK277yFX6Vy6ll1Wg2wDZWHN/msu2Xw1KhePpcYbc2XRrfZk kj+0VJ+FtGl+BTOMjNSzroR4/BmTnkqMuMw2ZpYKircc7NCn2xGCJRqjRDxHkX9FeOH6w 9EUNy37cA9hKZE5e9wRfMpGZg09AcgcbkjerpILGXkD/dnkjYPEAZyGyEvh5BUi2s7w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796058246; h=DMARC-Filter:X-Envelope-To:DKIM-Signature:X-Envelope-To:Received: X-Mizu-Trace-ID:X-Migadu-Flow:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=E7iHHBLi0X4NtJquKgp6wHCC4DcyIs7JTT3jPkI0xO0=; b=5PmXZQKweIuMlw9LwerZKCqSRoJTjE6NNBRvdpXAbMX/XvYcQKtdn84XsXHczSEY4vB1 R0NzEg6C3NmMYV8x1XO01LHiw3P7tcxHaWONwRd3XjCRKZK4ApYr8ZYWzQ2norRALnGuC q/FkdUbxh2y2vWXY0p2dcKCeFs1Cg0WEouFCziRmtrj7VfpbzCtYa6XC/c6qjTrXcBXsb csdXML2Ozodzx2tYsHYHq4wapOuhaoOOxjYGsXctvLvVKmbgc7Hj1MZYyIMNzGNZWvuiv /PJxvPyyK8BvHkKGJElKQJRrZ9n4tooOezCHU8YA0wX3HdbMQ4pR/gGVN7yZOG01zqA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=En0+82LW; arc=none smtp.remote-ip=91.218.175.203 Received: from mta0.migadu.com (out-203.mta0.migadu.com [91.218.175.203]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 979A6606A320 for ; Mon, 30 Nov 2026 17:04:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 979A6606A320 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev 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 X-Envelope-To: linux-kernel@vger.kernel.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-kernel@vger.kernel.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-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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.