Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp1566119pxb; Fri, 18 Feb 2022 10:20:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJxz/U96rch6Pbp3bjSrmIlAoOJlx0Bkzkq24ZPW1l2ve5ZxHwARtCEnn3GlUISf0JBFA8rh X-Received: by 2002:a63:1f01:0:b0:373:4f8f:213a with SMTP id f1-20020a631f01000000b003734f8f213amr7357918pgf.548.1645208418038; Fri, 18 Feb 2022 10:20:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645208418; cv=none; d=google.com; s=arc-20160816; b=yOYz3heYueOxhGgr+3RUltpVZ063kzBymeWcw0vnsIr/hAPZf71DVYGhw7veTOt7av uvt14em2BkrQhjhjsHzZsbLaJ3ewClYTG6yg1MbIwBQ3DtVbIzTSLJ4jTN66hFrJ/ifx E2Pi2dRapHkbGYumuNUe5ukrbALe2r7RMTHcHVCXhTQH5tlB2g2k50/vhWDGoxk8INis kZEgF/n1Laxaby2NliT2CXaJawFvPZDyBZBPdn0AG/xRsXYd2tcG+jGKvXNUwj+n4kPa Iwi0cLIKFxYHkSWET6Hvc7eFmjPwK49/nziRa0VKjmAcHnCwcxPk7xon8dp3rMSd0c4B DKCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:mime-version:user-agent:message-id :in-reply-to:date:references:cc:to:from; bh=t5BuwANLZcPhb1zCWbMujAlSKZKdh9dn9MEIO1zsxKg=; b=yGRnSnI5U0pnmIfy51GhHtcKALg7bCWi9ZgdTrMHAC3TK7ointRSw/8GYs5+jKKkK6 rbxp/6FgAHG22TP4TQsOzWkxWwC4iHG0TDm2REeKzu0ixMRVDdgO51DCH6zkN4CuL1Ak n+3Ol2m7JCaeBUr4kqRTuQ6Oy4qrzelfd6IK9+sppXaOKTD/jllZ1RnuhoSvhb/igEp4 NcYkfVSZ2HoKhXNINJ5ldCPHH/eT1Fqac+1eu5jUACL7oNiab7NYlTd3VXC46ge411K4 JjJ6Z0rQ249hnYYX+E/Yb3CO+9kcD5cDK3/JdLMg1e2bSo2uVRcjLJkqY/O/LJx4xgbC mRAg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xmission.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p22si31145243plb.391.2022.02.18.10.20.02; Fri, 18 Feb 2022 10:20:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xmission.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236458AbiBRQIo (ORCPT + 99 others); Fri, 18 Feb 2022 11:08:44 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:44946 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232578AbiBRQIm (ORCPT ); Fri, 18 Feb 2022 11:08:42 -0500 Received: from out03.mta.xmission.com (out03.mta.xmission.com [166.70.13.233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C9A4CCC4E for ; Fri, 18 Feb 2022 08:08:25 -0800 (PST) Received: from in02.mta.xmission.com ([166.70.13.52]:45600) by out03.mta.xmission.com with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1nL5ny-00Ec5Y-Ia; Fri, 18 Feb 2022 09:08:22 -0700 Received: from ip68-227-174-4.om.om.cox.net ([68.227.174.4]:50354 helo=email.froward.int.ebiederm.org.xmission.com) by in02.mta.xmission.com with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1nL5np-000aMm-18; Fri, 18 Feb 2022 09:08:22 -0700 From: "Eric W. Biederman" To: Rik van Riel Cc: linux-kernel@vger.kernel.org, kernel-team@fb.com, Chris Mason , "Paul E. McKenney" , linux-fsdevel@vger.kernel.org, Giuseppe Scrivano , Al Viro References: <20220217153620.4607bc28@imladris.surriel.com> Date: Fri, 18 Feb 2022 10:08:05 -0600 In-Reply-To: <20220217153620.4607bc28@imladris.surriel.com> (Rik van Riel's message of "Thu, 17 Feb 2022 15:36:20 -0500") Message-ID: <87iltcf996.fsf@email.froward.int.ebiederm.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-SPF: eid=1nL5np-000aMm-18;;;mid=<87iltcf996.fsf@email.froward.int.ebiederm.org>;;;hst=in02.mta.xmission.com;;;ip=68.227.174.4;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX19gVp8M02CqpqJfjbQxgIt7XAaL04EJRws= X-SA-Exim-Connect-IP: 68.227.174.4 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-DCC: ; X-Spam-Combo: *;Rik van Riel X-Spam-Relay-Country: X-Spam-Timing: total 8812 ms - load_scoreonly_sql: 0.05 (0.0%), signal_user_changed: 11 (0.1%), b_tie_ro: 10 (0.1%), parse: 0.99 (0.0%), extract_message_metadata: 3.0 (0.0%), get_uri_detail_list: 0.84 (0.0%), tests_pri_-1000: 3.8 (0.0%), tests_pri_-950: 1.29 (0.0%), tests_pri_-900: 1.05 (0.0%), tests_pri_-90: 61 (0.7%), check_bayes: 60 (0.7%), b_tokenize: 6 (0.1%), b_tok_get_all: 4.9 (0.1%), b_comp_prob: 1.62 (0.0%), b_tok_touch_all: 45 (0.5%), b_finish: 0.80 (0.0%), tests_pri_0: 8701 (98.7%), check_dkim_signature: 1.04 (0.0%), check_dkim_adsp: 2.8 (0.0%), poll_dns_idle: 0.70 (0.0%), tests_pri_10: 4.0 (0.0%), tests_pri_500: 15 (0.2%), rewrite_mail: 0.00 (0.0%) Subject: Re: [PATCH][RFC] ipc,fs: use rcu_work to free struct ipc_namespace X-SA-Exim-Version: 4.2.1 (built Sat, 08 Feb 2020 21:53:50 +0000) X-SA-Exim-Scanned: Yes (on in02.mta.xmission.com) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Maybe I am reading the lifetimes wrong but is there any chance the code can just do something like the diff below? AKA have a special version of kern_umount that does the call_rcu? Looking at rcu_reclaim_tiny I think this use of mnt_rcu is valid. AKA reusing the rcu_head in the rcu callback. diff --git a/fs/namespace.c b/fs/namespace.c index 40b994a29e90..7d7aaef1592e 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -4395,6 +4395,22 @@ void kern_unmount(struct vfsmount *mnt) } EXPORT_SYMBOL(kern_unmount); +static void rcu_mntput(struct rcu_head *head) +{ + struct mount *mnt = container_of(head, struct mount, mnt_rcu); + mntput(&mnt->mnt); +} + +void kern_rcu_unmount(struct vfsmount *mnt) +{ + /* release long term mount so mount point can be released */ + if (!IS_ERR_OR_NULL(mnt)) { + struct mount *m = real_mount(mnt); + m->mnt_ns = NULL; + call_rcu(&m->mnt_rcu, rcu_mntput); + } +} + void kern_unmount_array(struct vfsmount *mnt[], unsigned int num) { unsigned int i; diff --git a/ipc/mqueue.c b/ipc/mqueue.c index 5becca9be867..e54742f82e7d 100644 --- a/ipc/mqueue.c +++ b/ipc/mqueue.c @@ -1700,7 +1700,7 @@ void mq_clear_sbinfo(struct ipc_namespace *ns) void mq_put_mnt(struct ipc_namespace *ns) { - kern_unmount(ns->mq_mnt); + kern_rcu_unmount(ns->mq_mnt); } static int __init init_mqueue_fs(void) Eric