From patchwork Thu Jan 26 20:57:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rik van Riel X-Patchwork-Id: 13117760 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 86FC0C54EAA for ; Thu, 26 Jan 2023 20:57:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232474AbjAZU5m (ORCPT ); Thu, 26 Jan 2023 15:57:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230217AbjAZU5l (ORCPT ); Thu, 26 Jan 2023 15:57:41 -0500 Received: from shelob.surriel.com (shelob.surriel.com [96.67.55.147]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 87DB734C08; Thu, 26 Jan 2023 12:57:37 -0800 (PST) Received: from imladris.home.surriel.com ([10.0.13.28] helo=imladris.surriel.com) by shelob.surriel.com with esmtpsa (TLS1.2) tls TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1pL9JN-0001D5-1b; Thu, 26 Jan 2023 15:57:33 -0500 From: Rik van Riel To: linux-kernel@vger.kernel.org, viro@zeniv.linux.org.uk, kernel-team@meta.com, linux-fsdevel@vger.kernel.org, gscrivan@redhat.com Subject: [PATCH 0/2] ipc,namespace: fix free vs allocation race Date: Thu, 26 Jan 2023 15:57:19 -0500 Message-Id: <20230126205721.582612-1-riel@surriel.com> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 Sender: riel@shelob.surriel.com Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org The IPC namespace code frees ipc_namespace structures asynchronously, via a work queue item. This results in ipc_namespace structures being freed very slowly, and the allocation path getting false failures since the to-be-freed ipc_namespace structures have not been freed yet. Fix that by having the allocator wait when there are ipc_namespace structures pending to be freed. Also speed up the freeing of ipc_namespace structures. We had some discussions about this last year, and ended up trying out various "nicer" ideas that did not work, so I went back to the original, with Al Viro's suggestion for a helper function: https://lore.kernel.org/all/Yg8StKzTWh+7FLuA@zeniv-ca.linux.org.uk/ This series fixes both the false allocation failures, and the slow freeing of ipc_namespace structures.