Received: by 2002:a05:6602:2086:0:0:0:0 with SMTP id a6csp4424398ioa; Wed, 27 Apr 2022 03:40:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzpb7bKto9pu3MLuonrJD43UjYIhIj7BHPyJfHDiSSv0gvpIKk4SOzx16jopfIpc/b3tqhU X-Received: by 2002:a63:1215:0:b0:39c:fa33:9427 with SMTP id h21-20020a631215000000b0039cfa339427mr23578378pgl.296.1651056032520; Wed, 27 Apr 2022 03:40:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651056032; cv=none; d=google.com; s=arc-20160816; b=TIIyT2ryV74SbZ/Z6F8QU6h8ZKov6ENF5S5drg0Jw62uL1h3gOb4hJw0MJoKZhYFTB A+BG+M9g+UjqvEp0yXVYgLZrLgoEtK/Vyyn/zlYBt13c81pGJXEI4o0nmePDy04+68Cr FpXMZszELo9ps4WEJ/j5n7rzI3L3ZiM3MpWgql8+vvV8HcVwimaD5Shr5srZmUDGnpsN 67QQAR8cDFDbMIR4Tn7am9eBLPLK3RbN2RFdvgSSSTgOm7ZZoGGRGdKa4iygpk6q0PWG MG+BS4/U8T5SJrpVPazdlUyIbs0AYAPxtTwHmWfCO6WoBzasNrativhCUzNXtVvGRkY5 FEqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=X5IMKSn8cqp42mpK4BkTLfY4tpG4hfU6GiNj+N3eB8I=; b=ENgahOSh76ULPK8rrGzPcj9LE50ukjJztlOCuWDBGIC5sLXP0+I60z0y1xkVe+n5nr 2j5hpvDKZOyMV/Lomb+Zr7p6XVlNQ7b2DwaTjRZY7YO1brhfMv7pnQBwzQc/GOjNTq+c WbaLpFMsGHynta1j3ruO4QlJpvdginktfRBzV+u7gGpCCR+S7u+lI89YYSyYSHy3rZJ3 n/bHzbANPtExVMK2WVbKA+xnfmZlWrguc8+P3+2Q7pVV6QAPBzYatPVYDdpCjD7ivxUn qUg5kAL+NSXOGeewyilRYcapFWuvKPd8XKbwDnzwlHJ3gOyYQ+vZbjH/9crk1zS+ijgM Ye7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qe51Zqr8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id e7-20020a636907000000b003816043f054si1003077pgc.585.2022.04.27.03.40.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Apr 2022 03:40:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qe51Zqr8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E22133E2839; Wed, 27 Apr 2022 02:51:11 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351439AbiDZOMb (ORCPT + 99 others); Tue, 26 Apr 2022 10:12:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242887AbiDZOMa (ORCPT ); Tue, 26 Apr 2022 10:12:30 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2AAFB1C121 for ; Tue, 26 Apr 2022 07:09:22 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D106DB81CFE for ; Tue, 26 Apr 2022 14:09:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 97BE5C385AA; Tue, 26 Apr 2022 14:09:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1650982159; bh=cn5vJ91S0B5D1VOlBlyzpD8O4r5FahRLokcLNG4NiEU=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=qe51Zqr8EfwpOPspP4puM0YF+yTOcDUFofezOFFxkzmDbAfD5HQ6tINKn9PDcPl+l HdxZpY72ksQYizK32X1LHoNLWHnSpUT9hyshuNlzcQBbs8snG+6T5ZXSpTo8STo4kg znnOlHH0k3t8i0wq+r7JlIkSzKFgpV4OvQz7JRS/kTFD+gp8d8BSuwPhwMLlAvvHaW E75aeXFN+pf89YLTscUQt81rvwNCSI7gQZaZOlUXTEcJAauk3+kkc+PceoRFKJKil+ v3NhJozqWFSDwMic4VUhrxr8KyZHtCXM30CxxGE40sfgPzrW9jRCDVdQYrkLNZThk7 j4uN0TAAziz8g== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 35D495C0460; Tue, 26 Apr 2022 07:09:19 -0700 (PDT) Date: Tue, 26 Apr 2022 07:09:19 -0700 From: "Paul E. McKenney" To: Christoph Bartoschek Cc: Chris Mason , Giuseppe Scrivano , linux-kernel@vger.kernel.org, "riel@surriel.com" , "viro@zeniv.linux.org.uk" Subject: Re: [PATCH RFC fs/namespace] Make kern_unmount() use synchronize_rcu_expedited() Message-ID: <20220426140919.GD4285@paulmck-ThinkPad-P17-Gen-1> Reply-To: paulmck@kernel.org References: <8E281DF1-248F-4861-A3C0-2573A5EFEE61@fb.com> <20220426065917.3123488-1-bartoschek@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220426065917.3123488-1-bartoschek@google.com> X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE autolearn=unavailable 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 On Tue, Apr 26, 2022 at 08:59:17AM +0200, Christoph Bartoschek wrote: > The regression that has been introduced with commit > e1eb26fa62d04ec0955432be1aa8722a97cb52e7 has hit us when building with Bazel > using the linux-sandbox > (https://github.com/bazelbuild/bazel/blob/master/src/main/tools/linux-sandbox.cc). > The sandbox tries to isolate build steps from each other and to ensure that > builds are hermetic and therefore sets up new namespaces for each step. For > large software packages and even with the time spend building we run out of > namespaces on larger machines that allow for enough parallelism. I have reduced > the sandbox to a simple test case: > > #define _GNU_SOURCE > #include > #include > #include > #include > #include > #include > > int pid1main(void *) { > return 0; > } > > int main(void) { > int clone_flags = CLONE_NEWUSER | CLONE_NEWIPC | SIGCHLD; > void * stack = malloc(1024*1024); > const pid_t child_pid = clone(pid1main, stack + 1024*1024, clone_flags, NULL); > > if (child_pid < 0) { > perror("clone"); > } > int ret = waitpid(child_pid, NULL, 0); > if (ret < 0) { > perror("waitpid"); > return ret; > } > return 0; > } > > Run it with > $ gcc clone-test.cc > $ seq 1 10000000 | parallel --halt now,fail=1 -j32 $PWD/a.out > clone: No space left on device > waitpid: No child processes > parallel: This job failed: > /usr/local/google/home/bartoschek/linux-sandbox-test/a.out 53070 > > I run the test on kernel v5.18-rc4. > Depending on your configured limits you will soon get an ENOSPC even though > never more than 32 additional namespaces should be in use by parallel. > During execution the whole system can become quite unresponsive. > This does not happen without e1eb26fa62d04ec0955432be1aa8722a97cb52e7. > > I see that the issue was already reported in 2020: > http://merlin.infradead.org/pipermail/linux-nvme/2020-September/019565.html > > Would it be possible to revert e1eb26fa62d04ec0955432be1aa8722a97cb52e7? It > seems to make the kernel less deterministic and hard to reason about active > namespaces. There were several attempts to fix this: 1. https://lore.kernel.org/lkml/20220214190549.GA2815154@paulmck-ThinkPad-P17-Gen-1/ Replace a synchronize_rcu() with synchronize_rcu_expedited() 2. https://lore.kernel.org/lkml/20220217153620.4607bc28@imladris.surriel.com/ Use queue_rcu_work() and streamline things. 3. https://lore.kernel.org/lkml/20220218183114.2867528-1-riel@surriel.com/ Refined queue_rcu_work() approach. #1 should work, but the resulting IPIs are not going to make the real-time guys happy. #2 and #3 have been subject to reasonably heavy testing and did fix a very similar issue to the one that you are reporting, but last I knew there were doubts about the concurrency consequences. Could you please give at least #3 a shot and see if it helps you? Thanx, Paul