Received: by 2002:ab2:68c1:0:b0:1fd:9a81:d0e4 with SMTP id e1csp158161lqp; Sat, 8 Jun 2024 10:01:05 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVRXGZk5pG8c7RcLEJUwb8HSGa1d5DizEELpU2tCciP3RQCrHLtgAZfP0jMhwRExqPm33W4m+y9uEoe556XsdGOYk9tPm+JXY/N2KHB4w== X-Google-Smtp-Source: AGHT+IH9y7is+LktE8MkgOEOX2JLxn2ayWd8ABfZYPb0fChl9LKqDgasSCluNzW67Xkm9wefrM9Q X-Received: by 2002:a17:906:a001:b0:a65:ec91:c965 with SMTP id a640c23a62f3a-a6cba4a1fa8mr442689566b.10.1717866065469; Sat, 08 Jun 2024 10:01:05 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717866065; cv=pass; d=google.com; s=arc-20160816; b=PZ6JYyXX4+ZLmIptVicvsfXlOx99r8VtypmDuVZ58TCyi+J+WokggOo1DkOrrFL7vN ZLy31QOhX1ZWuhqesOHInM+sZ7swI73hjXNGXSEc1tzoppX+KoOY362SRWhklVFLFouK H1m8D3DxPxaXh50iwfMgv9zx0TfZQl5ATkWiMckpz2oy5WDOfJV1WPiifSVqu/Bp1rnU 6nGt0vWyHh72AxaYcUf4lnW3xwbRG+uCC+r4kdDlpjfz/TYQeVEqkPRmmt0ePVeL6ksn fxftuAdQrpFLN3ka+uQKUt20vyUeO5I9PiDzulU4S6VZq+VVRuSdvJg6Y3Vsgl+58sse Zetg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:feedback-id:dkim-signature; bh=WlAvcvuYpizx43siA6da7TpxkmfPkzBdxJMOwCEaWKM=; fh=c7Oif2hnEM+eijlwrHwAnZSYyTi2tQa5Q8QI4Z/JY7A=; b=YLr5AfSQm4+ESQdPhLKiug3NCQBX1E5FpAdR9xabxD/2lSP0TiQl+9Vgvw+iGCgYjw aMUQ8RXLkLYhVYs+KszWYZXIjcXrk5vq0uPF0rZSZgiNWQGnrMJADTH4bCYwNpcU4jG0 pvnqdwbj02Odu0EYpnkf5euoaQ9zvZtO65I4acTzybTWi+aGzNVF94uELqQyM5ChfSLX KcGmGNwh3SIMGW6Qm5v4lfbqqC4m8AhIcm/gMwN/XlEXdY6dCf/65DzDkEV+meICh3Hj 5wXKxyfXJ/C62pRkbk6boEI9GHAmOvGbMI3OjapTCa81O8WvzHpgthx1S50wcXHOnMVf KpXA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=X6SjjxWD; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-207147-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-207147-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a6c80708031si312700466b.672.2024.06.08.10.01.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 08 Jun 2024 10:01:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-207147-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=X6SjjxWD; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-207147-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-207147-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 051C91F220F1 for ; Sat, 8 Jun 2024 17:01:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 72299176AB4; Sat, 8 Jun 2024 17:00:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="X6SjjxWD" Received: from mail-qv1-f53.google.com (mail-qv1-f53.google.com [209.85.219.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1E0E11DA53; Sat, 8 Jun 2024 17:00:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717866055; cv=none; b=RLWcb/FfOq+w0a6EjMrdTC3qoKZAignabGA9VoOrcLeLwEbS2Csu7j4nta2RzPhV4eXDM3NMqrmAVjl22Lx8nzzC7KFgKAGnrzrI/4VtS0cmh8CArqlttTcN0X1YnRSASbyw6DfoGoa51d7Mw6fPqspML+U8EH9QYADlT4s8z9I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717866055; c=relaxed/simple; bh=gMQ0eHLshKtC1hAUhRc+rdSi0rYKPhqCVJ4aIx7Cwos=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=mY7HY4zUScElftG9lh+pl4TO5FuaGiPVurx99k1W+1fzIoG6WZ3x85qOLsYcziy0D4B+QU6ho3Mte5H+OTcG4r6OBVX2xpylXQJKLTMr71/TbRfjQ+5FX2Adrqq2ACFoVSfpKlSWvuyr0EZ6VYRDj9g2S/dN3qs9fFvZV5dMGE0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=X6SjjxWD; arc=none smtp.client-ip=209.85.219.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-qv1-f53.google.com with SMTP id 6a1803df08f44-6b06e63d288so1762956d6.0; Sat, 08 Jun 2024 10:00:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717866053; x=1718470853; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:feedback-id:from:to:cc:subject:date :message-id:reply-to; bh=WlAvcvuYpizx43siA6da7TpxkmfPkzBdxJMOwCEaWKM=; b=X6SjjxWD7tLG6aGJPAvSHQBpdxZVm60ekmA6HzZmzfxVNi9NHj+pfNEiWsDXLeJ6yP 0SrsRzDyE82YxnsVnqkw1bUxPhvMpPvLImgdwCT031XIIZXBswmgWAXcahyPAtX1w7lL n1+HA0SRJurdaqoUWcOyrQLqH+6atnMHAQNBtsOm9PKjoRcs5amLUkNnlX4wXyF6bE6G sOWvFTfrB/Jk8LkT7RiupZ5fSG9tiumK9udME2WEtkbqYrdMZ7G/9aoA8ywREIetK7mH /smCxNh0dGy+lfnTJkCl762fpEVq3tQ/KzH1BC+LoimRKPRk9aJ2LHAEULJ3NjeW4Air b0hA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717866053; x=1718470853; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:feedback-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WlAvcvuYpizx43siA6da7TpxkmfPkzBdxJMOwCEaWKM=; b=IafB5wZ345LWnTqr5AtbFz3PKduTJHLZMFjvqo+Ci1L2dK/joTWE/5v0N3haeZKZyO fdraHMDw8SoRgXkmyuQmqWqnGBWZfixkPx7+YRui5SgpcLfHRHdAAjmZHudHM9z/OGIv wQIYL/Tljg6GT1EUQNqCbbolVXigofMR0QvCBKBfxsWZT9WCivKExAhAAuIV90E7w3Br OVyhMHfe3ddGK1i4NO+r+3/M+T3saY2o10HKjUjzEVRWyh8Pp1JExAFyLsFyiHT+G+qW mkMG8YmaWZTnldvT4NKj8+HuEhp+L7DiOGWdejSG/X/3LvfuipWElHu4WFNlTdhuhc9s Qg+g== X-Forwarded-Encrypted: i=1; AJvYcCUYlivAsQkOeD2QWkrMb6srCZCD2mzl8HUS++upHk1Iuuf4fM4mWYpco6X32ZR03ulP31JnhjxrjFYUxJX4DBO7yjtwXrjsze4wana8lzDNwxIYjdAmmufK4aQ4FcsYOg2A X-Gm-Message-State: AOJu0Yzef4fvIGJKNUhx+474i8OvNRhuCRSKhr3LbjnZpUmlPf6+KkEk H/N+9OiHkRmUddbrwzTaSQnHi8LlO7ZBohaFeDtefBfp4/nU4R5l X-Received: by 2002:a0c:aa9b:0:b0:6b0:63dc:eb56 with SMTP id 6a1803df08f44-6b063dceeb7mr38052946d6.62.1717866052917; Sat, 08 Jun 2024 10:00:52 -0700 (PDT) Received: from fauth1-smtp.messagingengine.com (fauth1-smtp.messagingengine.com. [103.168.172.200]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6b071aaa3a6sm3974946d6.47.2024.06.08.10.00.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 08 Jun 2024 10:00:52 -0700 (PDT) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailfauth.nyi.internal (Postfix) with ESMTP id 8A4F31200043; Sat, 8 Jun 2024 13:00:51 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Sat, 08 Jun 2024 13:00:51 -0400 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrfedtgedggedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkfhggtggujgesthdtredttddtvdenucfhrhhomhepuehoqhhu nhcuhfgvnhhguceosghoqhhunhdrfhgvnhhgsehgmhgrihhlrdgtohhmqeenucggtffrrg htthgvrhhnpefhtedvgfdtueekvdekieetieetjeeihedvteehuddujedvkedtkeefgedv vdehtdenucffohhmrghinhepkhgvrhhnvghlrdhorhhgnecuvehluhhsthgvrhfuihiivg eptdenucfrrghrrghmpehmrghilhhfrhhomhepsghoqhhunhdomhgvshhmthhprghuthhh phgvrhhsohhnrghlihhthidqieelvdeghedtieegqddujeejkeehheehvddqsghoqhhunh drfhgvnhhgpeepghhmrghilhdrtghomhesfhhigihmvgdrnhgrmhgv X-ME-Proxy: Feedback-ID: iad51458e:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 8 Jun 2024 13:00:50 -0400 (EDT) Date: Sat, 8 Jun 2024 10:00:36 -0700 From: Boqun Feng To: Oleg Nesterov Cc: Andrew Morton , Rachel Menge , linux-kernel@vger.kernel.org, rcu@vger.kernel.org, Wei Fu , apais@linux.microsoft.com, Sudhanva Huruli , Jens Axboe , Christian Brauner , Mike Christie , Joel Granados , Mateusz Guzik , "Paul E. McKenney" , Frederic Weisbecker , Neeraj Upadhyay , Joel Fernandes , Josh Triplett , Steven Rostedt , Mathieu Desnoyers , Lai Jiangshan , Zqiang Subject: Re: [PATCH] zap_pid_ns_processes: clear TIF_NOTIFY_SIGNAL along with TIF_SIGPENDING Message-ID: References: <1386cd49-36d0-4a5c-85e9-bc42056a5a38@linux.microsoft.com> <20240608120616.GB7947@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240608120616.GB7947@redhat.com> On Sat, Jun 08, 2024 at 02:06:16PM +0200, Oleg Nesterov wrote: > kernel_wait4() doesn't sleep and returns -EINTR if there is no > eligible child and signal_pending() is true. > > That is why zap_pid_ns_processes() clears TIF_SIGPENDING but this is not > enough, it should also clear TIF_NOTIFY_SIGNAL to make signal_pending() > return false and avoid a busy-wait loop. > > Fixes: 12db8b690010 ("entry: Add support for TIF_NOTIFY_SIGNAL") > Reported-by: Rachel Menge > Closes: https://lore.kernel.org/all/1386cd49-36d0-4a5c-85e9-bc42056a5a38@linux.microsoft.com/ > Signed-off-by: Oleg Nesterov Reviewed-by: Boqun Feng Wei, appreciate it if you could share some test result and provide a Tested-by tag. Thanks! Regards, Boqun > --- > kernel/pid_namespace.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/kernel/pid_namespace.c b/kernel/pid_namespace.c > index dc48fecfa1dc..25f3cf679b35 100644 > --- a/kernel/pid_namespace.c > +++ b/kernel/pid_namespace.c > @@ -218,6 +218,7 @@ void zap_pid_ns_processes(struct pid_namespace *pid_ns) > */ > do { > clear_thread_flag(TIF_SIGPENDING); > + clear_thread_flag(TIF_NOTIFY_SIGNAL); > rc = kernel_wait4(-1, NULL, __WALL, NULL); > } while (rc != -ECHILD); > > -- > 2.25.1.362.g51ebf55 > >